[
  {
    "path": ".gitattributes",
    "content": "* linguist-language=Java\n"
  },
  {
    "path": "AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"org.evilbinary.highliter\"\n    android:versionCode=\"1\"\n    android:versionName=\"1.0\" >\n\n    <uses-sdk\n        android:minSdkVersion=\"8\"\n        android:targetSdkVersion=\"14\" />\n\n    <application\n        android:largeHeap=\"true\"\n        android:allowBackup=\"true\"\n        android:icon=\"@drawable/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:theme=\"@style/Theme.Base.AppCompat.Light.DarkActionBar\" >\n        <activity\n            android:name=\"org.evilbinary.app.MainActivity\"\n            android:label=\"@string/app_name\" >\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n    </application>\n\n</manifest>\n"
  },
  {
    "path": "HighlightTextEditor.iml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module external.linked.project.id=\"HighlightTextEditor\" external.linked.project.path=\"$MODULE_DIR$\" external.root.project.path=\"$MODULE_DIR$\" external.system.id=\"GRADLE\" external.system.module.group=\"\" external.system.module.version=\"unspecified\" type=\"JAVA_MODULE\" version=\"4\">\n  <component name=\"FacetManager\">\n    <facet type=\"android-gradle\" name=\"Android-Gradle\">\n      <configuration>\n        <option name=\"GRADLE_PROJECT_PATH\" value=\":\" />\n      </configuration>\n    </facet>\n    <facet type=\"android\" name=\"Android\">\n      <configuration>\n        <option name=\"SELECTED_BUILD_VARIANT\" value=\"debug\" />\n        <option name=\"SELECTED_TEST_ARTIFACT\" value=\"_android_test_\" />\n        <option name=\"ASSEMBLE_TASK_NAME\" value=\"assembleDebug\" />\n        <option name=\"COMPILE_JAVA_TASK_NAME\" value=\"compileDebugSources\" />\n        <option name=\"ASSEMBLE_TEST_TASK_NAME\" value=\"assembleDebugAndroidTest\" />\n        <option name=\"COMPILE_JAVA_TEST_TASK_NAME\" value=\"compileDebugAndroidTestSources\" />\n        <afterSyncTasks>\n          <task>generateDebugAndroidTestSources</task>\n          <task>generateDebugSources</task>\n        </afterSyncTasks>\n        <option name=\"ALLOW_USER_CONFIGURATION\" value=\"false\" />\n        <option name=\"RES_FOLDERS_RELATIVE_PATH\" value=\"file://$MODULE_DIR$/res\" />\n      </configuration>\n    </facet>\n  </component>\n  <component name=\"NewModuleRootManager\" LANGUAGE_LEVEL=\"JDK_1_6\" inherit-compiler-output=\"false\">\n    <output url=\"file://$MODULE_DIR$/build/intermediates/classes/debug\" />\n    <output-test url=\"file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug\" />\n    <exclude-output />\n    <content url=\"file://$MODULE_DIR$\">\n      <sourceFolder url=\"file://$MODULE_DIR$/build/generated/source/r/debug\" isTestSource=\"false\" generated=\"true\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build/generated/source/aidl/debug\" isTestSource=\"false\" generated=\"true\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build/generated/source/buildConfig/debug\" isTestSource=\"false\" generated=\"true\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build/generated/source/rs/debug\" isTestSource=\"false\" generated=\"true\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build/generated/res/rs/debug\" type=\"java-resource\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build/generated/res/resValues/debug\" type=\"java-resource\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build/generated/source/r/androidTest/debug\" isTestSource=\"true\" generated=\"true\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug\" isTestSource=\"true\" generated=\"true\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug\" isTestSource=\"true\" generated=\"true\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug\" isTestSource=\"true\" generated=\"true\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug\" type=\"java-test-resource\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug\" type=\"java-test-resource\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build-types/debug/res\" type=\"java-resource\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build-types/debug/resources\" type=\"java-resource\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build-types/debug/assets\" type=\"java-resource\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build-types/debug/aidl\" isTestSource=\"false\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build-types/debug/java\" isTestSource=\"false\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build-types/debug/jni\" isTestSource=\"false\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/build-types/debug/rs\" isTestSource=\"false\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/res\" type=\"java-resource\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/src\" type=\"java-resource\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/assets\" type=\"java-resource\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/src\" isTestSource=\"false\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/src/androidTest/res\" type=\"java-test-resource\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/src/androidTest/resources\" type=\"java-test-resource\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/src/androidTest/assets\" type=\"java-test-resource\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/src/androidTest/aidl\" isTestSource=\"true\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/src/androidTest/java\" isTestSource=\"true\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/src/androidTest/jni\" isTestSource=\"true\" />\n      <sourceFolder url=\"file://$MODULE_DIR$/src/androidTest/rs\" isTestSource=\"true\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/assets\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/blame\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/classes\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/dependency-cache\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/dex-cache\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/20.0.0/jars\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/20.0.0/jars\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/incremental\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/jniLibs\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/lint\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/lint-cache\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/manifests\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/pre-dexed\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/res\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/rs\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/symbols\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/intermediates/transforms\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/native\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/outputs\" />\n      <excludeFolder url=\"file://$MODULE_DIR$/build/tmp\" />\n    </content>\n    <orderEntry type=\"jdk\" jdkName=\"Android API 14 Platform\" jdkType=\"Android SDK\" />\n    <orderEntry type=\"sourceFolder\" forTests=\"false\" />\n    <orderEntry type=\"library\" exported=\"\" name=\"tagsoup-1.2.1\" level=\"project\" />\n    <orderEntry type=\"library\" exported=\"\" name=\"w3c\" level=\"project\" />\n    <orderEntry type=\"library\" exported=\"\" name=\"cssparser-0.9.17\" level=\"project\" />\n    <orderEntry type=\"library\" exported=\"\" name=\"appcompat-v7-20.0.0\" level=\"project\" />\n    <orderEntry type=\"library\" exported=\"\" name=\"support-annotations-20.0.0\" level=\"project\" />\n    <orderEntry type=\"library\" exported=\"\" name=\"support-v4-20.0.0\" level=\"project\" />\n    <orderEntry type=\"library\" exported=\"\" name=\"sac-1.3\" level=\"project\" />\n    <orderEntry type=\"library\" exported=\"\" name=\"hotsax\" level=\"project\" />\n  </component>\n</module>"
  },
  {
    "path": "README.md",
    "content": "HighlightTextEditor\n\nAn android HighlightTextEditor一款语法高亮控件。qq群:537960195。\n\n# 语法高亮\nHighlightTextEditor是一个安卓代码语法高亮控件，目前已经支持200多种语言，近90多种主题配色方案，同时支持lua扩展，以及自定义语言配置。强烈推荐，一款不可多得的开源控件。\n### 支持的语言：\n\tabap4.lang        clojure.lang      innosetup.lang    nxc.lang          s.lang\n\tabc.lang          clp.lang          interlis.lang     oberon.lang       sas.lang\n\tabnf.lang         cobol.lang        io.lang           objc.lang         scala.lang\n\tactionscript.lang coldfusion.lang   jasmin.lang       ocaml.lang        scilab.lang\n\tada.lang          conf.lang         java.lang         octave.lang       scss.lang\n\tagda.lang         crk.lang          js.lang           oorexx.lang       sh.lang\n\talgol.lang        csharp.lang       jsp.lang          os.lang           small.lang\n\tampl.lang         css.lang          ldif.lang         oz.lang           smalltalk.lang\n\tamtrix.lang       d.lang            less.lang         paradox.lang      sml.lang\n\tapplescript.lang  dart.lang         lhs.lang          pas.lang          snmp.lang\n\tarc.lang          diff.lang         lilypond.lang     pdf.lang          snobol.lang\n\tarm.lang          dylan.lang        limbo.lang        perl.lang         spec.lang\n\tas400cl.lang      ebnf.lang         lindenscript.lang php.lang          spn.lang\n\tascend.lang       eiffel.lang       lisp.lang         pike.lang         sql.lang\n\tasp.lang          erlang.lang       logtalk.lang      pl1.lang          squirrel.lang\n\taspect.lang       euphoria.lang     lotos.lang        plperl.lang       styl.lang\n\tassembler.lang    express.lang      lotus.lang        plpython.lang     swift.lang\n\tats.lang          fame.lang         lua.lang          pltcl.lang        sybase.lang\n\tautohotkey.lang   felix.lang        luban.lang        pov.lang          tcl.lang\n\tautoit.lang       fortran77.lang    make.lang         pro.lang          tcsh.lang\n\tavenue.lang       fortran90.lang    maple.lang        progress.lang     tex.lang\n\tawk.lang          frink.lang        matlab.lang       ps.lang           ts.lang\n\tbat.lang          fsharp.lang       maya.lang         ps1.lang          tsql.lang\n\tbbcode.lang       fx.lang           mercury.lang      psl.lang          ttcn3.lang\n\tbcpl.lang         gambas.lang       miranda.lang      pure.lang         txt.lang\n\tbibtex.lang       gdb.lang          mod2.lang         pyrex.lang        upc.lang\n\tbiferno.lang      go.lang           mod3.lang         python.lang       vala.lang\n\tbison.lang        graphviz.lang     modelica.lang     q.lang            vb.lang\n\tblitzbasic.lang   haskell.lang      moon.lang         qmake.lang        verilog.lang\n\tbms.lang          haxe.lang         ms.lang           qml.lang          vhd.lang\n\tbnf.lang          hcl.lang          mssql.lang        qu.lang           xml.lang\n\tboo.lang          html.lang         mxml.lang         r.lang            xpp.lang\n\tc.lang            httpd.lang        n3.lang           rebol.lang        yaiff.lang\n\tceylon.lang       icon.lang         nasal.lang        rexx.lang         yang.lang\n\tcharmm.lang       idl.lang          nbc.lang          rnc.lang          znn.lang\n\tchill.lang        idlang.lang       nemerle.lang      rpg.lang\n\tclean.lang        inc_luatex.lang   netrexx.lang      rpl.lang\n\tclearbasic.lang   informix.lang     nice.lang         rs.lang\n\tclipper.lang      ini.lang          nsis.lang         ruby.lang\n### 支持的配色主题：\n\tacid.theme              darkspectrum.theme      fruit.theme             pablo.theme\n\taiseered.theme          denim.theme             golden.theme            peaksea.theme\n\tandes.theme             dusk.theme              greenlcd.theme          print.theme\n\tanotherdark.theme       earendel.theme          kellys.theme            rand01.theme\n\tautumn.theme            easter.theme            leo.theme               rdark.theme\n\tbaycomb.theme           edit-anjuta.theme       lucretia.theme          relaxedgreen.theme\n\tbclear.theme            edit-eclipse.theme      manxome.theme           rootwater.theme\n\tbiogoo.theme            edit-emacs.theme        maroloccio.theme        seashell.theme\n\tbipolar.theme           edit-flashdevelop.theme matrix.theme            solarized-dark.theme\n\tblacknblue.theme        edit-gedit.theme        moe.theme               solarized-light.theme\n\tbluegreen.theme         edit-jedit.theme        molokai.theme           tabula.theme\n\tbreeze.theme            edit-kwrite.theme       moria.theme             tcsoft.theme\n\tbright.theme            edit-matlab.theme       navajo-night.theme      the.theme\n\tcamo.theme              edit-msvs2008.theme     navy.theme              vampire.theme\n\tcandy.theme             edit-nedit.theme        neon.theme              whitengrey.theme\n\tclarity.theme           edit-vim-dark.theme     night.theme             xoria256.theme\n\tdante.theme             edit-vim.theme          nightshimmer.theme      zellner.theme\n\tdarkblue.theme          edit-xcode.theme        nuvola.theme            zenburn.theme\n\tdarkbone.theme          ekvoli.theme            olive.theme             zmrok.theme\n\tdarkness.theme          fine_blue.theme         orion.theme\n\tdarkslategray.theme     freya.theme             oxygenated.theme\n### 插件支持：\n\tasciidoc_html_add_links.lua        cpp_ref_wxwidgets_org.lua          outhtml_curly_brackets_matcher.lua\n\tbash_functions.lua                 cpp_syslog.lua                     outhtml_keyword_matcher.lua\n\tbash_ref_linuxmanpages_com.lua     cpp_wx.lua                         outhtml_parantheses_matcher.lua\n\tcpp_qt.lua                         ctags_html_tooltips.lua            perl_ref_perl_org.lua\n\tcpp_ref_cplusplus_com.lua          java_library.lua                   python_ref_python_org.lua\n\tcpp_ref_gtk_gnome_org.lua          keywords_capitalize.lua            scala_ref_scala_lang_org.lua\n\tcpp_ref_local_includes.lua         keywords_lowercase.lua             theme_invert.lua\n\tcpp_ref_qtproject_org.lua          keywords_uppercase.lua             token_add_state_ids.lua\t\n# 截图\n* 代码编辑界面 \n\n\t<img src=\"https://github.com/evilbinary/HighlightTextEditor/raw/master/data/Andes.jpg\" alt=\"编辑界面\" style=\"max-width:200px;\" width=\"200px\" />\n\t<img src=\"https://github.com/evilbinary/HighlightTextEditor/raw/master/data/Fine-Blue.jpg\" alt=\"编辑界面\" style=\"max-width:200px;\" width=\"200px\" />\n\t<img src=\"https://github.com/evilbinary/HighlightTextEditor/raw/master/data/Candy.jpg\" alt=\"编辑界面\" style=\"max-width:200px;\" width=\"200px\" />\n\t<img src=\"https://github.com/evilbinary/HighlightTextEditor/raw/master/data/Seashell.jpg\" alt=\"编辑界面\" style=\"max-width:200px;\" width=\"200px\" />\n\t<img src=\"https://github.com/evilbinary/HighlightTextEditor/raw/master/data/Matrix.jpg\" alt=\"编辑界面\" style=\"max-width:200px;\" width=\"200px\" />\n\t<img src=\"https://github.com/evilbinary/HighlightTextEditor/raw/master/data/Vampire.jpg\" alt=\"编辑界面\" style=\"max-width:200px;\" width=\"200px\" />\n\t<img src=\"https://github.com/evilbinary/HighlightTextEditor/raw/master/data/Breeze.jpg\" alt=\"编辑界面\" style=\"max-width:200px;\" width=\"200px\" />\n\t\n\t<img src=\"https://github.com/evilbinary/HighlightTextEditor/raw/master/data/pad.jpg\" alt=\"编辑界面\" style=\"max-width:400px;\" width=\"400px\" />\n\t\n\t\n\n# 历史记录\n* a199ea2 - (HEAD, origin/master, master) 图片宽度修改 (evilbinary)\n* 046d56e - 高亮基本版本完成 (evilbinary)\n* 3bfce62 - 修复0，0位置文字获取不全问题 (evilbinary)\n* d51e13a - 增加语法解析后端 (evilbinary)\n* d6acd76 - 修改大小 (evilbinary)\n* a1d48bb - modify pic (evilbinary)\n* 65cbc6a - 修改图片大小 (evilbinary)\n* f90e1d5 - 代码截图 (evilbinary)\n* 43b466e - 增加显示行数 (evilbinary)\n* 7a766af - 移动文件，重新定义 (evilbinary)\n* 62c7078 - 增加css外部加载样式功能 (evilbinary)\n* d48d344 - 去除标题显示 (evilbinary)\n* 3a6a782 - 增加解析支持 (evilbinary)\n* b198bdd - modify readme (evilbinary)\n* ef7d5c6 - Create README.md (evilbinary)\n* 95f3a12 - first version (evilbinary)\n\n\n# Todo\n* 代码渲染基本功能。 ［完成］\n* 支持200多种语言。 ［完成］\n* 支持82种配色主题。 ［完成］\n* 支持lua扩展语法高亮检测。\t ［基本完成］\n* 若干bug修复。\n* 主题语言更换功能。\n* 字体大小样式功能。\n* 表情功能。（待定）\n\n# 项目捐赠\n\n![喜欢就支持一下](https://github.com/evilbinary/myblog/raw/master/data/s.png)\n\n# 作者\n* evilbinary rootdebug@163.com\n* 个人博客 [http://evilbinary.org](http://evilbinary.org)\n\n# 项目主页\n* [https://github.com/evilbinary/HighlightTextEditor](https://github.com/evilbinary/HighlightTextEditor)\n\n# License\n\nCopyright 2016 evilbinary\n\n/* Copyright (C) 2015 evilbinary. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. */\n"
  },
  {
    "path": "assets/fib.py",
    "content": "#!/usr/bin/env python\n\nfibs = {0: 0, 1: 1}\ndef fib(n):\n    if n in fibs: return fibs[n]\n    if n % 2 == 0:\n        fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2)\n        return fibs[n]\n    else:\n        fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2)\n        return fibs[n]\n\nprint (\"fib(234) = %i\" % fib(234))"
  },
  {
    "path": "assets/highlight.css",
    "content": "/* Style definition file generated by highlight 3.23, http://www.andre-simon.de/ */\n\n/* Highlighting theme: vim molokai */\n\nbody.hl\t{ background-color:#272822; }\npre.hl\t{ color:#f8f8f2; background-color:#272822; font-size:10pt; font-family:'Courier New',monospace;}\n.hl.num { color:#ae81ff; }\n.hl.esc { color:#66d9ef; font-style:italic; }\n.hl.str { color:#e6db74; }\n.hl.pps { color:#e6db74; }\n.hl.slc { color:#75715e; }\n.hl.com { color:#75715e; }\n.hl.ppc { color:#defa25; }\n.hl.opt { color:#f8f8f2; }\n.hl.ipl { color:#66d9ef; font-style:italic; }\n.hl.lin { color:#75715e; }\n.hl.kwa { color:#f92672; font-weight:bold; }\n.hl.kwb { color:#66d9ef; }\n.hl.kwc { color:#95f067; }\n.hl.kwd { color:#25faac; }\n\n"
  },
  {
    "path": "assets/lib.lisp",
    "content": ";;sys\n(define (find-proc name)\n    (if (procedure? name)\n\tname\n\t(sys:find name (sys:top-env))))\n(define (proc-name proc)\n    (if (procedure? proc)\n\t (sys:lookup-var proc (sys:top-env))\n\tproc))\n(define (update-proc name proc)\n    (sys:update name proc (sys:top-env)))\n\n;;add1 sub1\n(define (add1 n)\n    (+ n 1))\n(define (sub1 n)\n    (- n 1))\n\n;(define (zero? n)\n;(= 0 n))\n\n(define (atom? x) (not (pair? x)))\n\n;(define (map fn l)\n;(if (pair? l)\n;(cons (fn (car l)) (map fn (cdr l)))\n;'()))\n\n;;list helper functions\n(define (caar x) (car (car x))) \n(define (cadr x) (car (cdr x))) \n(define (cddr x) (cdr (cdr x))) \n(define (cdar x) (cdr (car x))) \n\n(define (caaar x) (car (car (car x)))) \n(define (caadr x) (car (car (cdr x)))) \n(define (cadar x) (car (cdr (car x)))) \n(define (caddr x) (car (cdr (cdr x)))) \n(define (cdaar x) (cdr (car (car x)))) \n(define (cdadr x) (cdr (car (cdr x)))) \n(define (cddar x) (cdr (cdr (car x)))) \n(define (cdddr x) (cdr (cdr (cdr x)))) \n\n(define (caaaar x) (car (car (car (car x))))) \n(define (caaadr x) (car (car (car (cdr x))))) \n(define (caadar x) (car (car (cdr (car x))))) \n(define (caaddr x) (car (car (cdr (cdr x))))) \n(define (cadaar x) (car (cdr (car (car x))))) \n(define (cadadr x) (car (cdr (car (cdr x))))) \n(define (caddar x) (car (cdr (cdr (car x))))) \n(define (cadddr x) (car (cdr (cdr (cdr x))))) \n(define (cdaaar x) (cdr (car (car (car x))))) \n(define (cdaadr x) (cdr (car (car (cdr x))))) \n(define (cdadar x) (cdr (car (cdr (car x))))) \n(define (cdaddr x) (cdr (car (cdr (cdr x))))) \n(define (cddaar x) (cdr (cdr (car (car x))))) \n(define (cddadr x) (cdr (cdr (car (cdr x))))) \n(define (cdddar x) (cdr (cdr (cdr (car x))))) \n(define (cddddr x) (cdr (cdr (cdr (cdr x))))) \n\n\n;;empty?\n(define (empty? lst) (eq? lst nil)) \n\n;max min\n(define max\n  (lambda (x y)\n    (if (> x y) x y)))\n\n(define min\n  (lambda (x y)\n    (if (< x y) x y)))\n\n;;factorial\n(define (factorial n)\n    (if (= n 1)\n\t1(* n (factorial (- n 1)))))\n\n;;abs\n(define (abs x)\n    (cond ((< x 0) (- x))\n\t  (else x)))\n\n;;<=\n(define (<= x y)\n    (or (< x y) (= x y)))\n\n;;>=\n(define (>= x y)\n    (or (> x y) (= x y)))\n;;map\n(define (map proc items)\n  (if (null? items)\n      nil\n      (cons (proc (car items))\n            (map proc (cdr items)))))\n;(map abs '( -10 2.5 -11.6 17))\n;(map (lambda (n) (* 2 n)) '(1 2 3 4 5 6))\n;(map zero? '(1 0 3 0 6))\n\n;nil '()\n(define nil '())\n;exp\n;; Linear recursion\n(define (expt b n)\n  (if (= n 0)\n      1\n      (* b (expt b (- n 1)))))\n\n\n;; Linear iteration\n(define (expt b n)\n  (expt-iter b n 1))\n\n(define (expt-iter b counter product)\n  (if (= counter 0)\n      product\n      (expt-iter b\n                (- counter 1)\n                (* b product)))) \n;(expt 2.1 10)\n\n;;;list fun\n(define  list\n  (lambda values values) ) \n\n;(define (list . objs) objs)\n\n\n;(list 'd 'a 1 'ee '(a b c d))\n;(list 3 4 'a (car '(b . c)) (+ 6 -2))\n;(list (list 1 2) (list 3 4))\n\n;;append ok\n(define (append x y) \n    (if (null? x) y\n\t\t\t\t\t;(not (pair? x)) (display \"first arg must pair\")\n\t(cons (car x) (append (cdr x) y))))\n\n;(trace 'append)\n;(trace 'null?)\n;(append '(a b c d e) 'b )\n;(append 'a 'b)\n\n;;length\n(define length\n    (lambda (l)\n      (if (null? l)\n\t  0\n\t  (+ 1 (length (cdr l))))))\n\n;;reverse\n(define reverse\n    (lambda (l)\n      (if (null? l)\n\t  nil\n\t  (append (reverse (cdr l)) (list (car l))))))\n\n;(define (reverse l)\n;    (define (iter in out)\n;\t(if (pair? in)\n;\t    (iter (cdr in) (cons (car in) out))\n;\t    out))\n;  (iter l '()))\n\n;(trace 'null?)\n;(trace 'reverse)\n;(trace 'list)\n;(reverse '())\n;(trace 'append)\n;(reverse '(1 3 5 9 11))\n\n(define (id obj) obj)\n;;eqv?\n(define eqv? eq?)\n\n\n;===================trace================\n;;trace\n(define trace-display \n    display)\n\n(define (print-level indent char)\n    (if (< indent 1) (trace-display \"\")\n\t(begin\n\t (trace-display char)\n\t (print-level (- indent 1) char))))\n\n;(print-level 10 \"--\")\n\n;(define nil '())\n\n(define *trace-functions* '())\n(define *trace-level* 1)\n(define *trace-state* 0)\n(define (find-trace-function name functions)\n    (if (null? functions)\n\t'()\n\t(if (eq? (caar functions) name)\n\t    (cdar functions)\n\t    (find-trace-function name (cdr functions)))))\n\n(define (trace-invoke proc args)\n;    (display args)                                                                                                                                        \n;  (display (length args))                                                                                                                                 \n;  (proc (car args)  ))\n  (apply proc args))\n;(cond ((<= 1 (length args))\n;          (proc (car args) ))\n;       ((= 2 (length args))\n;        (proc (car args) (cadr args)))\n;        ((= 3 (length args))\n;       (proc (car args) (cadr args) (caddr args)))\n;       ((>= 4 (length args))\n;       (proc (car args) (cadr args) (caddr args) (cadddr args)))))\n\n(define (trace name)\n    (let ((proc (find-proc name))\n\t  (new-proc nil )\n\t  (proc-name (proc-name name))\n\t  (result nil))\n      ;(display \"proc=name:\")\n      ;(display proc-name)\n      ;(newline)\n      (if (eq? 'trace-display proc-name)\n\t  (set! proc-name 'display))\n;      (display proc-name)\n\n      (set! new-proc (lambda x\n\t\t       (begin\n\t\t\t(print-level *trace-level* \"-\")    \n\t\t\t(trace-display proc-name)\n\t\t\t(trace-display  x)\n\t\t\t\t\t;(map (lambda (a) (display a) (newline)  )x)\n\t\t\t(trace-display \"\\n\")\n\t\t\t(set! *trace-level* (+ *trace-level* 1))\n\t\t\t\t\t;(set! result (proc (car x) (car (cdr x)) ))\n\t\t\t(set! result (trace-invoke  proc  x ))\n\t\t\t(set! *trace-level* (- *trace-level* 1)) \n\t\t\t(print-level *trace-level* \"-\")\n\t\t\t(trace-display result)\n\t\t\t(trace-display \"\\n\")\n\t\t\tresult)) )\n\t\t\t\t\t;(display (cons proc new-proc))\n      (update-proc proc-name new-proc)))\n\n;set sys-log level\n;(sys:set-log-level 7);for debug log\n\n;;list*\n(define (list* . args)\n  (if (pair? args)\n      (if (pair? (cdr args))\n          (cons (car args) (apply list* (cdr args)))\n          (car args) )\n      (quote ()) ) )\n\n\n;;last-pair\n(define (last-pair l)\n  (if (pair? l)\n      (if (pair? (cdr l)) \n          (last-pair (cdr l))\n          l )\n      (error 'last-pair l) ) )\n\n\n;;reverse!\n(define (reverse! l)\n  (define (nreverse l r)\n    (if (pair? l)\n       (let ((cdrl (cdr l)))\n         (set-cdr! l r)\n         (nreverse cdrl l) )\n       r ) )\n  (nreverse l '()) )\n;;list-length\n(define list-length\n    (lambda (lst)\n      (if (null? lst)\n\t  0\n\t  (+ 1 (list-length (cdr lst))))))\n\n;;nth-element\n(define nth-element\n    (lambda (lst n)\n      (if (null? lst)\n\t  (erro \"report-list-too-short\" n)\n\t  (if (zero? n)\n\t      (car lst)\n\t      (nth-element (cdr lst) (- n 1))))))\n;;remove-first\n(define remove-first\n    (lambda (s los)\n      (if (null? los)\n\t  '()\n\t  (if (eqv? (car los) s)\n\t      (cdr los)\n\t      (cons (car los) (remove-first s (cdr los)))))))\n\n;;occurs-free?\n(define occurs-free?\n    (lambda (var exp)\n      (cond\n\t((symbol? exp) (eqv? var exp))\n\t((eqv? (car exp) 'lambda)\n\t (and\n\t  (not (eqv? var (car (cadr exp))))\n\t  (occurs-free? var (caddr exp))))\n\t(else (or\n\t       (occurs-free? var (car exp))\n\t       (occurs-free? var (cadr exp)))))))\n;;subst\n(define subst\n    (lambda (new old slist)\n      (if (null? slist)\n\t  '() (cons\n\t       (subst-in-s-exp new old (car slist)) \n\t       (subst new old (cdr slist))))))\n\n(define subst-in-s-exp\n    (lambda (new old sexp)\n      (if (symbol? sexp)\n\t  (if (eqv? sexp old) new sexp)\n\t  (subst new old sexp))))\n\n;;remainder\n(define (remainder n d)\n    (if (< n d)\n\tn\n\t(remainder (- n d) d)))\n;;gcd\n(define (gcd a b)\n    (if (= b 0)\n\ta\n\t(gcd b (remainder a b))))\n\n;;list-ref\n(define (list-ref items n)\n    (if (= n 0)\n\t(car items)\n\t(list-ref (cdr items) (- n 1))))\n\n"
  },
  {
    "path": "assets/test.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"ISO-8859-1\">\n<title>src/core/codegenerator.cpp</title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"highlight.css\">\n</head>\n<body class=\"hl\">\n<pre class=\"hl\"><span class=\"hl com\">/***************************************************************************</span>\n<span class=\"hl com\">                          codegenerator.cpp  -  description</span>\n<span class=\"hl com\">                             -------------------</span>\n<span class=\"hl com\">    begin                : Die Jul 9 2002</span>\n<span class=\"hl com\">    copyright            : (C) 2002-2012 by Andre Simon</span>\n<span class=\"hl com\">    email                : andre.simon1&#64;gmx.de</span>\n<span class=\"hl com\"> ***************************************************************************/</span>\n\n\n<span class=\"hl com\">/*</span>\n<span class=\"hl com\">This file is part of Highlight.</span>\n<span class=\"hl com\"></span>\n<span class=\"hl com\">Highlight is free software: you can redistribute it and/or modify</span>\n<span class=\"hl com\">it under the terms of the GNU General Public License as published by</span>\n<span class=\"hl com\">the Free Software Foundation, either version 3 of the License, or</span>\n<span class=\"hl com\">(at your option) any later version.</span>\n<span class=\"hl com\"></span>\n<span class=\"hl com\">Highlight is distributed in the hope that it will be useful,</span>\n<span class=\"hl com\">but WITHOUT ANY WARRANTY; without even the implied warranty of</span>\n<span class=\"hl com\">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>\n<span class=\"hl com\">GNU General Public License for more details.</span>\n<span class=\"hl com\"></span>\n<span class=\"hl com\">You should have received a copy of the GNU General Public License</span>\n<span class=\"hl com\">along with Highlight.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>\n<span class=\"hl com\">*/</span>\n\n\n<span class=\"hl ppc\">#include &lt;climits&gt;</span>\n<span class=\"hl ppc\">#include &lt;memory&gt;</span>\n<span class=\"hl ppc\">#include &lt;boost/xpressive/xpressive_dynamic.hpp&gt;</span>\n\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;codegenerator.h&quot;</span><span class=\"hl ppc\"></span>\n\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;htmlgenerator.h&quot;</span><span class=\"hl ppc\"></span>\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;xhtmlgenerator.h&quot;</span><span class=\"hl ppc\"></span>\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;rtfgenerator.h&quot;</span><span class=\"hl ppc\"></span>\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;latexgenerator.h&quot;</span><span class=\"hl ppc\"></span>\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;texgenerator.h&quot;</span><span class=\"hl ppc\"></span>\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;svggenerator.h&quot;</span><span class=\"hl ppc\"></span>\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;bbcodegenerator.h&quot;</span><span class=\"hl ppc\"></span>\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;pangogenerator.h&quot;</span><span class=\"hl ppc\"></span>\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;odtgenerator.h&quot;</span><span class=\"hl ppc\"></span>\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;astyle/astyle.h&quot;</span><span class=\"hl ppc\"></span>\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;astyle/ASStreamIterator.h&quot;</span><span class=\"hl ppc\"></span>\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;mygenerator.h&quot;</span><span class=\"hl ppc\"></span>\n\n<span class=\"hl ppc\">#if !defined (QT)</span>\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;ansigenerator.h&quot;</span><span class=\"hl ppc\"></span>\n<span class=\"hl ppc\">#include</span> <span class=\"hl pps\">&quot;xterm256generator.h&quot;</span><span class=\"hl ppc\"></span>\n<span class=\"hl ppc\">#endif</span>\n\n<span class=\"hl kwa\">using namespace</span> std<span class=\"hl opt\">;</span>\n\n<span class=\"hl kwa\">namespace</span> highlight\n<span class=\"hl opt\">{</span>\n<span class=\"hl kwb\">const unsigned int</span> CodeGenerator<span class=\"hl opt\">::</span>NUMBER_BUILTIN_STATES <span class=\"hl opt\">=</span> highlight<span class=\"hl opt\">::</span>KEYWORD<span class=\"hl opt\">;</span>\n\n<span class=\"hl kwb\">const</span> string CodeGenerator<span class=\"hl opt\">::</span>STY_NAME_STD<span class=\"hl opt\">=</span><span class=\"hl str\">&quot;std&quot;</span><span class=\"hl opt\">;</span>\n<span class=\"hl kwb\">const</span> string CodeGenerator<span class=\"hl opt\">::</span>STY_NAME_STR<span class=\"hl opt\">=</span><span class=\"hl str\">&quot;str&quot;</span><span class=\"hl opt\">;</span>\n<span class=\"hl kwb\">const</span> string CodeGenerator<span class=\"hl opt\">::</span>STY_NAME_NUM<span class=\"hl opt\">=</span><span class=\"hl str\">&quot;num&quot;</span><span class=\"hl opt\">;</span>\n<span class=\"hl kwb\">const</span> string CodeGenerator<span class=\"hl opt\">::</span>STY_NAME_SLC<span class=\"hl opt\">=</span><span class=\"hl str\">&quot;slc&quot;</span><span class=\"hl opt\">;</span>\n<span class=\"hl kwb\">const</span> string CodeGenerator<span class=\"hl opt\">::</span>STY_NAME_COM<span class=\"hl opt\">=</span><span class=\"hl str\">&quot;com&quot;</span><span class=\"hl opt\">;</span>\n<span class=\"hl kwb\">const</span> string CodeGenerator<span class=\"hl opt\">::</span>STY_NAME_ESC<span class=\"hl opt\">=</span><span class=\"hl str\">&quot;esc&quot;</span><span class=\"hl opt\">;</span>\n<span class=\"hl kwb\">const</span> string CodeGenerator<span class=\"hl opt\">::</span>STY_NAME_DIR<span class=\"hl opt\">=</span><span class=\"hl str\">&quot;ppc&quot;</span><span class=\"hl opt\">;</span> <span class=\"hl slc\">//preprocessor</span>\n<span class=\"hl kwb\">const</span> string CodeGenerator<span class=\"hl opt\">::</span>STY_NAME_DST<span class=\"hl opt\">=</span><span class=\"hl str\">&quot;pps&quot;</span><span class=\"hl opt\">;</span> <span class=\"hl slc\">//preprocessor string</span>\n<span class=\"hl kwb\">const</span> string CodeGenerator<span class=\"hl opt\">::</span>STY_NAME_LIN<span class=\"hl opt\">=</span><span class=\"hl str\">&quot;lin&quot;</span><span class=\"hl opt\">;</span>\n<span class=\"hl kwb\">const</span> string CodeGenerator<span class=\"hl opt\">::</span>STY_NAME_SYM<span class=\"hl opt\">=</span><span class=\"hl str\">&quot;opt&quot;</span><span class=\"hl opt\">;</span> <span class=\"hl slc\">//operator</span>\n<span class=\"hl kwb\">const</span> string CodeGenerator<span class=\"hl opt\">::</span>STY_NAME_IPL<span class=\"hl opt\">=</span><span class=\"hl str\">&quot;ipl&quot;</span><span class=\"hl opt\">;</span> <span class=\"hl slc\">//interpolation</span>\n\nCodeGenerator <span class=\"hl opt\">*</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">getInstance</span> <span class=\"hl opt\">(</span> OutputType type <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    CodeGenerator<span class=\"hl opt\">*</span> generator<span class=\"hl opt\">=</span>NULL<span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">switch</span> <span class=\"hl opt\">(</span> type <span class=\"hl opt\">)</span>\n    <span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">case</span> HTML<span class=\"hl opt\">:</span>\n        generator <span class=\"hl opt\">=</span> <span class=\"hl kwa\">new</span> <span class=\"hl kwd\">HtmlGenerator</span><span class=\"hl opt\">();</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">case</span> XHTML<span class=\"hl opt\">:</span>\n        generator <span class=\"hl opt\">=</span> <span class=\"hl kwa\">new</span> <span class=\"hl kwd\">XHtmlGenerator</span><span class=\"hl opt\">();</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">case</span> TEX<span class=\"hl opt\">:</span>\n        generator <span class=\"hl opt\">=</span> <span class=\"hl kwa\">new</span> <span class=\"hl kwd\">TexGenerator</span> <span class=\"hl opt\">();</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">case</span> LATEX<span class=\"hl opt\">:</span>\n        generator <span class=\"hl opt\">=</span> <span class=\"hl kwa\">new</span> <span class=\"hl kwd\">LatexGenerator</span><span class=\"hl opt\">();</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">case</span> RTF<span class=\"hl opt\">:</span>\n        generator <span class=\"hl opt\">=</span> <span class=\"hl kwa\">new</span> <span class=\"hl kwd\">RtfGenerator</span> <span class=\"hl opt\">();</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">case</span> SVG<span class=\"hl opt\">:</span>\n        generator <span class=\"hl opt\">=</span> <span class=\"hl kwa\">new</span> <span class=\"hl kwd\">SVGGenerator</span><span class=\"hl opt\">();</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">case</span> BBCODE<span class=\"hl opt\">:</span>\n        generator <span class=\"hl opt\">=</span> <span class=\"hl kwa\">new</span> <span class=\"hl kwd\">BBCodeGenerator</span><span class=\"hl opt\">();</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">case</span> PANGO<span class=\"hl opt\">:</span>\n        generator <span class=\"hl opt\">=</span> <span class=\"hl kwa\">new</span> <span class=\"hl kwd\">PangoGenerator</span><span class=\"hl opt\">();</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">case</span> ODTFLAT<span class=\"hl opt\">:</span>\n        generator <span class=\"hl opt\">=</span> <span class=\"hl kwa\">new</span> <span class=\"hl kwd\">ODTGenerator</span><span class=\"hl opt\">();</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n<span class=\"hl ppc\">#if !defined (QT)</span>\n    <span class=\"hl kwa\">case</span> ANSI<span class=\"hl opt\">:</span>\n        generator <span class=\"hl opt\">=</span> <span class=\"hl kwa\">new</span> <span class=\"hl kwd\">AnsiGenerator</span><span class=\"hl opt\">();</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">case</span> XTERM256<span class=\"hl opt\">:</span>\n        generator <span class=\"hl opt\">=</span> <span class=\"hl kwa\">new</span> <span class=\"hl kwd\">Xterm256Generator</span><span class=\"hl opt\">();</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">case</span> MY<span class=\"hl opt\">:</span>\n        generator <span class=\"hl opt\">=</span> <span class=\"hl kwa\">new</span> <span class=\"hl kwd\">MyGenerator</span><span class=\"hl opt\">();</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n<span class=\"hl ppc\">#endif</span>\n    <span class=\"hl kwa\">default</span><span class=\"hl opt\">:</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl opt\">}</span>\n    <span class=\"hl kwa\">return</span> generator<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n\nCodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">CodeGenerator</span> <span class=\"hl opt\">(</span> highlight<span class=\"hl opt\">::</span>OutputType type <span class=\"hl opt\">)</span>\n    <span class=\"hl opt\">:</span><span class=\"hl kwd\">currentSyntax</span><span class=\"hl opt\">(</span>NULL<span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">in</span> <span class=\"hl opt\">(</span> NULL <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">out</span> <span class=\"hl opt\">(</span> NULL <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">encoding</span> <span class=\"hl opt\">(</span> <span class=\"hl str\">&quot;none&quot;</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">docTitle</span> <span class=\"hl opt\">(</span> <span class=\"hl str\">&quot;Source file&quot;</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">maskWs</span> <span class=\"hl opt\">(</span> <span class=\"hl kwa\">false</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">excludeWs</span> <span class=\"hl opt\">(</span> <span class=\"hl kwa\">false</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">fragmentOutput</span> <span class=\"hl opt\">(</span> <span class=\"hl kwa\">false</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">showLineNumbers</span> <span class=\"hl opt\">(</span> <span class=\"hl kwa\">false</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">lineNumberFillZeroes</span> <span class=\"hl opt\">(</span> <span class=\"hl kwa\">false</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">printNewLines</span><span class=\"hl opt\">(</span><span class=\"hl kwa\">true</span><span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">baseFontSize</span><span class=\"hl opt\">(</span><span class=\"hl str\">&quot;10&quot;</span><span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">lineNumber</span> <span class=\"hl opt\">(</span> <span class=\"hl num\">0</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">lineNumberOffset</span> <span class=\"hl opt\">(</span> <span class=\"hl num\">0</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">includeStyleDef</span> <span class=\"hl opt\">(</span> <span class=\"hl kwa\">false</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">lineIndex</span> <span class=\"hl opt\">(</span> <span class=\"hl num\">0</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">lineNumberWidth</span> <span class=\"hl opt\">(</span> <span class=\"hl num\">5</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">maxLineCnt</span> <span class=\"hl opt\">(</span> UINT_MAX <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">terminatingChar</span> <span class=\"hl opt\">(</span> <span class=\"hl str\">'\\0'</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">formatter</span> <span class=\"hl opt\">(</span> NULL <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">formattingEnabled</span> <span class=\"hl opt\">(</span> <span class=\"hl kwa\">false</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">formattingPossible</span> <span class=\"hl opt\">(</span> <span class=\"hl kwa\">false</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">validateInput</span> <span class=\"hl opt\">(</span> <span class=\"hl kwa\">false</span> <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">numberWrappedLines</span> <span class=\"hl opt\">(</span> <span class=\"hl kwa\">true</span> <span class=\"hl opt\">),</span>\t<span class=\"hl slc\">//until now, wrapped lines were always numbered, so this remains the default.</span>\n     <span class=\"hl kwd\">noTrailingNewLine</span><span class=\"hl opt\">(</span><span class=\"hl kwa\">false</span><span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">resultOfHook</span><span class=\"hl opt\">(</span><span class=\"hl kwa\">false</span><span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">keywordCase</span> <span class=\"hl opt\">(</span> StringTools<span class=\"hl opt\">::</span>CASE_UNCHANGED <span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">eolDelimiter</span> <span class=\"hl opt\">(</span><span class=\"hl str\">'</span><span class=\"hl esc\">\\n</span><span class=\"hl str\">'</span><span class=\"hl opt\">),</span>\n     <span class=\"hl kwd\">outputType</span> <span class=\"hl opt\">(</span> type <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n<span class=\"hl opt\">}</span>\n\n\nCodeGenerator<span class=\"hl opt\">::~</span><span class=\"hl kwd\">CodeGenerator</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">delete</span> formatter<span class=\"hl opt\">;</span>\n\n    <span class=\"hl kwa\">for</span> <span class=\"hl opt\">(</span> map<span class=\"hl opt\">&lt;</span>string<span class=\"hl opt\">,</span> SyntaxReader<span class=\"hl opt\">*&gt;::</span>iterator it<span class=\"hl opt\">=</span>syntaxReaders<span class=\"hl opt\">.</span><span class=\"hl kwd\">begin</span><span class=\"hl opt\">();</span> it<span class=\"hl opt\">!=</span>syntaxReaders<span class=\"hl opt\">.</span><span class=\"hl kwd\">end</span><span class=\"hl opt\">();</span> it<span class=\"hl opt\">++ ) {</span>\n        <span class=\"hl kwa\">delete</span> it<span class=\"hl opt\">-&gt;</span>second<span class=\"hl opt\">;</span>\n    <span class=\"hl opt\">}</span>\n<span class=\"hl opt\">}</span>\n\n\n<span class=\"hl kwb\">bool</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">initTheme</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">const</span> string<span class=\"hl opt\">&amp;</span> themePath <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">this</span><span class=\"hl opt\">-&gt;</span>themePath<span class=\"hl opt\">=</span>themePath<span class=\"hl opt\">;</span>\n    <span class=\"hl kwb\">bool</span> loadOK <span class=\"hl opt\">=</span> docStyle<span class=\"hl opt\">.</span><span class=\"hl kwd\">load</span> <span class=\"hl opt\">(</span> themePath<span class=\"hl opt\">,</span> outputType <span class=\"hl opt\">);</span>\n    <span class=\"hl kwd\">initOutputTags</span><span class=\"hl opt\">();</span>\n    <span class=\"hl kwa\">return</span> loadOK<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">const</span> string<span class=\"hl opt\">&amp;</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">getStyleName</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">return</span> themePath<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setLineNumberWidth</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">int</span> w <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    lineNumberWidth<span class=\"hl opt\">=</span>w<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">int</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">getLineNumberWidth</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">return</span> lineNumberWidth<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setPrintLineNumbers</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">bool</span> flag<span class=\"hl opt\">,</span> <span class=\"hl kwb\">unsigned int</span> startCnt <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    showLineNumbers<span class=\"hl opt\">=</span>flag<span class=\"hl opt\">;</span>\n    lineNumberOffset <span class=\"hl opt\">=</span> startCnt<span class=\"hl opt\">-</span><span class=\"hl num\">1</span><span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">bool</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">getPrintLineNumbers</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">return</span> showLineNumbers<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setPrintZeroes</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">bool</span> flag <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    lineNumberFillZeroes<span class=\"hl opt\">=</span>flag<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">bool</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">getPrintZeroes</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">return</span> lineNumberFillZeroes<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setIncludeStyle</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">bool</span> flag <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    includeStyleDef <span class=\"hl opt\">=</span> flag<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">disableTrailingNL</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">bool</span> flag <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    noTrailingNewLine <span class=\"hl opt\">=</span> flag<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setStyleInputPath</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">const</span> string<span class=\"hl opt\">&amp;</span> path <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    styleInputPath <span class=\"hl opt\">=</span> path<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setStyleOutputPath</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">const</span> string<span class=\"hl opt\">&amp;</span> path <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    styleOutputPath <span class=\"hl opt\">=</span> path<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setPluginReadFile</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">const</span> string<span class=\"hl opt\">&amp;</span> path <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    pluginReadFile <span class=\"hl opt\">=</span> path<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">const</span> string<span class=\"hl opt\">&amp;</span>  CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">getStyleInputPath</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">return</span> styleInputPath<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">const</span> string<span class=\"hl opt\">&amp;</span>  CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">getStyleOutputPath</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">return</span> styleOutputPath<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setFragmentCode</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">bool</span> flag <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    fragmentOutput<span class=\"hl opt\">=</span>flag<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">bool</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">getFragmentCode</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">return</span> fragmentOutput<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setValidateInput</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">bool</span> flag <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    validateInput<span class=\"hl opt\">=</span>flag<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">bool</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">getValidateInput</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">return</span> validateInput<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setNumberWrappedLines</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">bool</span> flag <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    numberWrappedLines<span class=\"hl opt\">=</span>flag<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">bool</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">getNumberWrappedLines</span><span class=\"hl opt\">() {</span>\n    <span class=\"hl kwa\">return</span> numberWrappedLines<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setBaseFont</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">const</span> string<span class=\"hl opt\">&amp;</span> s <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    baseFont <span class=\"hl opt\">=</span> s<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setBaseFontSize</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">const</span> string<span class=\"hl opt\">&amp;</span> s <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    baseFontSize <span class=\"hl opt\">=</span> s <span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setStartingNestedLang</span><span class=\"hl opt\">(</span><span class=\"hl kwb\">const</span> string <span class=\"hl opt\">&amp;</span>langName<span class=\"hl opt\">) {</span>\n    embedLangStart <span class=\"hl opt\">=</span> langName<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">const</span> string CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">getBaseFont</span><span class=\"hl opt\">()</span> <span class=\"hl kwb\">const</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">if</span> <span class=\"hl opt\">( !</span>baseFont<span class=\"hl opt\">.</span><span class=\"hl kwd\">empty</span><span class=\"hl opt\">() )</span> <span class=\"hl kwa\">return</span> baseFont<span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">switch</span> <span class=\"hl opt\">(</span> outputType <span class=\"hl opt\">)</span>\n    <span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">case</span> HTML<span class=\"hl opt\">:</span>\n    <span class=\"hl kwa\">case</span> XHTML<span class=\"hl opt\">:</span>\n        <span class=\"hl kwa\">return</span> <span class=\"hl str\">&quot;'Courier New',monospace&quot;</span><span class=\"hl opt\">;</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">case</span> LATEX<span class=\"hl opt\">:</span>\n        <span class=\"hl kwa\">return</span> <span class=\"hl str\">&quot;ttfamily&quot;</span><span class=\"hl opt\">;</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">case</span> TEX<span class=\"hl opt\">:</span>\n        <span class=\"hl kwa\">return</span> <span class=\"hl str\">&quot;tt&quot;</span><span class=\"hl opt\">;</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">case</span> ODTFLAT<span class=\"hl opt\">:</span>\n        <span class=\"hl kwa\">return</span> <span class=\"hl str\">&quot;FreeMono&quot;</span><span class=\"hl opt\">;</span>\n        <span class=\"hl kwa\">break</span><span class=\"hl opt\">;</span>\n    <span class=\"hl kwa\">default</span><span class=\"hl opt\">:</span>\n        <span class=\"hl kwa\">return</span> <span class=\"hl str\">&quot;Courier New&quot;</span><span class=\"hl opt\">;</span>\n    <span class=\"hl opt\">}</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">const</span> string CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">getBaseFontSize</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">return</span> baseFontSize<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setTitle</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">const</span> string <span class=\"hl opt\">&amp;</span> title <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">if</span> <span class=\"hl opt\">( !</span>title<span class=\"hl opt\">.</span><span class=\"hl kwd\">empty</span><span class=\"hl opt\">() )</span> docTitle<span class=\"hl opt\">=</span> title<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\nstring CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">getTitle</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">return</span> docTitle<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setEncoding</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">const</span> string<span class=\"hl opt\">&amp;</span> encodingName <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    encoding <span class=\"hl opt\">=</span> encodingName<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">bool</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">formattingDisabled</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">return</span> <span class=\"hl opt\">!</span>formattingEnabled<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setMaxInputLineCnt</span> <span class=\"hl opt\">(</span> <span class=\"hl kwb\">unsigned int</span> cnt <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    maxLineCnt <span class=\"hl opt\">=</span> cnt<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">bool</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">formattingIsPossible</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwa\">return</span> formattingPossible<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setPreformatting</span> <span class=\"hl opt\">(</span> WrapMode lineWrappingStyle<span class=\"hl opt\">,</span>\n                                       <span class=\"hl kwb\">unsigned int</span> lineLength<span class=\"hl opt\">,</span>\n                                       <span class=\"hl kwb\">int</span> numberSpaces <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    <span class=\"hl kwb\">bool</span> enableWrap <span class=\"hl opt\">=</span> lineWrappingStyle<span class=\"hl opt\">!=</span>WRAP_DISABLED<span class=\"hl opt\">;</span>\n    <span class=\"hl kwb\">bool</span> replaceTabs <span class=\"hl opt\">=</span> numberSpaces <span class=\"hl opt\">&gt;</span> <span class=\"hl num\">0</span><span class=\"hl opt\">;</span>\n\n    <span class=\"hl kwa\">if</span> <span class=\"hl opt\">(</span> enableWrap <span class=\"hl opt\">||</span> replaceTabs <span class=\"hl opt\">)</span>\n    <span class=\"hl opt\">{</span>\n        preFormatter<span class=\"hl opt\">.</span><span class=\"hl kwd\">setWrap</span> <span class=\"hl opt\">(</span> enableWrap <span class=\"hl opt\">);</span>\n        preFormatter<span class=\"hl opt\">.</span><span class=\"hl kwd\">setWrapIndentBraces</span> <span class=\"hl opt\">(</span> lineWrappingStyle<span class=\"hl opt\">==</span>WRAP_DEFAULT <span class=\"hl opt\">);</span>\n        preFormatter<span class=\"hl opt\">.</span><span class=\"hl kwd\">setWrapLineLength</span> <span class=\"hl opt\">(</span> lineLength <span class=\"hl opt\">);</span>\n        preFormatter<span class=\"hl opt\">.</span><span class=\"hl kwd\">setReplaceTabs</span> <span class=\"hl opt\">(</span> replaceTabs <span class=\"hl opt\">);</span>\n        preFormatter<span class=\"hl opt\">.</span><span class=\"hl kwd\">setNumberSpaces</span> <span class=\"hl opt\">(</span> numberSpaces <span class=\"hl opt\">);</span>\n    <span class=\"hl opt\">}</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setKeyWordCase</span> <span class=\"hl opt\">(</span> StringTools<span class=\"hl opt\">::</span>KeywordCase keyCase <span class=\"hl opt\">)</span>\n<span class=\"hl opt\">{</span>\n    keywordCase <span class=\"hl opt\">=</span> keyCase<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">setEOLDelimiter</span><span class=\"hl opt\">(</span><span class=\"hl kwb\">char</span> delim<span class=\"hl opt\">) {</span>\n    eolDelimiter <span class=\"hl opt\">=</span> delim<span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n<span class=\"hl kwb\">void</span> CodeGenerator<span class=\"hl opt\">::</span><span class=\"hl kwd\">reset</span><span class=\"hl opt\">()</span>\n<span class=\"hl opt\">{</span>\n    lineIndex <span class=\"hl opt\">=</span> <span class=\"hl num\">0</span><span class=\"hl opt\">;</span>\n    lineNumber <span class=\"hl opt\">=</span> <span class=\"hl num\">0</span><span class=\"hl opt\">;</span>\n    line<span class=\"hl opt\">.</span><span class=\"hl kwd\">clear</span><span class=\"hl opt\">();</span>\n    preFormatter<span class=\"hl opt\">.</span><span class=\"hl kwd\">reset</span><span class=\"hl opt\">();</span>\n    inFile<span class=\"hl opt\">.</span><span class=\"hl kwd\">clear</span><span class=\"hl opt\">();</span>\n    outFile<span class=\"hl opt\">.</span><span class=\"hl kwd\">clear</span><span class=\"hl opt\">();</span>\n    hostLangDefPath<span class=\"hl opt\">.</span><span class=\"hl kwd\">clear</span><span class=\"hl opt\">();</span>\n    embedLangDefPath<span class=\"hl opt\">.</span><span class=\"hl kwd\">clear</span><span class=\"hl opt\">();</span>\n    printNewLines<span class=\"hl opt\">=</span><span class=\"hl kwa\">true</span><span class=\"hl opt\">;</span>\n<span class=\"hl opt\">}</span>\n\n</pre>\n</body>\n</html>\n<!--HTML generated by highlight 3.23, http://www.andre-simon.de/-->\n"
  },
  {
    "path": "build.gradle",
    "content": "import org.apache.tools.ant.taskdefs.condition.Os\n\napply plugin: 'com.android.application'\n\ndependencies {\n    compile fileTree(dir: 'libs', include: '*.jar')\n    compile 'com.android.support:appcompat-v7:20.0+'\n}\n\nandroid {\n    compileSdkVersion 14\n    buildToolsVersion '20.0.0'\n\n    sourceSets {\n        main {\n            manifest.srcFile 'AndroidManifest.xml'\n            java.srcDirs = ['src']\n            resources.srcDirs = ['src']\n            aidl.srcDirs = ['src']\n            renderscript.srcDirs = ['src']\n            res.srcDirs = ['res']\n            assets.srcDirs = ['assets']\n            jniLibs.srcDir 'libs'\n            jni.srcDirs = []\n        }\n\n        // Move the tests to tests/java, tests/res, etc...\n        instrumentTest.setRoot('tests')\n\n        // Move the build types to build-types/<type>\n        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...\n        // This moves them out of them default location under src/<type>/... which would\n        // conflict with src/ being used by the main source set.\n        // Adding new build types or product flavors should be accompanied\n        // by a similar customization.\n        debug.setRoot('build-types/debug')\n        release.setRoot('build-types/release')\n    }\n\n    task ndkBuild(type: Exec) {\n        def Properties localProps = new Properties()\n        localProps.load(new FileInputStream(\"local.properties\"))\n        def ndk_dir = localProps['ndk.dir']\n        def ndk_build_cmd = \"$ndk_dir/ndk-build\"\n        if (Os.isFamily(Os.FAMILY_WINDOWS)) {\n            ndk_build_cmd = \"$ndk_dir/ndk-build.cmd\"\n        }\n        commandLine ndk_build_cmd, '-j', Runtime.runtime.availableProcessors(), \"NDK_OUT=$buildDir/native/obj\", \"NDK_PROJECT_PATH=.\"\n    }\n\n    tasks.withType(JavaCompile) {\n        compileTask -> compileTask.dependsOn ndkBuild\n    }\n}\n\nbuildscript {\n    repositories {\n        jcenter()\n        mavenCentral()\n    }\n\n    dependencies {\n        classpath 'com.android.tools.build:gradle:1.5+'\n    }\n\n}\n"
  },
  {
    "path": "gen/android/support/v7/appcompat/R.java",
    "content": "/* AUTO-GENERATED FILE.  DO NOT MODIFY.\n *\n * This class was automatically generated by the\n * aapt tool from the resource data it found.  It\n * should not be modified by hand.\n */\npackage android.support.v7.appcompat;\n\npublic final class R {\n\tpublic static final class anim {\n\t\tpublic static final int abc_fade_in = 0x7f040000;\n\t\tpublic static final int abc_fade_out = 0x7f040001;\n\t\tpublic static final int abc_slide_in_bottom = 0x7f040002;\n\t\tpublic static final int abc_slide_in_top = 0x7f040003;\n\t\tpublic static final int abc_slide_out_bottom = 0x7f040004;\n\t\tpublic static final int abc_slide_out_top = 0x7f040005;\n\t}\n\tpublic static final class attr {\n\t\tpublic static final int actionBarDivider = 0x7f01000f;\n\t\tpublic static final int actionBarItemBackground = 0x7f010010;\n\t\tpublic static final int actionBarSize = 0x7f01000e;\n\t\tpublic static final int actionBarSplitStyle = 0x7f01000c;\n\t\tpublic static final int actionBarStyle = 0x7f01000b;\n\t\tpublic static final int actionBarTabBarStyle = 0x7f010008;\n\t\tpublic static final int actionBarTabStyle = 0x7f010007;\n\t\tpublic static final int actionBarTabTextStyle = 0x7f010009;\n\t\tpublic static final int actionBarWidgetTheme = 0x7f01000d;\n\t\tpublic static final int actionButtonStyle = 0x7f010016;\n\t\tpublic static final int actionDropDownStyle = 0x7f010047;\n\t\tpublic static final int actionLayout = 0x7f01004e;\n\t\tpublic static final int actionMenuTextAppearance = 0x7f010011;\n\t\tpublic static final int actionMenuTextColor = 0x7f010012;\n\t\tpublic static final int actionModeBackground = 0x7f01003c;\n\t\tpublic static final int actionModeCloseButtonStyle = 0x7f01003b;\n\t\tpublic static final int actionModeCloseDrawable = 0x7f01003e;\n\t\tpublic static final int actionModeCopyDrawable = 0x7f010040;\n\t\tpublic static final int actionModeCutDrawable = 0x7f01003f;\n\t\tpublic static final int actionModeFindDrawable = 0x7f010044;\n\t\tpublic static final int actionModePasteDrawable = 0x7f010041;\n\t\tpublic static final int actionModePopupWindowStyle = 0x7f010046;\n\t\tpublic static final int actionModeSelectAllDrawable = 0x7f010042;\n\t\tpublic static final int actionModeShareDrawable = 0x7f010043;\n\t\tpublic static final int actionModeSplitBackground = 0x7f01003d;\n\t\tpublic static final int actionModeStyle = 0x7f01003a;\n\t\tpublic static final int actionModeWebSearchDrawable = 0x7f010045;\n\t\tpublic static final int actionOverflowButtonStyle = 0x7f01000a;\n\t\tpublic static final int actionProviderClass = 0x7f010050;\n\t\tpublic static final int actionViewClass = 0x7f01004f;\n\t\tpublic static final int activityChooserViewStyle = 0x7f01006c;\n\t\tpublic static final int background = 0x7f01002f;\n\t\tpublic static final int backgroundSplit = 0x7f010031;\n\t\tpublic static final int backgroundStacked = 0x7f010030;\n\t\tpublic static final int buttonBarButtonStyle = 0x7f010018;\n\t\tpublic static final int buttonBarStyle = 0x7f010017;\n\t\tpublic static final int customNavigationLayout = 0x7f010032;\n\t\tpublic static final int disableChildrenWhenDisabled = 0x7f010054;\n\t\tpublic static final int displayOptions = 0x7f010028;\n\t\tpublic static final int divider = 0x7f01002e;\n\t\tpublic static final int dividerHorizontal = 0x7f01001b;\n\t\tpublic static final int dividerPadding = 0x7f010056;\n\t\tpublic static final int dividerVertical = 0x7f01001a;\n\t\tpublic static final int dropDownListViewStyle = 0x7f010021;\n\t\tpublic static final int dropdownListPreferredItemHeight = 0x7f010048;\n\t\tpublic static final int expandActivityOverflowButtonDrawable = 0x7f01006b;\n\t\tpublic static final int height = 0x7f010026;\n\t\tpublic static final int homeAsUpIndicator = 0x7f010013;\n\t\tpublic static final int homeLayout = 0x7f010033;\n\t\tpublic static final int icon = 0x7f01002c;\n\t\tpublic static final int iconifiedByDefault = 0x7f01005a;\n\t\tpublic static final int indeterminateProgressStyle = 0x7f010035;\n\t\tpublic static final int initialActivityCount = 0x7f01006a;\n\t\tpublic static final int isLightTheme = 0x7f010059;\n\t\tpublic static final int itemPadding = 0x7f010037;\n\t\tpublic static final int listChoiceBackgroundIndicator = 0x7f01004c;\n\t\tpublic static final int listPopupWindowStyle = 0x7f010022;\n\t\tpublic static final int listPreferredItemHeight = 0x7f01001c;\n\t\tpublic static final int listPreferredItemHeightLarge = 0x7f01001e;\n\t\tpublic static final int listPreferredItemHeightSmall = 0x7f01001d;\n\t\tpublic static final int listPreferredItemPaddingLeft = 0x7f01001f;\n\t\tpublic static final int listPreferredItemPaddingRight = 0x7f010020;\n\t\tpublic static final int logo = 0x7f01002d;\n\t\tpublic static final int navigationMode = 0x7f010027;\n\t\tpublic static final int paddingEnd = 0x7f010039;\n\t\tpublic static final int paddingStart = 0x7f010038;\n\t\tpublic static final int panelMenuListTheme = 0x7f01004b;\n\t\tpublic static final int panelMenuListWidth = 0x7f01004a;\n\t\tpublic static final int popupMenuStyle = 0x7f010049;\n\t\tpublic static final int popupPromptView = 0x7f010053;\n\t\tpublic static final int progressBarPadding = 0x7f010036;\n\t\tpublic static final int progressBarStyle = 0x7f010034;\n\t\tpublic static final int prompt = 0x7f010051;\n\t\tpublic static final int queryHint = 0x7f01005b;\n\t\tpublic static final int searchDropdownBackground = 0x7f01005c;\n\t\tpublic static final int searchResultListItemHeight = 0x7f010065;\n\t\tpublic static final int searchViewAutoCompleteTextView = 0x7f010069;\n\t\tpublic static final int searchViewCloseIcon = 0x7f01005d;\n\t\tpublic static final int searchViewEditQuery = 0x7f010061;\n\t\tpublic static final int searchViewEditQueryBackground = 0x7f010062;\n\t\tpublic static final int searchViewGoIcon = 0x7f01005e;\n\t\tpublic static final int searchViewSearchIcon = 0x7f01005f;\n\t\tpublic static final int searchViewTextField = 0x7f010063;\n\t\tpublic static final int searchViewTextFieldRight = 0x7f010064;\n\t\tpublic static final int searchViewVoiceIcon = 0x7f010060;\n\t\tpublic static final int selectableItemBackground = 0x7f010019;\n\t\tpublic static final int showAsAction = 0x7f01004d;\n\t\tpublic static final int showDividers = 0x7f010055;\n\t\tpublic static final int spinnerDropDownItemStyle = 0x7f010058;\n\t\tpublic static final int spinnerMode = 0x7f010052;\n\t\tpublic static final int spinnerStyle = 0x7f010057;\n\t\tpublic static final int subtitle = 0x7f010029;\n\t\tpublic static final int subtitleTextStyle = 0x7f01002b;\n\t\tpublic static final int textAllCaps = 0x7f01006d;\n\t\tpublic static final int textAppearanceLargePopupMenu = 0x7f010014;\n\t\tpublic static final int textAppearanceListItem = 0x7f010023;\n\t\tpublic static final int textAppearanceListItemSmall = 0x7f010024;\n\t\tpublic static final int textAppearanceSearchResultSubtitle = 0x7f010067;\n\t\tpublic static final int textAppearanceSearchResultTitle = 0x7f010066;\n\t\tpublic static final int textAppearanceSmallPopupMenu = 0x7f010015;\n\t\tpublic static final int textColorSearchUrl = 0x7f010068;\n\t\tpublic static final int title = 0x7f010025;\n\t\tpublic static final int titleTextStyle = 0x7f01002a;\n\t\tpublic static final int windowActionBar = 0x7f010000;\n\t\tpublic static final int windowActionBarOverlay = 0x7f010001;\n\t\tpublic static final int windowFixedHeightMajor = 0x7f010006;\n\t\tpublic static final int windowFixedHeightMinor = 0x7f010004;\n\t\tpublic static final int windowFixedWidthMajor = 0x7f010003;\n\t\tpublic static final int windowFixedWidthMinor = 0x7f010005;\n\t\tpublic static final int windowSplitActionBar = 0x7f010002;\n\t}\n\tpublic static final class bool {\n\t\tpublic static final int abc_action_bar_embed_tabs_pre_jb = 0x7f050000;\n\t\tpublic static final int abc_action_bar_expanded_action_views_exclusive = 0x7f050001;\n\t\tpublic static final int abc_config_actionMenuItemAllCaps = 0x7f050005;\n\t\tpublic static final int abc_config_allowActionMenuItemTextWithIcon = 0x7f050004;\n\t\tpublic static final int abc_config_showMenuShortcutsWhenKeyboardPresent = 0x7f050003;\n\t\tpublic static final int abc_split_action_bar_is_narrow = 0x7f050002;\n\t}\n\tpublic static final class color {\n\t\tpublic static final int abc_search_url_text_holo = 0x7f060003;\n\t\tpublic static final int abc_search_url_text_normal = 0x7f060000;\n\t\tpublic static final int abc_search_url_text_pressed = 0x7f060002;\n\t\tpublic static final int abc_search_url_text_selected = 0x7f060001;\n\t}\n\tpublic static final class dimen {\n\t\tpublic static final int abc_action_bar_default_height = 0x7f070002;\n\t\tpublic static final int abc_action_bar_icon_vertical_padding = 0x7f070003;\n\t\tpublic static final int abc_action_bar_progress_bar_size = 0x7f07000a;\n\t\tpublic static final int abc_action_bar_stacked_max_height = 0x7f070009;\n\t\tpublic static final int abc_action_bar_stacked_tab_max_width = 0x7f070001;\n\t\tpublic static final int abc_action_bar_subtitle_bottom_margin = 0x7f070007;\n\t\tpublic static final int abc_action_bar_subtitle_text_size = 0x7f070005;\n\t\tpublic static final int abc_action_bar_subtitle_top_margin = 0x7f070006;\n\t\tpublic static final int abc_action_bar_title_text_size = 0x7f070004;\n\t\tpublic static final int abc_action_button_min_width = 0x7f070008;\n\t\tpublic static final int abc_config_prefDialogWidth = 0x7f070000;\n\t\tpublic static final int abc_dropdownitem_icon_width = 0x7f070010;\n\t\tpublic static final int abc_dropdownitem_text_padding_left = 0x7f07000e;\n\t\tpublic static final int abc_dropdownitem_text_padding_right = 0x7f07000f;\n\t\tpublic static final int abc_panel_menu_list_width = 0x7f07000b;\n\t\tpublic static final int abc_search_view_preferred_width = 0x7f07000d;\n\t\tpublic static final int abc_search_view_text_min_width = 0x7f07000c;\n\t\tpublic static final int dialog_fixed_height_major = 0x7f070013;\n\t\tpublic static final int dialog_fixed_height_minor = 0x7f070014;\n\t\tpublic static final int dialog_fixed_width_major = 0x7f070011;\n\t\tpublic static final int dialog_fixed_width_minor = 0x7f070012;\n\t}\n\tpublic static final class drawable {\n\t\tpublic static final int abc_ab_bottom_solid_dark_holo = 0x7f020000;\n\t\tpublic static final int abc_ab_bottom_solid_light_holo = 0x7f020001;\n\t\tpublic static final int abc_ab_bottom_transparent_dark_holo = 0x7f020002;\n\t\tpublic static final int abc_ab_bottom_transparent_light_holo = 0x7f020003;\n\t\tpublic static final int abc_ab_share_pack_holo_dark = 0x7f020004;\n\t\tpublic static final int abc_ab_share_pack_holo_light = 0x7f020005;\n\t\tpublic static final int abc_ab_solid_dark_holo = 0x7f020006;\n\t\tpublic static final int abc_ab_solid_light_holo = 0x7f020007;\n\t\tpublic static final int abc_ab_stacked_solid_dark_holo = 0x7f020008;\n\t\tpublic static final int abc_ab_stacked_solid_light_holo = 0x7f020009;\n\t\tpublic static final int abc_ab_stacked_transparent_dark_holo = 0x7f02000a;\n\t\tpublic static final int abc_ab_stacked_transparent_light_holo = 0x7f02000b;\n\t\tpublic static final int abc_ab_transparent_dark_holo = 0x7f02000c;\n\t\tpublic static final int abc_ab_transparent_light_holo = 0x7f02000d;\n\t\tpublic static final int abc_cab_background_bottom_holo_dark = 0x7f02000e;\n\t\tpublic static final int abc_cab_background_bottom_holo_light = 0x7f02000f;\n\t\tpublic static final int abc_cab_background_top_holo_dark = 0x7f020010;\n\t\tpublic static final int abc_cab_background_top_holo_light = 0x7f020011;\n\t\tpublic static final int abc_ic_ab_back_holo_dark = 0x7f020012;\n\t\tpublic static final int abc_ic_ab_back_holo_light = 0x7f020013;\n\t\tpublic static final int abc_ic_cab_done_holo_dark = 0x7f020014;\n\t\tpublic static final int abc_ic_cab_done_holo_light = 0x7f020015;\n\t\tpublic static final int abc_ic_clear = 0x7f020016;\n\t\tpublic static final int abc_ic_clear_disabled = 0x7f020017;\n\t\tpublic static final int abc_ic_clear_holo_light = 0x7f020018;\n\t\tpublic static final int abc_ic_clear_normal = 0x7f020019;\n\t\tpublic static final int abc_ic_clear_search_api_disabled_holo_light = 0x7f02001a;\n\t\tpublic static final int abc_ic_clear_search_api_holo_light = 0x7f02001b;\n\t\tpublic static final int abc_ic_commit_search_api_holo_dark = 0x7f02001c;\n\t\tpublic static final int abc_ic_commit_search_api_holo_light = 0x7f02001d;\n\t\tpublic static final int abc_ic_go = 0x7f02001e;\n\t\tpublic static final int abc_ic_go_search_api_holo_light = 0x7f02001f;\n\t\tpublic static final int abc_ic_menu_moreoverflow_normal_holo_dark = 0x7f020020;\n\t\tpublic static final int abc_ic_menu_moreoverflow_normal_holo_light = 0x7f020021;\n\t\tpublic static final int abc_ic_menu_share_holo_dark = 0x7f020022;\n\t\tpublic static final int abc_ic_menu_share_holo_light = 0x7f020023;\n\t\tpublic static final int abc_ic_search = 0x7f020024;\n\t\tpublic static final int abc_ic_search_api_holo_light = 0x7f020025;\n\t\tpublic static final int abc_ic_voice_search = 0x7f020026;\n\t\tpublic static final int abc_ic_voice_search_api_holo_light = 0x7f020027;\n\t\tpublic static final int abc_item_background_holo_dark = 0x7f020028;\n\t\tpublic static final int abc_item_background_holo_light = 0x7f020029;\n\t\tpublic static final int abc_list_divider_holo_dark = 0x7f02002a;\n\t\tpublic static final int abc_list_divider_holo_light = 0x7f02002b;\n\t\tpublic static final int abc_list_focused_holo = 0x7f02002c;\n\t\tpublic static final int abc_list_longpressed_holo = 0x7f02002d;\n\t\tpublic static final int abc_list_pressed_holo_dark = 0x7f02002e;\n\t\tpublic static final int abc_list_pressed_holo_light = 0x7f02002f;\n\t\tpublic static final int abc_list_selector_background_transition_holo_dark = 0x7f020030;\n\t\tpublic static final int abc_list_selector_background_transition_holo_light = 0x7f020031;\n\t\tpublic static final int abc_list_selector_disabled_holo_dark = 0x7f020032;\n\t\tpublic static final int abc_list_selector_disabled_holo_light = 0x7f020033;\n\t\tpublic static final int abc_list_selector_holo_dark = 0x7f020034;\n\t\tpublic static final int abc_list_selector_holo_light = 0x7f020035;\n\t\tpublic static final int abc_menu_dropdown_panel_holo_dark = 0x7f020036;\n\t\tpublic static final int abc_menu_dropdown_panel_holo_light = 0x7f020037;\n\t\tpublic static final int abc_menu_hardkey_panel_holo_dark = 0x7f020038;\n\t\tpublic static final int abc_menu_hardkey_panel_holo_light = 0x7f020039;\n\t\tpublic static final int abc_search_dropdown_dark = 0x7f02003a;\n\t\tpublic static final int abc_search_dropdown_light = 0x7f02003b;\n\t\tpublic static final int abc_spinner_ab_default_holo_dark = 0x7f02003c;\n\t\tpublic static final int abc_spinner_ab_default_holo_light = 0x7f02003d;\n\t\tpublic static final int abc_spinner_ab_disabled_holo_dark = 0x7f02003e;\n\t\tpublic static final int abc_spinner_ab_disabled_holo_light = 0x7f02003f;\n\t\tpublic static final int abc_spinner_ab_focused_holo_dark = 0x7f020040;\n\t\tpublic static final int abc_spinner_ab_focused_holo_light = 0x7f020041;\n\t\tpublic static final int abc_spinner_ab_holo_dark = 0x7f020042;\n\t\tpublic static final int abc_spinner_ab_holo_light = 0x7f020043;\n\t\tpublic static final int abc_spinner_ab_pressed_holo_dark = 0x7f020044;\n\t\tpublic static final int abc_spinner_ab_pressed_holo_light = 0x7f020045;\n\t\tpublic static final int abc_tab_indicator_ab_holo = 0x7f020046;\n\t\tpublic static final int abc_tab_selected_focused_holo = 0x7f020047;\n\t\tpublic static final int abc_tab_selected_holo = 0x7f020048;\n\t\tpublic static final int abc_tab_selected_pressed_holo = 0x7f020049;\n\t\tpublic static final int abc_tab_unselected_pressed_holo = 0x7f02004a;\n\t\tpublic static final int abc_textfield_search_default_holo_dark = 0x7f02004b;\n\t\tpublic static final int abc_textfield_search_default_holo_light = 0x7f02004c;\n\t\tpublic static final int abc_textfield_search_right_default_holo_dark = 0x7f02004d;\n\t\tpublic static final int abc_textfield_search_right_default_holo_light = 0x7f02004e;\n\t\tpublic static final int abc_textfield_search_right_selected_holo_dark = 0x7f02004f;\n\t\tpublic static final int abc_textfield_search_right_selected_holo_light = 0x7f020050;\n\t\tpublic static final int abc_textfield_search_selected_holo_dark = 0x7f020051;\n\t\tpublic static final int abc_textfield_search_selected_holo_light = 0x7f020052;\n\t\tpublic static final int abc_textfield_searchview_holo_dark = 0x7f020053;\n\t\tpublic static final int abc_textfield_searchview_holo_light = 0x7f020054;\n\t\tpublic static final int abc_textfield_searchview_right_holo_dark = 0x7f020055;\n\t\tpublic static final int abc_textfield_searchview_right_holo_light = 0x7f020056;\n\t}\n\tpublic static final class id {\n\t\tpublic static final int action_bar = 0x7f09001c;\n\t\tpublic static final int action_bar_activity_content = 0x7f090001;\n\t\tpublic static final int action_bar_container = 0x7f09001b;\n\t\tpublic static final int action_bar_overlay_layout = 0x7f09001f;\n\t\tpublic static final int action_bar_root = 0x7f09001a;\n\t\tpublic static final int action_bar_subtitle = 0x7f090023;\n\t\tpublic static final int action_bar_title = 0x7f090022;\n\t\tpublic static final int action_context_bar = 0x7f09001d;\n\t\tpublic static final int action_menu_divider = 0x7f090002;\n\t\tpublic static final int action_menu_presenter = 0x7f090003;\n\t\tpublic static final int action_mode_close_button = 0x7f090024;\n\t\tpublic static final int activity_chooser_view_content = 0x7f090025;\n\t\tpublic static final int always = 0x7f09000f;\n\t\tpublic static final int beginning = 0x7f090016;\n\t\tpublic static final int checkbox = 0x7f09002d;\n\t\tpublic static final int collapseActionView = 0x7f090010;\n\t\tpublic static final int default_activity_button = 0x7f090028;\n\t\tpublic static final int dialog = 0x7f090014;\n\t\tpublic static final int disableHome = 0x7f090009;\n\t\tpublic static final int dropdown = 0x7f090015;\n\t\tpublic static final int edit_query = 0x7f090030;\n\t\tpublic static final int end = 0x7f090017;\n\t\tpublic static final int expand_activities_button = 0x7f090026;\n\t\tpublic static final int expanded_menu = 0x7f09002c;\n\t\tpublic static final int home = 0x7f090000;\n\t\tpublic static final int homeAsUp = 0x7f09000a;\n\t\tpublic static final int icon = 0x7f09002a;\n\t\tpublic static final int ifRoom = 0x7f090011;\n\t\tpublic static final int image = 0x7f090027;\n\t\tpublic static final int listMode = 0x7f090006;\n\t\tpublic static final int list_item = 0x7f090029;\n\t\tpublic static final int middle = 0x7f090018;\n\t\tpublic static final int never = 0x7f090012;\n\t\tpublic static final int none = 0x7f090019;\n\t\tpublic static final int normal = 0x7f090007;\n\t\tpublic static final int progress_circular = 0x7f090004;\n\t\tpublic static final int progress_horizontal = 0x7f090005;\n\t\tpublic static final int radio = 0x7f09002f;\n\t\tpublic static final int search_badge = 0x7f090032;\n\t\tpublic static final int search_bar = 0x7f090031;\n\t\tpublic static final int search_button = 0x7f090033;\n\t\tpublic static final int search_close_btn = 0x7f090038;\n\t\tpublic static final int search_edit_frame = 0x7f090034;\n\t\tpublic static final int search_go_btn = 0x7f09003a;\n\t\tpublic static final int search_mag_icon = 0x7f090035;\n\t\tpublic static final int search_plate = 0x7f090036;\n\t\tpublic static final int search_src_text = 0x7f090037;\n\t\tpublic static final int search_voice_btn = 0x7f09003b;\n\t\tpublic static final int shortcut = 0x7f09002e;\n\t\tpublic static final int showCustom = 0x7f09000b;\n\t\tpublic static final int showHome = 0x7f09000c;\n\t\tpublic static final int showTitle = 0x7f09000d;\n\t\tpublic static final int split_action_bar = 0x7f09001e;\n\t\tpublic static final int submit_area = 0x7f090039;\n\t\tpublic static final int tabMode = 0x7f090008;\n\t\tpublic static final int title = 0x7f09002b;\n\t\tpublic static final int top_action_bar = 0x7f090020;\n\t\tpublic static final int up = 0x7f090021;\n\t\tpublic static final int useLogo = 0x7f09000e;\n\t\tpublic static final int withText = 0x7f090013;\n\t}\n\tpublic static final class integer {\n\t\tpublic static final int abc_max_action_buttons = 0x7f080000;\n\t}\n\tpublic static final class layout {\n\t\tpublic static final int abc_action_bar_decor = 0x7f030000;\n\t\tpublic static final int abc_action_bar_decor_include = 0x7f030001;\n\t\tpublic static final int abc_action_bar_decor_overlay = 0x7f030002;\n\t\tpublic static final int abc_action_bar_home = 0x7f030003;\n\t\tpublic static final int abc_action_bar_tab = 0x7f030004;\n\t\tpublic static final int abc_action_bar_tabbar = 0x7f030005;\n\t\tpublic static final int abc_action_bar_title_item = 0x7f030006;\n\t\tpublic static final int abc_action_bar_view_list_nav_layout = 0x7f030007;\n\t\tpublic static final int abc_action_menu_item_layout = 0x7f030008;\n\t\tpublic static final int abc_action_menu_layout = 0x7f030009;\n\t\tpublic static final int abc_action_mode_bar = 0x7f03000a;\n\t\tpublic static final int abc_action_mode_close_item = 0x7f03000b;\n\t\tpublic static final int abc_activity_chooser_view = 0x7f03000c;\n\t\tpublic static final int abc_activity_chooser_view_include = 0x7f03000d;\n\t\tpublic static final int abc_activity_chooser_view_list_item = 0x7f03000e;\n\t\tpublic static final int abc_expanded_menu_layout = 0x7f03000f;\n\t\tpublic static final int abc_list_menu_item_checkbox = 0x7f030010;\n\t\tpublic static final int abc_list_menu_item_icon = 0x7f030011;\n\t\tpublic static final int abc_list_menu_item_layout = 0x7f030012;\n\t\tpublic static final int abc_list_menu_item_radio = 0x7f030013;\n\t\tpublic static final int abc_popup_menu_item_layout = 0x7f030014;\n\t\tpublic static final int abc_search_dropdown_item_icons_2line = 0x7f030015;\n\t\tpublic static final int abc_search_view = 0x7f030016;\n\t\tpublic static final int abc_simple_decor = 0x7f030017;\n\t\tpublic static final int support_simple_spinner_dropdown_item = 0x7f03001a;\n\t}\n\tpublic static final class string {\n\t\tpublic static final int abc_action_bar_home_description = 0x7f0a0001;\n\t\tpublic static final int abc_action_bar_up_description = 0x7f0a0002;\n\t\tpublic static final int abc_action_menu_overflow_description = 0x7f0a0003;\n\t\tpublic static final int abc_action_mode_done = 0x7f0a0000;\n\t\tpublic static final int abc_activity_chooser_view_see_all = 0x7f0a000a;\n\t\tpublic static final int abc_activitychooserview_choose_application = 0x7f0a0009;\n\t\tpublic static final int abc_searchview_description_clear = 0x7f0a0006;\n\t\tpublic static final int abc_searchview_description_query = 0x7f0a0005;\n\t\tpublic static final int abc_searchview_description_search = 0x7f0a0004;\n\t\tpublic static final int abc_searchview_description_submit = 0x7f0a0007;\n\t\tpublic static final int abc_searchview_description_voice = 0x7f0a0008;\n\t\tpublic static final int abc_shareactionprovider_share_with = 0x7f0a000c;\n\t\tpublic static final int abc_shareactionprovider_share_with_application = 0x7f0a000b;\n\t}\n\tpublic static final class style {\n\t\tpublic static final int TextAppearance_AppCompat_Base_CompactMenu_Dialog = 0x7f0b0063;\n\t\tpublic static final int TextAppearance_AppCompat_Base_SearchResult = 0x7f0b006d;\n\t\tpublic static final int TextAppearance_AppCompat_Base_SearchResult_Subtitle = 0x7f0b006f;\n\t\tpublic static final int TextAppearance_AppCompat_Base_SearchResult_Title = 0x7f0b006e;\n\t\tpublic static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Large = 0x7f0b0069;\n\t\tpublic static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Small = 0x7f0b006a;\n\t\tpublic static final int TextAppearance_AppCompat_Light_Base_SearchResult = 0x7f0b0070;\n\t\tpublic static final int TextAppearance_AppCompat_Light_Base_SearchResult_Subtitle = 0x7f0b0072;\n\t\tpublic static final int TextAppearance_AppCompat_Light_Base_SearchResult_Title = 0x7f0b0071;\n\t\tpublic static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Large = 0x7f0b006b;\n\t\tpublic static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Small = 0x7f0b006c;\n\t\tpublic static final int TextAppearance_AppCompat_Light_SearchResult_Subtitle = 0x7f0b0035;\n\t\tpublic static final int TextAppearance_AppCompat_Light_SearchResult_Title = 0x7f0b0034;\n\t\tpublic static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Large = 0x7f0b0030;\n\t\tpublic static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Small = 0x7f0b0031;\n\t\tpublic static final int TextAppearance_AppCompat_SearchResult_Subtitle = 0x7f0b0033;\n\t\tpublic static final int TextAppearance_AppCompat_SearchResult_Title = 0x7f0b0032;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_ActionBar_Menu = 0x7f0b001a;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle = 0x7f0b0006;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse = 0x7f0b0008;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_ActionBar_Title = 0x7f0b0005;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse = 0x7f0b0007;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle = 0x7f0b001e;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle_Inverse = 0x7f0b0020;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_ActionMode_Title = 0x7f0b001d;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_ActionMode_Title_Inverse = 0x7f0b001f;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Menu = 0x7f0b0054;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle = 0x7f0b0056;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle_Inverse = 0x7f0b0058;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title = 0x7f0b0055;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title_Inverse = 0x7f0b0057;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle = 0x7f0b0051;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle_Inverse = 0x7f0b0053;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title = 0x7f0b0050;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title_Inverse = 0x7f0b0052;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_Base_DropDownItem = 0x7f0b0061;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_DropDownItem = 0x7f0b0021;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_PopupMenu_Large = 0x7f0b002e;\n\t\tpublic static final int TextAppearance_AppCompat_Widget_PopupMenu_Small = 0x7f0b002f;\n\t\tpublic static final int TextAppearance_Widget_AppCompat_Base_ExpandedMenu_Item = 0x7f0b0062;\n\t\tpublic static final int TextAppearance_Widget_AppCompat_ExpandedMenu_Item = 0x7f0b0028;\n\t\tpublic static final int Theme_AppCompat = 0x7f0b0077;\n\t\tpublic static final int Theme_AppCompat_Base_CompactMenu = 0x7f0b0083;\n\t\tpublic static final int Theme_AppCompat_Base_CompactMenu_Dialog = 0x7f0b0084;\n\t\tpublic static final int Theme_AppCompat_CompactMenu = 0x7f0b007c;\n\t\tpublic static final int Theme_AppCompat_CompactMenu_Dialog = 0x7f0b007d;\n\t\tpublic static final int Theme_AppCompat_DialogWhenLarge = 0x7f0b007a;\n\t\tpublic static final int Theme_AppCompat_Light = 0x7f0b0078;\n\t\tpublic static final int Theme_AppCompat_Light_DarkActionBar = 0x7f0b0079;\n\t\tpublic static final int Theme_AppCompat_Light_DialogWhenLarge = 0x7f0b007b;\n\t\tpublic static final int Theme_Base = 0x7f0b007e;\n\t\tpublic static final int Theme_Base_AppCompat = 0x7f0b0080;\n\t\tpublic static final int Theme_Base_AppCompat_DialogWhenLarge = 0x7f0b0085;\n\t\tpublic static final int Theme_Base_AppCompat_DialogWhenLarge_Base = 0x7f0b0089;\n\t\tpublic static final int Theme_Base_AppCompat_Dialog_FixedSize = 0x7f0b0087;\n\t\tpublic static final int Theme_Base_AppCompat_Dialog_Light_FixedSize = 0x7f0b0088;\n\t\tpublic static final int Theme_Base_AppCompat_Light = 0x7f0b0081;\n\t\tpublic static final int Theme_Base_AppCompat_Light_DarkActionBar = 0x7f0b0082;\n\t\tpublic static final int Theme_Base_AppCompat_Light_DialogWhenLarge = 0x7f0b0086;\n\t\tpublic static final int Theme_Base_AppCompat_Light_DialogWhenLarge_Base = 0x7f0b008a;\n\t\tpublic static final int Theme_Base_Light = 0x7f0b007f;\n\t\tpublic static final int Widget_AppCompat_ActionBar = 0x7f0b0000;\n\t\tpublic static final int Widget_AppCompat_ActionBar_Solid = 0x7f0b0002;\n\t\tpublic static final int Widget_AppCompat_ActionBar_TabBar = 0x7f0b0011;\n\t\tpublic static final int Widget_AppCompat_ActionBar_TabText = 0x7f0b0017;\n\t\tpublic static final int Widget_AppCompat_ActionBar_TabView = 0x7f0b0014;\n\t\tpublic static final int Widget_AppCompat_ActionButton = 0x7f0b000b;\n\t\tpublic static final int Widget_AppCompat_ActionButton_CloseMode = 0x7f0b000d;\n\t\tpublic static final int Widget_AppCompat_ActionButton_Overflow = 0x7f0b000f;\n\t\tpublic static final int Widget_AppCompat_ActionMode = 0x7f0b001b;\n\t\tpublic static final int Widget_AppCompat_ActivityChooserView = 0x7f0b0038;\n\t\tpublic static final int Widget_AppCompat_AutoCompleteTextView = 0x7f0b0036;\n\t\tpublic static final int Widget_AppCompat_Base_ActionBar = 0x7f0b003a;\n\t\tpublic static final int Widget_AppCompat_Base_ActionBar_Solid = 0x7f0b003c;\n\t\tpublic static final int Widget_AppCompat_Base_ActionBar_TabBar = 0x7f0b0045;\n\t\tpublic static final int Widget_AppCompat_Base_ActionBar_TabText = 0x7f0b004b;\n\t\tpublic static final int Widget_AppCompat_Base_ActionBar_TabView = 0x7f0b0048;\n\t\tpublic static final int Widget_AppCompat_Base_ActionButton = 0x7f0b003f;\n\t\tpublic static final int Widget_AppCompat_Base_ActionButton_CloseMode = 0x7f0b0041;\n\t\tpublic static final int Widget_AppCompat_Base_ActionButton_Overflow = 0x7f0b0043;\n\t\tpublic static final int Widget_AppCompat_Base_ActionMode = 0x7f0b004e;\n\t\tpublic static final int Widget_AppCompat_Base_ActivityChooserView = 0x7f0b0075;\n\t\tpublic static final int Widget_AppCompat_Base_AutoCompleteTextView = 0x7f0b0073;\n\t\tpublic static final int Widget_AppCompat_Base_DropDownItem_Spinner = 0x7f0b005d;\n\t\tpublic static final int Widget_AppCompat_Base_ListPopupWindow = 0x7f0b0065;\n\t\tpublic static final int Widget_AppCompat_Base_ListView_DropDown = 0x7f0b005f;\n\t\tpublic static final int Widget_AppCompat_Base_ListView_Menu = 0x7f0b0064;\n\t\tpublic static final int Widget_AppCompat_Base_PopupMenu = 0x7f0b0067;\n\t\tpublic static final int Widget_AppCompat_Base_ProgressBar = 0x7f0b005a;\n\t\tpublic static final int Widget_AppCompat_Base_ProgressBar_Horizontal = 0x7f0b0059;\n\t\tpublic static final int Widget_AppCompat_Base_Spinner = 0x7f0b005b;\n\t\tpublic static final int Widget_AppCompat_DropDownItem_Spinner = 0x7f0b0024;\n\t\tpublic static final int Widget_AppCompat_Light_ActionBar = 0x7f0b0001;\n\t\tpublic static final int Widget_AppCompat_Light_ActionBar_Solid = 0x7f0b0003;\n\t\tpublic static final int Widget_AppCompat_Light_ActionBar_Solid_Inverse = 0x7f0b0004;\n\t\tpublic static final int Widget_AppCompat_Light_ActionBar_TabBar = 0x7f0b0012;\n\t\tpublic static final int Widget_AppCompat_Light_ActionBar_TabBar_Inverse = 0x7f0b0013;\n\t\tpublic static final int Widget_AppCompat_Light_ActionBar_TabText = 0x7f0b0018;\n\t\tpublic static final int Widget_AppCompat_Light_ActionBar_TabText_Inverse = 0x7f0b0019;\n\t\tpublic static final int Widget_AppCompat_Light_ActionBar_TabView = 0x7f0b0015;\n\t\tpublic static final int Widget_AppCompat_Light_ActionBar_TabView_Inverse = 0x7f0b0016;\n\t\tpublic static final int Widget_AppCompat_Light_ActionButton = 0x7f0b000c;\n\t\tpublic static final int Widget_AppCompat_Light_ActionButton_CloseMode = 0x7f0b000e;\n\t\tpublic static final int Widget_AppCompat_Light_ActionButton_Overflow = 0x7f0b0010;\n\t\tpublic static final int Widget_AppCompat_Light_ActionMode_Inverse = 0x7f0b001c;\n\t\tpublic static final int Widget_AppCompat_Light_ActivityChooserView = 0x7f0b0039;\n\t\tpublic static final int Widget_AppCompat_Light_AutoCompleteTextView = 0x7f0b0037;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActionBar = 0x7f0b003b;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActionBar_Solid = 0x7f0b003d;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActionBar_Solid_Inverse = 0x7f0b003e;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActionBar_TabBar = 0x7f0b0046;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActionBar_TabBar_Inverse = 0x7f0b0047;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActionBar_TabText = 0x7f0b004c;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActionBar_TabText_Inverse = 0x7f0b004d;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActionBar_TabView = 0x7f0b0049;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActionBar_TabView_Inverse = 0x7f0b004a;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActionButton = 0x7f0b0040;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActionButton_CloseMode = 0x7f0b0042;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActionButton_Overflow = 0x7f0b0044;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActionMode_Inverse = 0x7f0b004f;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ActivityChooserView = 0x7f0b0076;\n\t\tpublic static final int Widget_AppCompat_Light_Base_AutoCompleteTextView = 0x7f0b0074;\n\t\tpublic static final int Widget_AppCompat_Light_Base_DropDownItem_Spinner = 0x7f0b005e;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ListPopupWindow = 0x7f0b0066;\n\t\tpublic static final int Widget_AppCompat_Light_Base_ListView_DropDown = 0x7f0b0060;\n\t\tpublic static final int Widget_AppCompat_Light_Base_PopupMenu = 0x7f0b0068;\n\t\tpublic static final int Widget_AppCompat_Light_Base_Spinner = 0x7f0b005c;\n\t\tpublic static final int Widget_AppCompat_Light_DropDownItem_Spinner = 0x7f0b0025;\n\t\tpublic static final int Widget_AppCompat_Light_ListPopupWindow = 0x7f0b002a;\n\t\tpublic static final int Widget_AppCompat_Light_ListView_DropDown = 0x7f0b0027;\n\t\tpublic static final int Widget_AppCompat_Light_PopupMenu = 0x7f0b002c;\n\t\tpublic static final int Widget_AppCompat_Light_Spinner_DropDown_ActionBar = 0x7f0b0023;\n\t\tpublic static final int Widget_AppCompat_ListPopupWindow = 0x7f0b0029;\n\t\tpublic static final int Widget_AppCompat_ListView_DropDown = 0x7f0b0026;\n\t\tpublic static final int Widget_AppCompat_ListView_Menu = 0x7f0b002d;\n\t\tpublic static final int Widget_AppCompat_PopupMenu = 0x7f0b002b;\n\t\tpublic static final int Widget_AppCompat_ProgressBar = 0x7f0b000a;\n\t\tpublic static final int Widget_AppCompat_ProgressBar_Horizontal = 0x7f0b0009;\n\t\tpublic static final int Widget_AppCompat_Spinner_DropDown_ActionBar = 0x7f0b0022;\n\t}\n\tpublic static final class styleable {\n\t\tpublic static final int[] ActionBar = { 0x7f010025, 0x7f010026, 0x7f010027, 0x7f010028, 0x7f010029, 0x7f01002a, 0x7f01002b, 0x7f01002c, 0x7f01002d, 0x7f01002e, 0x7f01002f, 0x7f010030, 0x7f010031, 0x7f010032, 0x7f010033, 0x7f010034, 0x7f010035, 0x7f010036, 0x7f010037 };\n\t\tpublic static final int[] ActionBarLayout = { 0x010100b3 };\n\t\tpublic static final int ActionBarLayout_android_layout_gravity = 0;\n\t\tpublic static final int[] ActionBarWindow = { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006 };\n\t\tpublic static final int ActionBarWindow_windowActionBar = 0;\n\t\tpublic static final int ActionBarWindow_windowActionBarOverlay = 1;\n\t\tpublic static final int ActionBarWindow_windowFixedHeightMajor = 6;\n\t\tpublic static final int ActionBarWindow_windowFixedHeightMinor = 4;\n\t\tpublic static final int ActionBarWindow_windowFixedWidthMajor = 3;\n\t\tpublic static final int ActionBarWindow_windowFixedWidthMinor = 5;\n\t\tpublic static final int ActionBarWindow_windowSplitActionBar = 2;\n\t\tpublic static final int ActionBar_background = 10;\n\t\tpublic static final int ActionBar_backgroundSplit = 12;\n\t\tpublic static final int ActionBar_backgroundStacked = 11;\n\t\tpublic static final int ActionBar_customNavigationLayout = 13;\n\t\tpublic static final int ActionBar_displayOptions = 3;\n\t\tpublic static final int ActionBar_divider = 9;\n\t\tpublic static final int ActionBar_height = 1;\n\t\tpublic static final int ActionBar_homeLayout = 14;\n\t\tpublic static final int ActionBar_icon = 7;\n\t\tpublic static final int ActionBar_indeterminateProgressStyle = 16;\n\t\tpublic static final int ActionBar_itemPadding = 18;\n\t\tpublic static final int ActionBar_logo = 8;\n\t\tpublic static final int ActionBar_navigationMode = 2;\n\t\tpublic static final int ActionBar_progressBarPadding = 17;\n\t\tpublic static final int ActionBar_progressBarStyle = 15;\n\t\tpublic static final int ActionBar_subtitle = 4;\n\t\tpublic static final int ActionBar_subtitleTextStyle = 6;\n\t\tpublic static final int ActionBar_title = 0;\n\t\tpublic static final int ActionBar_titleTextStyle = 5;\n\t\tpublic static final int[] ActionMenuItemView = { 0x0101013f };\n\t\tpublic static final int ActionMenuItemView_android_minWidth = 0;\n\t\tpublic static final int[] ActionMenuView = { };\n\t\tpublic static final int[] ActionMode = { 0x7f010026, 0x7f01002a, 0x7f01002b, 0x7f01002f, 0x7f010031 };\n\t\tpublic static final int ActionMode_background = 3;\n\t\tpublic static final int ActionMode_backgroundSplit = 4;\n\t\tpublic static final int ActionMode_height = 0;\n\t\tpublic static final int ActionMode_subtitleTextStyle = 2;\n\t\tpublic static final int ActionMode_titleTextStyle = 1;\n\t\tpublic static final int[] ActivityChooserView = { 0x7f01006a, 0x7f01006b };\n\t\tpublic static final int ActivityChooserView_expandActivityOverflowButtonDrawable = 1;\n\t\tpublic static final int ActivityChooserView_initialActivityCount = 0;\n\t\tpublic static final int[] CompatTextView = { 0x7f01006d };\n\t\tpublic static final int CompatTextView_textAllCaps = 0;\n\t\tpublic static final int[] LinearLayoutICS = { 0x7f01002e, 0x7f010055, 0x7f010056 };\n\t\tpublic static final int LinearLayoutICS_divider = 0;\n\t\tpublic static final int LinearLayoutICS_dividerPadding = 2;\n\t\tpublic static final int LinearLayoutICS_showDividers = 1;\n\t\tpublic static final int[] MenuGroup = { 0x0101000e, 0x010100d0, 0x01010194, 0x010101de, 0x010101df, 0x010101e0 };\n\t\tpublic static final int MenuGroup_android_checkableBehavior = 5;\n\t\tpublic static final int MenuGroup_android_enabled = 0;\n\t\tpublic static final int MenuGroup_android_id = 1;\n\t\tpublic static final int MenuGroup_android_menuCategory = 3;\n\t\tpublic static final int MenuGroup_android_orderInCategory = 4;\n\t\tpublic static final int MenuGroup_android_visible = 2;\n\t\tpublic static final int[] MenuItem = { 0x01010002, 0x0101000e, 0x010100d0, 0x01010106, 0x01010194, 0x010101de, 0x010101df, 0x010101e1, 0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5, 0x0101026f, 0x7f01004d, 0x7f01004e, 0x7f01004f, 0x7f010050 };\n\t\tpublic static final int MenuItem_actionLayout = 14;\n\t\tpublic static final int MenuItem_actionProviderClass = 16;\n\t\tpublic static final int MenuItem_actionViewClass = 15;\n\t\tpublic static final int MenuItem_android_alphabeticShortcut = 9;\n\t\tpublic static final int MenuItem_android_checkable = 11;\n\t\tpublic static final int MenuItem_android_checked = 3;\n\t\tpublic static final int MenuItem_android_enabled = 1;\n\t\tpublic static final int MenuItem_android_icon = 0;\n\t\tpublic static final int MenuItem_android_id = 2;\n\t\tpublic static final int MenuItem_android_menuCategory = 5;\n\t\tpublic static final int MenuItem_android_numericShortcut = 10;\n\t\tpublic static final int MenuItem_android_onClick = 12;\n\t\tpublic static final int MenuItem_android_orderInCategory = 6;\n\t\tpublic static final int MenuItem_android_title = 7;\n\t\tpublic static final int MenuItem_android_titleCondensed = 8;\n\t\tpublic static final int MenuItem_android_visible = 4;\n\t\tpublic static final int MenuItem_showAsAction = 13;\n\t\tpublic static final int[] MenuView = { 0x010100ae, 0x0101012c, 0x0101012d, 0x0101012e, 0x0101012f, 0x01010130, 0x01010131, 0x010103ea };\n\t\tpublic static final int MenuView_android_headerBackground = 4;\n\t\tpublic static final int MenuView_android_horizontalDivider = 2;\n\t\tpublic static final int MenuView_android_itemBackground = 5;\n\t\tpublic static final int MenuView_android_itemIconDisabledAlpha = 6;\n\t\tpublic static final int MenuView_android_itemTextAppearance = 1;\n\t\tpublic static final int MenuView_android_preserveIconSpacing = 7;\n\t\tpublic static final int MenuView_android_verticalDivider = 3;\n\t\tpublic static final int MenuView_android_windowAnimationStyle = 0;\n\t\tpublic static final int[] SearchView = { 0x0101011f, 0x01010220, 0x01010264, 0x7f01005a, 0x7f01005b };\n\t\tpublic static final int SearchView_android_imeOptions = 2;\n\t\tpublic static final int SearchView_android_inputType = 1;\n\t\tpublic static final int SearchView_android_maxWidth = 0;\n\t\tpublic static final int SearchView_iconifiedByDefault = 3;\n\t\tpublic static final int SearchView_queryHint = 4;\n\t\tpublic static final int[] Spinner = { 0x010100af, 0x01010175, 0x01010176, 0x01010262, 0x010102ac, 0x010102ad, 0x7f010051, 0x7f010052, 0x7f010053, 0x7f010054 };\n\t\tpublic static final int Spinner_android_dropDownHorizontalOffset = 4;\n\t\tpublic static final int Spinner_android_dropDownSelector = 1;\n\t\tpublic static final int Spinner_android_dropDownVerticalOffset = 5;\n\t\tpublic static final int Spinner_android_dropDownWidth = 3;\n\t\tpublic static final int Spinner_android_gravity = 0;\n\t\tpublic static final int Spinner_android_popupBackground = 2;\n\t\tpublic static final int Spinner_disableChildrenWhenDisabled = 9;\n\t\tpublic static final int Spinner_popupPromptView = 8;\n\t\tpublic static final int Spinner_prompt = 6;\n\t\tpublic static final int Spinner_spinnerMode = 7;\n\t\tpublic static final int[] Theme = { 0x7f010047, 0x7f010048, 0x7f010049, 0x7f01004a, 0x7f01004b, 0x7f01004c };\n\t\tpublic static final int Theme_actionDropDownStyle = 0;\n\t\tpublic static final int Theme_dropdownListPreferredItemHeight = 1;\n\t\tpublic static final int Theme_listChoiceBackgroundIndicator = 5;\n\t\tpublic static final int Theme_panelMenuListTheme = 4;\n\t\tpublic static final int Theme_panelMenuListWidth = 3;\n\t\tpublic static final int Theme_popupMenuStyle = 2;\n\t\tpublic static final int[] View = { 0x010100da, 0x7f010038, 0x7f010039 };\n\t\tpublic static final int View_android_focusable = 0;\n\t\tpublic static final int View_paddingEnd = 2;\n\t\tpublic static final int View_paddingStart = 1;\n\t}\n}\n"
  },
  {
    "path": "gen/org/evilbinary/highliter/BuildConfig.java",
    "content": "/** Automatically generated file. DO NOT MODIFY */\npackage org.evilbinary.highliter;\n\npublic final class BuildConfig {\n    public final static boolean DEBUG = true;\n}"
  },
  {
    "path": "gen/org/evilbinary/highliter/R.java",
    "content": "/* AUTO-GENERATED FILE.  DO NOT MODIFY.\n *\n * This class was automatically generated by the\n * aapt tool from the resource data it found.  It\n * should not be modified by hand.\n */\n\npackage org.evilbinary.highliter;\n\npublic final class R {\n    public static final class anim {\n        public static final int abc_fade_in=0x7f040000;\n        public static final int abc_fade_out=0x7f040001;\n        public static final int abc_slide_in_bottom=0x7f040002;\n        public static final int abc_slide_in_top=0x7f040003;\n        public static final int abc_slide_out_bottom=0x7f040004;\n        public static final int abc_slide_out_top=0x7f040005;\n    }\n    public static final class attr {\n        /**  Custom divider drawable to use for elements in the action bar. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionBarDivider=0x7f01000f;\n        /**  Custom item state list drawable background for action bar items. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionBarItemBackground=0x7f010010;\n        /**  Size of the Action Bar, including the contextual\n         bar used to present Action Modes. \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int actionBarSize=0x7f01000e;\n        /**  Reference to a theme that should be used to inflate widgets\n         and layouts destined for the action bar. Most of the time\n         this will be a reference to the current theme, but when\n         the action bar has a significantly different contrast\n         profile than the rest of the activity the difference\n         can become important. If this is set to @null the current\n         theme will be used.\n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionBarSplitStyle=0x7f01000c;\n        /**  Reference to a style for the Action Bar \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionBarStyle=0x7f01000b;\n        /** <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionBarTabBarStyle=0x7f010008;\n        /**  Default style for tabs within an action bar \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionBarTabStyle=0x7f010007;\n        /** <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionBarTabTextStyle=0x7f010009;\n        /**  Reference to a theme that should be used to inflate widgets\n         and layouts destined for the action bar. Most of the time\n         this will be a reference to the current theme, but when\n         the action bar has a significantly different contrast\n         profile than the rest of the activity the difference\n         can become important. If this is set to @null the current\n         theme will be used.\n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionBarWidgetTheme=0x7f01000d;\n        /**  Default action button style. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionButtonStyle=0x7f010016;\n        /**  Default ActionBar dropdown style. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionDropDownStyle=0x7f010047;\n        /**  An optional layout to be used as an action view.\n             See {@link android.view.MenuItem#setActionView(android.view.View)}\n             for more info. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionLayout=0x7f01004e;\n        /**  TextAppearance style that will be applied to text that\n         appears within action menu items. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionMenuTextAppearance=0x7f010011;\n        /**  Color for text that appears within action menu items. \n         <p>May be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n<p>May be a color value, in the form of \"<code>#<i>rgb</i></code>\", \"<code>#<i>argb</i></code>\",\n\"<code>#<i>rrggbb</i></code>\", or \"<code>#<i>aarrggbb</i></code>\".\n         */\n        public static final int actionMenuTextColor=0x7f010012;\n        /**  Background drawable to use for action mode UI \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionModeBackground=0x7f01003c;\n        /** <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionModeCloseButtonStyle=0x7f01003b;\n        /**  Drawable to use for the close action mode button \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionModeCloseDrawable=0x7f01003e;\n        /**  Drawable to use for the Copy action button in Contextual Action Bar \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionModeCopyDrawable=0x7f010040;\n        /**  Drawable to use for the Cut action button in Contextual Action Bar \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionModeCutDrawable=0x7f01003f;\n        /**  Drawable to use for the Find action button in WebView selection action modes \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionModeFindDrawable=0x7f010044;\n        /**  Drawable to use for the Paste action button in Contextual Action Bar \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionModePasteDrawable=0x7f010041;\n        /**  PopupWindow style to use for action modes when showing as a window overlay. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionModePopupWindowStyle=0x7f010046;\n        /**  Drawable to use for the Select all action button in Contextual Action Bar \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionModeSelectAllDrawable=0x7f010042;\n        /**  Drawable to use for the Share action button in WebView selection action modes \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionModeShareDrawable=0x7f010043;\n        /**  Background drawable to use for action mode UI in the lower split bar \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionModeSplitBackground=0x7f01003d;\n        /** <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionModeStyle=0x7f01003a;\n        /**  Drawable to use for the Web Search action button in WebView selection action modes \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionModeWebSearchDrawable=0x7f010045;\n        /** <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int actionOverflowButtonStyle=0x7f01000a;\n        /**  The name of an optional ActionProvider class to instantiate an action view\n             and perform operations such as default action for that menu item.\n             See {@link android.view.MenuItem#setActionProvider(android.view.ActionProvider)}\n             for more info. \n         <p>Must be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int actionProviderClass=0x7f010050;\n        /**  The name of an optional View class to instantiate and use as an\n             action view. See {@link android.view.MenuItem#setActionView(android.view.View)}\n             for more info. \n         <p>Must be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int actionViewClass=0x7f01004f;\n        /**  Default ActivityChooserView style. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int activityChooserViewStyle=0x7f01006c;\n        /**  Specifies a background drawable for the action bar. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int background=0x7f01002f;\n        /**  Specifies a background drawable for the bottom component of a split action bar. \n         <p>May be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n<p>May be a color value, in the form of \"<code>#<i>rgb</i></code>\", \"<code>#<i>argb</i></code>\",\n\"<code>#<i>rrggbb</i></code>\", or \"<code>#<i>aarrggbb</i></code>\".\n         */\n        public static final int backgroundSplit=0x7f010031;\n        /**  Specifies a background drawable for a second stacked row of the action bar. \n         <p>May be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n<p>May be a color value, in the form of \"<code>#<i>rgb</i></code>\", \"<code>#<i>argb</i></code>\",\n\"<code>#<i>rrggbb</i></code>\", or \"<code>#<i>aarrggbb</i></code>\".\n         */\n        public static final int backgroundStacked=0x7f010030;\n        /**  A style that may be applied to Buttons placed within a\n         LinearLayout with the style buttonBarStyle to form a button bar. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int buttonBarButtonStyle=0x7f010018;\n        /**  A style that may be applied to horizontal LinearLayouts\n         to form a button bar. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int buttonBarStyle=0x7f010017;\n        /**  Specifies a layout for custom navigation. Overrides navigationMode. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int customNavigationLayout=0x7f010032;\n        /**  Whether this spinner should mark child views as enabled/disabled when\n             the spinner itself is enabled/disabled. \n         <p>Must be a boolean value, either \"<code>true</code>\" or \"<code>false</code>\".\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int disableChildrenWhenDisabled=0x7f010054;\n        /**  Options affecting how the action bar is displayed. \n         <p>Must be one or more (separated by '|') of the following constant values.</p>\n<table>\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<tr><th>Constant</th><th>Value</th><th>Description</th></tr>\n<tr><td><code>useLogo</code></td><td>0x1</td><td></td></tr>\n<tr><td><code>showHome</code></td><td>0x2</td><td></td></tr>\n<tr><td><code>homeAsUp</code></td><td>0x4</td><td></td></tr>\n<tr><td><code>showTitle</code></td><td>0x8</td><td></td></tr>\n<tr><td><code>showCustom</code></td><td>0x10</td><td></td></tr>\n<tr><td><code>disableHome</code></td><td>0x20</td><td></td></tr>\n</table>\n         */\n        public static final int displayOptions=0x7f010028;\n        /**  Specifies the drawable used for item dividers. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int divider=0x7f01002e;\n        /**  A drawable that may be used as a horizontal divider between visual elements. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int dividerHorizontal=0x7f01001b;\n        /**  Size of padding on either end of a divider. \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int dividerPadding=0x7f010056;\n        /**  A drawable that may be used as a vertical divider between visual elements. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int dividerVertical=0x7f01001a;\n        /**  ListPopupWindow comaptibility \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int dropDownListViewStyle=0x7f010021;\n        /**  The preferred item height for dropdown lists. \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int dropdownListPreferredItemHeight=0x7f010048;\n        /**  The drawable to show in the button for expanding the activities overflow popup.\n             <strong>Note:</strong> Clients would like to set this drawable\n             as a clue about the action the chosen activity will perform. For\n             example, if share activity is to be chosen the drawable should\n             give a clue that sharing is to be performed.\n         \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int expandActivityOverflowButtonDrawable=0x7f01006b;\n        /** <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int height=0x7f010026;\n        /**  Specifies a drawable to use for the 'home as up' indicator. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int homeAsUpIndicator=0x7f010013;\n        /**  Specifies a layout to use for the \"home\" section of the action bar. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int homeLayout=0x7f010033;\n        /**  Specifies the drawable used for the application icon. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int icon=0x7f01002c;\n        /**  The default state of the SearchView. If true, it will be iconified when not in\n             use and expanded when clicked. \n         <p>Must be a boolean value, either \"<code>true</code>\" or \"<code>false</code>\".\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int iconifiedByDefault=0x7f01005a;\n        /**  Specifies a style resource to use for an indeterminate progress spinner. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int indeterminateProgressStyle=0x7f010035;\n        /**  The maximal number of items initially shown in the activity list. \n         <p>Must be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int initialActivityCount=0x7f01006a;\n        /**  Specifies whether the theme is light, otherwise it is dark. \n         <p>Must be a boolean value, either \"<code>true</code>\" or \"<code>false</code>\".\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int isLightTheme=0x7f010059;\n        /**  Specifies padding that should be applied to the left and right sides of\n             system-provided items in the bar. \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int itemPadding=0x7f010037;\n        /**  Drawable used as a background for selected list items. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int listChoiceBackgroundIndicator=0x7f01004c;\n        /** <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int listPopupWindowStyle=0x7f010022;\n        /**  The preferred list item height. \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int listPreferredItemHeight=0x7f01001c;\n        /**  A larger, more robust list item height. \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int listPreferredItemHeightLarge=0x7f01001e;\n        /**  A smaller, sleeker list item height. \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int listPreferredItemHeightSmall=0x7f01001d;\n        /**  The preferred padding along the left edge of list items. \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int listPreferredItemPaddingLeft=0x7f01001f;\n        /**  The preferred padding along the right edge of list items. \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int listPreferredItemPaddingRight=0x7f010020;\n        /**  Specifies the drawable used for the application logo. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int logo=0x7f01002d;\n        /**  The type of navigation to use. \n         <p>Must be one of the following constant values.</p>\n<table>\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<tr><th>Constant</th><th>Value</th><th>Description</th></tr>\n<tr><td><code>normal</code></td><td>0</td><td> Normal static title text </td></tr>\n<tr><td><code>listMode</code></td><td>1</td><td> The action bar will use a selection list for navigation. </td></tr>\n<tr><td><code>tabMode</code></td><td>2</td><td> The action bar will use a series of horizontal tabs for navigation. </td></tr>\n</table>\n         */\n        public static final int navigationMode=0x7f010027;\n        /**  Sets the padding, in pixels, of the end edge; see {@link android.R.attr#padding}. \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int paddingEnd=0x7f010039;\n        /**  Sets the padding, in pixels, of the start edge; see {@link android.R.attr#padding}. \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int paddingStart=0x7f010038;\n        /**  Default Panel Menu style. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int panelMenuListTheme=0x7f01004b;\n        /**  Default Panel Menu width. \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int panelMenuListWidth=0x7f01004a;\n        /**  Default PopupMenu style. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int popupMenuStyle=0x7f010049;\n        /**  Reference to a layout to use for displaying a prompt in the dropdown for\n             spinnerMode=\"dropdown\". This layout must contain a TextView with the id\n             {@code @android:id/text1} to be populated with the prompt text. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int popupPromptView=0x7f010053;\n        /**  Specifies the horizontal padding on either end for an embedded progress bar. \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int progressBarPadding=0x7f010036;\n        /**  Specifies a style resource to use for an embedded progress bar. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int progressBarStyle=0x7f010034;\n        /**  The prompt to display when the spinner's dialog is shown. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int prompt=0x7f010051;\n        /**  An optional query hint string to be displayed in the empty query field. \n         <p>Must be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int queryHint=0x7f01005b;\n        /**  SearchView dropdown background \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int searchDropdownBackground=0x7f01005c;\n        /**  The list item height for search results. @hide \n         <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int searchResultListItemHeight=0x7f010065;\n        /**  SearchView AutoCompleteTextView style \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int searchViewAutoCompleteTextView=0x7f010069;\n        /**  SearchView close button icon \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int searchViewCloseIcon=0x7f01005d;\n        /**  SearchView query refinement icon \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int searchViewEditQuery=0x7f010061;\n        /**  SearchView query refinement icon background \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int searchViewEditQueryBackground=0x7f010062;\n        /**  SearchView Go button icon \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int searchViewGoIcon=0x7f01005e;\n        /**  SearchView Search icon \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int searchViewSearchIcon=0x7f01005f;\n        /**  SearchView text field background for the left section \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int searchViewTextField=0x7f010063;\n        /**  SearchView text field background for the right section \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int searchViewTextFieldRight=0x7f010064;\n        /**  SearchView Voice button icon \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int searchViewVoiceIcon=0x7f010060;\n        /**  A style that may be applied to buttons or other selectable items\n         that should react to pressed and focus states, but that do not\n         have a clear visual border along the edges. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int selectableItemBackground=0x7f010019;\n        /**  How this item should display in the Action Bar, if present. \n         <p>Must be one or more (separated by '|') of the following constant values.</p>\n<table>\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<tr><th>Constant</th><th>Value</th><th>Description</th></tr>\n<tr><td><code>never</code></td><td>0</td><td> Never show this item in an action bar, show it in the overflow menu instead.\n                 Mutually exclusive with \"ifRoom\" and \"always\". </td></tr>\n<tr><td><code>ifRoom</code></td><td>1</td><td> Show this item in an action bar if there is room for it as determined\n                 by the system. Favor this option over \"always\" where possible.\n                 Mutually exclusive with \"never\" and \"always\". </td></tr>\n<tr><td><code>always</code></td><td>2</td><td> Always show this item in an actionbar, even if it would override\n                 the system's limits of how much stuff to put there. This may make\n                 your action bar look bad on some screens. In most cases you should\n                 use \"ifRoom\" instead. Mutually exclusive with \"ifRoom\" and \"never\". </td></tr>\n<tr><td><code>withText</code></td><td>4</td><td> When this item is shown as an action in the action bar, show a text\n                 label with it even if it has an icon representation. </td></tr>\n<tr><td><code>collapseActionView</code></td><td>8</td><td> This item's action view collapses to a normal menu\n                 item. When expanded, the action view takes over a\n                 larger segment of its container. </td></tr>\n</table>\n         */\n        public static final int showAsAction=0x7f01004d;\n        /**  Setting for which dividers to show. \n         <p>Must be one or more (separated by '|') of the following constant values.</p>\n<table>\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<tr><th>Constant</th><th>Value</th><th>Description</th></tr>\n<tr><td><code>none</code></td><td>0</td><td></td></tr>\n<tr><td><code>beginning</code></td><td>1</td><td></td></tr>\n<tr><td><code>middle</code></td><td>2</td><td></td></tr>\n<tr><td><code>end</code></td><td>4</td><td></td></tr>\n</table>\n         */\n        public static final int showDividers=0x7f010055;\n        /**  Default Spinner style. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int spinnerDropDownItemStyle=0x7f010058;\n        /**  Display mode for spinner options. \n         <p>Must be one of the following constant values.</p>\n<table>\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<tr><th>Constant</th><th>Value</th><th>Description</th></tr>\n<tr><td><code>dialog</code></td><td>0</td><td> Spinner options will be presented to the user as a dialog window. </td></tr>\n<tr><td><code>dropdown</code></td><td>1</td><td> Spinner options will be presented to the user as an inline dropdown\n                 anchored to the spinner widget itself. </td></tr>\n</table>\n         */\n        public static final int spinnerMode=0x7f010052;\n        /**  Default Spinner style. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int spinnerStyle=0x7f010057;\n        /**  Specifies subtitle text used for navigationMode=\"normal\" \n         <p>Must be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int subtitle=0x7f010029;\n        /**  Specifies a style to use for subtitle text. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int subtitleTextStyle=0x7f01002b;\n        /**  Present the text in ALL CAPS. This may use a small-caps form when available. \n         <p>May be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n<p>May be a boolean value, either \"<code>true</code>\" or \"<code>false</code>\".\n         */\n        public static final int textAllCaps=0x7f01006d;\n        /**  Text color, typeface, size, and style for the text inside of a popup menu. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int textAppearanceLargePopupMenu=0x7f010014;\n        /**  The preferred TextAppearance for the primary text of list items. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int textAppearanceListItem=0x7f010023;\n        /**  The preferred TextAppearance for the primary text of small list items. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int textAppearanceListItemSmall=0x7f010024;\n        /**  Text color, typeface, size, and style for system search result subtitle. Defaults to primary inverse text color. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int textAppearanceSearchResultSubtitle=0x7f010067;\n        /**  Text color, typeface, size, and style for system search result title. Defaults to primary inverse text color. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int textAppearanceSearchResultTitle=0x7f010066;\n        /**  Text color, typeface, size, and style for small text inside of a popup menu. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int textAppearanceSmallPopupMenu=0x7f010015;\n        /**  Text color for urls in search suggestions, used by things like global search \n         <p>May be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n<p>May be a color value, in the form of \"<code>#<i>rgb</i></code>\", \"<code>#<i>argb</i></code>\",\n\"<code>#<i>rrggbb</i></code>\", or \"<code>#<i>aarrggbb</i></code>\".\n         */\n        public static final int textColorSearchUrl=0x7f010068;\n        /** <p>Must be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int title=0x7f010025;\n        /**  Specifies a style to use for title text. \n         <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n         */\n        public static final int titleTextStyle=0x7f01002a;\n        /** <p>Must be a boolean value, either \"<code>true</code>\" or \"<code>false</code>\".\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int windowActionBar=0x7f010000;\n        /** <p>Must be a boolean value, either \"<code>true</code>\" or \"<code>false</code>\".\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int windowActionBarOverlay=0x7f010001;\n        /**  A fixed height for the window along the major axis of the screen,\n             that is, when in portrait. Can be either an absolute dimension\n             or a fraction of the screen size in that dimension. \n         <p>May be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>May be a fractional value, which is a floating point number appended with either % or %p, such as \"<code>14.5%</code>\".\nThe % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to\nsome parent container.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int windowFixedHeightMajor=0x7f010006;\n        /**  A fixed height for the window along the minor axis of the screen,\n             that is, when in landscape. Can be either an absolute dimension\n             or a fraction of the screen size in that dimension. \n         <p>May be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>May be a fractional value, which is a floating point number appended with either % or %p, such as \"<code>14.5%</code>\".\nThe % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to\nsome parent container.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int windowFixedHeightMinor=0x7f010004;\n        /**  A fixed width for the window along the major axis of the screen,\n             that is, when in landscape. Can be either an absolute dimension\n             or a fraction of the screen size in that dimension. \n         <p>May be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>May be a fractional value, which is a floating point number appended with either % or %p, such as \"<code>14.5%</code>\".\nThe % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to\nsome parent container.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int windowFixedWidthMajor=0x7f010003;\n        /**  A fixed width for the window along the minor axis of the screen,\n             that is, when in portrait. Can be either an absolute dimension\n             or a fraction of the screen size in that dimension. \n         <p>May be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>May be a fractional value, which is a floating point number appended with either % or %p, such as \"<code>14.5%</code>\".\nThe % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to\nsome parent container.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int windowFixedWidthMinor=0x7f010005;\n        /** <p>Must be a boolean value, either \"<code>true</code>\" or \"<code>false</code>\".\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n         */\n        public static final int windowSplitActionBar=0x7f010002;\n    }\n    public static final class bool {\n        public static final int abc_action_bar_embed_tabs_pre_jb=0x7f050000;\n        public static final int abc_action_bar_expanded_action_views_exclusive=0x7f050001;\n        /**  Whether action menu items should be displayed in ALLCAPS or not.\n         Defaults to true. If this is not appropriate for specific locales\n         it should be disabled in that locale's resources. \n         */\n        public static final int abc_config_actionMenuItemAllCaps=0x7f050005;\n        /**  Whether action menu items should obey the \"withText\" showAsAction\n    flag. This may be set to false for situations where space is\n    extremely limited. \n Whether action menu items should obey the \"withText\" showAsAction.\n         This may be set to false for situations where space is\n         extremely limited. \n         */\n        public static final int abc_config_allowActionMenuItemTextWithIcon=0x7f050004;\n        public static final int abc_config_showMenuShortcutsWhenKeyboardPresent=0x7f050003;\n        public static final int abc_split_action_bar_is_narrow=0x7f050002;\n    }\n    public static final class color {\n        public static final int abc_search_url_text_holo=0x7f060003;\n        public static final int abc_search_url_text_normal=0x7f060000;\n        public static final int abc_search_url_text_pressed=0x7f060002;\n        public static final int abc_search_url_text_selected=0x7f060001;\n    }\n    public static final class dimen {\n        /**  Default height of an action bar. \n Default height of an action bar. \n Default height of an action bar. \n Default height of an action bar. \n Default height of an action bar. \n         */\n        public static final int abc_action_bar_default_height=0x7f070002;\n        /**  Vertical padding around action bar icons. \n Vertical padding around action bar icons. \n Vertical padding around action bar icons. \n Vertical padding around action bar icons. \n Vertical padding around action bar icons. \n         */\n        public static final int abc_action_bar_icon_vertical_padding=0x7f070003;\n        /**  Size of the indeterminate Progress Bar \n Size of the indeterminate Progress Bar \n         */\n        public static final int abc_action_bar_progress_bar_size=0x7f07000a;\n        /**  Maximum height for a stacked tab bar as part of an action bar \n         */\n        public static final int abc_action_bar_stacked_max_height=0x7f070009;\n        /**  Maximum width for a stacked action bar tab. This prevents\n         action bar tabs from becoming too wide on a wide screen when only\n         a few are present. \n         */\n        public static final int abc_action_bar_stacked_tab_max_width=0x7f070001;\n        /**  Bottom margin for action bar subtitles \n Bottom margin for action bar subtitles \n Bottom margin for action bar subtitles \n Bottom margin for action bar subtitles \n Bottom margin for action bar subtitles \n         */\n        public static final int abc_action_bar_subtitle_bottom_margin=0x7f070007;\n        /**  Text size for action bar subtitles \n Text size for action bar subtitles \n Text size for action bar subtitles \n Text size for action bar subtitles \n Text size for action bar subtitles \n         */\n        public static final int abc_action_bar_subtitle_text_size=0x7f070005;\n        /**  Top margin for action bar subtitles \n Top margin for action bar subtitles \n Top margin for action bar subtitles \n Top margin for action bar subtitles \n Top margin for action bar subtitles \n         */\n        public static final int abc_action_bar_subtitle_top_margin=0x7f070006;\n        /**  Text size for action bar titles \n Text size for action bar titles \n Text size for action bar titles \n Text size for action bar titles \n Text size for action bar titles \n         */\n        public static final int abc_action_bar_title_text_size=0x7f070004;\n        /**  Minimum width for an action button in the menu area of an action bar \n Minimum width for an action button in the menu area of an action bar \n Minimum width for an action button in the menu area of an action bar \n         */\n        public static final int abc_action_button_min_width=0x7f070008;\n        /**  The maximum width we would prefer dialogs to be.  0 if there is no\n    maximum (let them grow as large as the screen).  Actual values are\n    specified for -large and -xlarge configurations. \n see comment in values/config.xml \n see comment in values/config.xml \n         */\n        public static final int abc_config_prefDialogWidth=0x7f070000;\n        /**  Width of the icon in a dropdown list \n         */\n        public static final int abc_dropdownitem_icon_width=0x7f070010;\n        /**  Text padding for dropdown items \n         */\n        public static final int abc_dropdownitem_text_padding_left=0x7f07000e;\n        public static final int abc_dropdownitem_text_padding_right=0x7f07000f;\n        public static final int abc_panel_menu_list_width=0x7f07000b;\n        /**  Preferred width of the search view. \n         */\n        public static final int abc_search_view_preferred_width=0x7f07000d;\n        /**  Minimum width of the search view text entry area. \n Minimum width of the search view text entry area. \n Minimum width of the search view text entry area. \n Minimum width of the search view text entry area. \n         */\n        public static final int abc_search_view_text_min_width=0x7f07000c;\n        /**  Default screen margins, per the Android Design guidelines. \n\n         Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively).\n    \n         */\n        public static final int activity_horizontal_margin=0x7f070015;\n        public static final int activity_vertical_margin=0x7f070016;\n        /**  The platform's desired fixed height for a dialog along the major axis\n         (the screen is in portrait). This may be either a fraction or a dimension.\n The platform's desired fixed height for a dialog along the major axis\n         (the screen is in portrait). This may be either a fraction or a dimension.\n The platform's desired fixed height for a dialog along the major axis\n         (the screen is in portrait). This may be either a fraction or a dimension.\n         */\n        public static final int dialog_fixed_height_major=0x7f070013;\n        /**  The platform's desired fixed height for a dialog along the minor axis\n         (the screen is in landscape). This may be either a fraction or a dimension.\n The platform's desired fixed height for a dialog along the minor axis\n         (the screen is in landscape). This may be either a fraction or a dimension.\n The platform's desired fixed height for a dialog along the minor axis\n         (the screen is in landscape). This may be either a fraction or a dimension.\n         */\n        public static final int dialog_fixed_height_minor=0x7f070014;\n        /**  The platform's desired fixed width for a dialog along the major axis\n         (the screen is in landscape). This may be either a fraction or a dimension.\n The platform's desired fixed width for a dialog along the major axis\n         (the screen is in landscape). This may be either a fraction or a dimension.\n The platform's desired fixed width for a dialog along the major axis\n         (the screen is in landscape). This may be either a fraction or a dimension.\n         */\n        public static final int dialog_fixed_width_major=0x7f070011;\n        /**  The platform's desired fixed width for a dialog along the minor axis\n         (the screen is in portrait). This may be either a fraction or a dimension.\n The platform's desired fixed width for a dialog along the minor axis\n         (the screen is in portrait). This may be either a fraction or a dimension.\n The platform's desired fixed width for a dialog along the minor axis\n         (the screen is in portrait). This may be either a fraction or a dimension.\n         */\n        public static final int dialog_fixed_width_minor=0x7f070012;\n    }\n    public static final class drawable {\n        public static final int abc_ab_bottom_solid_dark_holo=0x7f020000;\n        public static final int abc_ab_bottom_solid_light_holo=0x7f020001;\n        public static final int abc_ab_bottom_transparent_dark_holo=0x7f020002;\n        public static final int abc_ab_bottom_transparent_light_holo=0x7f020003;\n        public static final int abc_ab_share_pack_holo_dark=0x7f020004;\n        public static final int abc_ab_share_pack_holo_light=0x7f020005;\n        public static final int abc_ab_solid_dark_holo=0x7f020006;\n        public static final int abc_ab_solid_light_holo=0x7f020007;\n        public static final int abc_ab_stacked_solid_dark_holo=0x7f020008;\n        public static final int abc_ab_stacked_solid_light_holo=0x7f020009;\n        public static final int abc_ab_stacked_transparent_dark_holo=0x7f02000a;\n        public static final int abc_ab_stacked_transparent_light_holo=0x7f02000b;\n        public static final int abc_ab_transparent_dark_holo=0x7f02000c;\n        public static final int abc_ab_transparent_light_holo=0x7f02000d;\n        public static final int abc_cab_background_bottom_holo_dark=0x7f02000e;\n        public static final int abc_cab_background_bottom_holo_light=0x7f02000f;\n        public static final int abc_cab_background_top_holo_dark=0x7f020010;\n        public static final int abc_cab_background_top_holo_light=0x7f020011;\n        public static final int abc_ic_ab_back_holo_dark=0x7f020012;\n        public static final int abc_ic_ab_back_holo_light=0x7f020013;\n        public static final int abc_ic_cab_done_holo_dark=0x7f020014;\n        public static final int abc_ic_cab_done_holo_light=0x7f020015;\n        public static final int abc_ic_clear=0x7f020016;\n        public static final int abc_ic_clear_disabled=0x7f020017;\n        public static final int abc_ic_clear_holo_light=0x7f020018;\n        public static final int abc_ic_clear_normal=0x7f020019;\n        public static final int abc_ic_clear_search_api_disabled_holo_light=0x7f02001a;\n        public static final int abc_ic_clear_search_api_holo_light=0x7f02001b;\n        public static final int abc_ic_commit_search_api_holo_dark=0x7f02001c;\n        public static final int abc_ic_commit_search_api_holo_light=0x7f02001d;\n        public static final int abc_ic_go=0x7f02001e;\n        public static final int abc_ic_go_search_api_holo_light=0x7f02001f;\n        public static final int abc_ic_menu_moreoverflow_normal_holo_dark=0x7f020020;\n        public static final int abc_ic_menu_moreoverflow_normal_holo_light=0x7f020021;\n        public static final int abc_ic_menu_share_holo_dark=0x7f020022;\n        public static final int abc_ic_menu_share_holo_light=0x7f020023;\n        public static final int abc_ic_search=0x7f020024;\n        public static final int abc_ic_search_api_holo_light=0x7f020025;\n        public static final int abc_ic_voice_search=0x7f020026;\n        public static final int abc_ic_voice_search_api_holo_light=0x7f020027;\n        public static final int abc_item_background_holo_dark=0x7f020028;\n        public static final int abc_item_background_holo_light=0x7f020029;\n        public static final int abc_list_divider_holo_dark=0x7f02002a;\n        public static final int abc_list_divider_holo_light=0x7f02002b;\n        public static final int abc_list_focused_holo=0x7f02002c;\n        public static final int abc_list_longpressed_holo=0x7f02002d;\n        public static final int abc_list_pressed_holo_dark=0x7f02002e;\n        public static final int abc_list_pressed_holo_light=0x7f02002f;\n        public static final int abc_list_selector_background_transition_holo_dark=0x7f020030;\n        public static final int abc_list_selector_background_transition_holo_light=0x7f020031;\n        public static final int abc_list_selector_disabled_holo_dark=0x7f020032;\n        public static final int abc_list_selector_disabled_holo_light=0x7f020033;\n        public static final int abc_list_selector_holo_dark=0x7f020034;\n        public static final int abc_list_selector_holo_light=0x7f020035;\n        public static final int abc_menu_dropdown_panel_holo_dark=0x7f020036;\n        public static final int abc_menu_dropdown_panel_holo_light=0x7f020037;\n        public static final int abc_menu_hardkey_panel_holo_dark=0x7f020038;\n        public static final int abc_menu_hardkey_panel_holo_light=0x7f020039;\n        public static final int abc_search_dropdown_dark=0x7f02003a;\n        public static final int abc_search_dropdown_light=0x7f02003b;\n        public static final int abc_spinner_ab_default_holo_dark=0x7f02003c;\n        public static final int abc_spinner_ab_default_holo_light=0x7f02003d;\n        public static final int abc_spinner_ab_disabled_holo_dark=0x7f02003e;\n        public static final int abc_spinner_ab_disabled_holo_light=0x7f02003f;\n        public static final int abc_spinner_ab_focused_holo_dark=0x7f020040;\n        public static final int abc_spinner_ab_focused_holo_light=0x7f020041;\n        public static final int abc_spinner_ab_holo_dark=0x7f020042;\n        public static final int abc_spinner_ab_holo_light=0x7f020043;\n        public static final int abc_spinner_ab_pressed_holo_dark=0x7f020044;\n        public static final int abc_spinner_ab_pressed_holo_light=0x7f020045;\n        public static final int abc_tab_indicator_ab_holo=0x7f020046;\n        public static final int abc_tab_selected_focused_holo=0x7f020047;\n        public static final int abc_tab_selected_holo=0x7f020048;\n        public static final int abc_tab_selected_pressed_holo=0x7f020049;\n        public static final int abc_tab_unselected_pressed_holo=0x7f02004a;\n        public static final int abc_textfield_search_default_holo_dark=0x7f02004b;\n        public static final int abc_textfield_search_default_holo_light=0x7f02004c;\n        public static final int abc_textfield_search_right_default_holo_dark=0x7f02004d;\n        public static final int abc_textfield_search_right_default_holo_light=0x7f02004e;\n        public static final int abc_textfield_search_right_selected_holo_dark=0x7f02004f;\n        public static final int abc_textfield_search_right_selected_holo_light=0x7f020050;\n        public static final int abc_textfield_search_selected_holo_dark=0x7f020051;\n        public static final int abc_textfield_search_selected_holo_light=0x7f020052;\n        public static final int abc_textfield_searchview_holo_dark=0x7f020053;\n        public static final int abc_textfield_searchview_holo_light=0x7f020054;\n        public static final int abc_textfield_searchview_right_holo_dark=0x7f020055;\n        public static final int abc_textfield_searchview_right_holo_light=0x7f020056;\n        public static final int duck=0x7f020057;\n        public static final int emo_amazed=0x7f020058;\n        public static final int emo_angel=0x7f020059;\n        public static final int emo_angry=0x7f02005a;\n        public static final int emo_beaten=0x7f02005b;\n        public static final int emo_bored=0x7f02005c;\n        public static final int emo_clown=0x7f02005d;\n        public static final int emo_confused=0x7f02005e;\n        public static final int emo_cool=0x7f02005f;\n        public static final int emo_cry=0x7f020060;\n        public static final int emo_devil=0x7f020061;\n        public static final int emo_doubtful=0x7f020062;\n        public static final int emo_emo=0x7f020063;\n        public static final int emo_frozen=0x7f020064;\n        public static final int emo_grin=0x7f020065;\n        public static final int emo_indian=0x7f020066;\n        public static final int emo_karate=0x7f020067;\n        public static final int emo_kiss=0x7f020068;\n        public static final int emo_laugh=0x7f020069;\n        public static final int emo_love=0x7f02006a;\n        public static final int emo_millionaire=0x7f02006b;\n        public static final int emo_nerd=0x7f02006c;\n        public static final int emo_ninja=0x7f02006d;\n        public static final int emo_party=0x7f02006e;\n        public static final int emo_pirate=0x7f02006f;\n        public static final int emo_punk=0x7f020070;\n        public static final int emo_sad=0x7f020071;\n        public static final int emo_santa=0x7f020072;\n        public static final int emo_shy=0x7f020073;\n        public static final int emo_sick=0x7f020074;\n        public static final int emo_smile=0x7f020075;\n        public static final int emo_speechless=0x7f020076;\n        public static final int emo_sweating=0x7f020077;\n        public static final int emo_tongue=0x7f020078;\n        public static final int emo_vampire=0x7f020079;\n        public static final int emo_wacky=0x7f02007a;\n        public static final int emo_wink=0x7f02007b;\n        public static final int ic_film=0x7f02007c;\n        public static final int ic_launcher=0x7f02007d;\n        public static final int iconfont_theme=0x7f02007e;\n        public static final int iconfont_yuyan=0x7f02007f;\n        public static final int iconfont_zitibianji=0x7f020080;\n    }\n    public static final class id {\n        public static final int abap4=0x7f09004e;\n        public static final int abc=0x7f09004f;\n        public static final int abnf=0x7f090050;\n        public static final int aboutTextView3=0x7f090045;\n        public static final int aboutTextView5=0x7f090046;\n        public static final int acid=0x7f09010e;\n        public static final int action_about=0x7f090162;\n        public static final int action_bar=0x7f09001c;\n        public static final int action_bar_activity_content=0x7f090001;\n        public static final int action_bar_container=0x7f09001b;\n        public static final int action_bar_overlay_layout=0x7f09001f;\n        public static final int action_bar_root=0x7f09001a;\n        public static final int action_bar_subtitle=0x7f090023;\n        public static final int action_bar_title=0x7f090022;\n        public static final int action_context_bar=0x7f09001d;\n        public static final int action_lang=0x7f09004a;\n        public static final int action_menu_divider=0x7f090002;\n        public static final int action_menu_presenter=0x7f090003;\n        public static final int action_mode_close_button=0x7f090024;\n        public static final int action_settings=0x7f090049;\n        public static final int action_theme=0x7f090109;\n        public static final int actionscript=0x7f090051;\n        public static final int activity_chooser_view_content=0x7f090025;\n        public static final int ada=0x7f090052;\n        public static final int agda=0x7f090053;\n        public static final int aiseered=0x7f09010f;\n        public static final int algol=0x7f090054;\n        public static final int always=0x7f09000f;\n        public static final int ampl=0x7f090055;\n        public static final int amtrix=0x7f090056;\n        public static final int andes=0x7f090110;\n        public static final int anotherdark=0x7f090111;\n        public static final int applescript=0x7f090057;\n        public static final int arc=0x7f090058;\n        public static final int arm=0x7f090059;\n        public static final int as400cl=0x7f09005a;\n        public static final int ascend=0x7f09005b;\n        public static final int asp=0x7f09005c;\n        public static final int aspect=0x7f09005d;\n        public static final int assembler=0x7f09005e;\n        public static final int ats=0x7f09005f;\n        public static final int autohotkey=0x7f090060;\n        public static final int autoit=0x7f090061;\n        public static final int autumn=0x7f090112;\n        public static final int avenue=0x7f090062;\n        public static final int awk=0x7f090063;\n        public static final int bat=0x7f090064;\n        public static final int baycomb=0x7f090113;\n        public static final int bbcode=0x7f090065;\n        public static final int bclear=0x7f090114;\n        public static final int bcpl=0x7f090066;\n        public static final int beginning=0x7f090016;\n        public static final int bibtex=0x7f090067;\n        public static final int biferno=0x7f090068;\n        public static final int biogoo=0x7f090115;\n        public static final int bipolar=0x7f090116;\n        public static final int bison=0x7f090069;\n        public static final int blacknblue=0x7f090117;\n        public static final int blitzbasic=0x7f09006a;\n        public static final int bluegreen=0x7f090118;\n        public static final int bms=0x7f09006b;\n        public static final int bnf=0x7f09006c;\n        public static final int boo=0x7f09006d;\n        public static final int breeze=0x7f090119;\n        public static final int bright=0x7f09011a;\n        public static final int c=0x7f09004b;\n        public static final int camo=0x7f09011b;\n        public static final int candy=0x7f09011c;\n        public static final int ceylon=0x7f09006e;\n        public static final int charmm=0x7f09006f;\n        public static final int checkbox=0x7f09002d;\n        public static final int chill=0x7f090070;\n        public static final int clarity=0x7f09011d;\n        public static final int clean=0x7f090071;\n        public static final int clearbasic=0x7f090072;\n        public static final int clipper=0x7f090073;\n        public static final int clojure=0x7f090074;\n        public static final int clp=0x7f090075;\n        public static final int cobol=0x7f090076;\n        public static final int coldfusion=0x7f090077;\n        public static final int collapseActionView=0x7f090010;\n        public static final int conf=0x7f090078;\n        public static final int crk=0x7f090079;\n        public static final int csharp=0x7f09007a;\n        public static final int css=0x7f09007b;\n        public static final int d=0x7f09007c;\n        public static final int dante=0x7f09011e;\n        public static final int darkblue=0x7f09011f;\n        public static final int darkbone=0x7f090120;\n        public static final int darkness=0x7f090121;\n        public static final int darkslategray=0x7f090122;\n        public static final int darkspectrum=0x7f090123;\n        public static final int dart=0x7f09007d;\n        public static final int default_activity_button=0x7f090028;\n        public static final int denim=0x7f090124;\n        public static final int dialog=0x7f090014;\n        public static final int diff=0x7f09007e;\n        public static final int disableHome=0x7f090009;\n        public static final int dropdown=0x7f090015;\n        public static final int dusk=0x7f090125;\n        public static final int dylan=0x7f09007f;\n        public static final int earendel=0x7f090126;\n        public static final int easter=0x7f090127;\n        public static final int ebnf=0x7f090080;\n        public static final int edit_anjuta=0x7f090128;\n        public static final int edit_eclipse=0x7f090129;\n        public static final int edit_emacs=0x7f09012a;\n        public static final int edit_flashdevelop=0x7f09012b;\n        public static final int edit_gedit=0x7f09012c;\n        public static final int edit_jedit=0x7f09012d;\n        public static final int edit_kwrite=0x7f09012e;\n        public static final int edit_matlab=0x7f09012f;\n        public static final int edit_msvs2008=0x7f090130;\n        public static final int edit_nedit=0x7f090131;\n        public static final int edit_query=0x7f090030;\n        public static final int edit_vim=0x7f090133;\n        public static final int edit_vim_dark=0x7f090132;\n        public static final int edit_xcode=0x7f090134;\n        public static final int eiffel=0x7f090081;\n        public static final int ekvoli=0x7f090135;\n        public static final int end=0x7f090017;\n        public static final int erlang=0x7f090082;\n        public static final int euphoria=0x7f090083;\n        public static final int expand_activities_button=0x7f090026;\n        public static final int expanded_menu=0x7f09002c;\n        public static final int express=0x7f090084;\n        public static final int fame=0x7f090085;\n        public static final int felix=0x7f090086;\n        public static final int field_app_name=0x7f09003f;\n        public static final int field_version=0x7f090040;\n        public static final int fine_blue=0x7f09010b;\n        public static final int font10=0x7f09015d;\n        public static final int font12=0x7f09015e;\n        public static final int font14=0x7f09015f;\n        public static final int font16=0x7f090160;\n        public static final int font18=0x7f090161;\n        public static final int font_default=0x7f09015c;\n        public static final int fortran77=0x7f090087;\n        public static final int fortran90=0x7f090088;\n        public static final int freya=0x7f090136;\n        public static final int frink=0x7f090089;\n        public static final int fruit=0x7f090137;\n        public static final int fsharp=0x7f09008a;\n        public static final int fx=0x7f09008b;\n        public static final int gambas=0x7f09008c;\n        public static final int gdb=0x7f09008d;\n        public static final int go=0x7f09008e;\n        public static final int golden=0x7f090138;\n        public static final int graphviz=0x7f09008f;\n        public static final int greenlcd=0x7f090139;\n        public static final int haskell=0x7f090090;\n        public static final int haxe=0x7f090091;\n        public static final int hcl=0x7f090092;\n        public static final int home=0x7f090000;\n        public static final int homeAsUp=0x7f09000a;\n        public static final int html=0x7f090093;\n        public static final int httpd=0x7f090094;\n        public static final int icon=0x7f09002a;\n        public static final int idl=0x7f090095;\n        public static final int idlang=0x7f090096;\n        public static final int ifRoom=0x7f090011;\n        public static final int image=0x7f090027;\n        public static final int imageView1=0x7f09003d;\n        public static final int inc_luatex=0x7f090097;\n        public static final int informix=0x7f090098;\n        public static final int ini=0x7f090099;\n        public static final int innosetup=0x7f09009a;\n        public static final int interlis=0x7f09009b;\n        public static final int io=0x7f09009c;\n        public static final int jasmin=0x7f09009d;\n        public static final int java=0x7f09009e;\n        public static final int js=0x7f09009f;\n        public static final int jsp=0x7f0900a0;\n        public static final int kellys=0x7f09013a;\n        public static final int ldif=0x7f0900a1;\n        public static final int leo=0x7f09013b;\n        public static final int less=0x7f0900a2;\n        public static final int lhs=0x7f0900a3;\n        public static final int lilypond=0x7f0900a4;\n        public static final int limbo=0x7f0900a5;\n        public static final int lindenscript=0x7f0900a6;\n        public static final int linearLayout1=0x7f09003c;\n        public static final int linearLayout2=0x7f09003e;\n        public static final int linearLayout3=0x7f090041;\n        public static final int lisp=0x7f09004c;\n        public static final int listMode=0x7f090006;\n        public static final int list_item=0x7f090029;\n        public static final int logtalk=0x7f0900a7;\n        public static final int lotos=0x7f0900a8;\n        public static final int lotus=0x7f0900a9;\n        public static final int lua=0x7f0900aa;\n        public static final int luban=0x7f0900ab;\n        public static final int lucretia=0x7f09013c;\n        public static final int make=0x7f0900ac;\n        public static final int manxome=0x7f09013d;\n        public static final int maple=0x7f0900ad;\n        public static final int maroloccio=0x7f09013e;\n        public static final int matlab=0x7f0900ae;\n        public static final int matrix=0x7f09013f;\n        public static final int maya=0x7f0900af;\n        public static final int mercury=0x7f0900b0;\n        public static final int middle=0x7f090018;\n        public static final int miranda=0x7f0900b1;\n        public static final int mod2=0x7f0900b2;\n        public static final int mod3=0x7f0900b3;\n        public static final int modelica=0x7f0900b4;\n        public static final int moe=0x7f090140;\n        public static final int molokai=0x7f09010a;\n        public static final int moon=0x7f0900b5;\n        public static final int moria=0x7f090141;\n        public static final int ms=0x7f0900b6;\n        public static final int mssql=0x7f0900b7;\n        public static final int mxml=0x7f0900b8;\n        public static final int n3=0x7f0900b9;\n        public static final int nasal=0x7f0900ba;\n        public static final int navajo_night=0x7f090142;\n        public static final int navy=0x7f090143;\n        public static final int nbc=0x7f0900bb;\n        public static final int nemerle=0x7f0900bc;\n        public static final int neon=0x7f090144;\n        public static final int netrexx=0x7f0900bd;\n        public static final int never=0x7f090012;\n        public static final int nice=0x7f0900be;\n        public static final int night=0x7f090145;\n        public static final int nightshimmer=0x7f090146;\n        public static final int none=0x7f090019;\n        public static final int normal=0x7f090007;\n        public static final int nsis=0x7f0900bf;\n        public static final int nuvola=0x7f090147;\n        public static final int nxc=0x7f0900c0;\n        public static final int oberon=0x7f0900c1;\n        public static final int objc=0x7f0900c2;\n        public static final int ocaml=0x7f0900c3;\n        public static final int octave=0x7f0900c4;\n        public static final int olive=0x7f090148;\n        public static final int oorexx=0x7f0900c5;\n        public static final int orion=0x7f090149;\n        public static final int os=0x7f0900c6;\n        public static final int oxygenated=0x7f09014a;\n        public static final int oz=0x7f0900c7;\n        public static final int pablo=0x7f09014b;\n        public static final int paradox=0x7f0900c8;\n        public static final int pas=0x7f0900c9;\n        public static final int pdf=0x7f0900ca;\n        public static final int peaksea=0x7f09014c;\n        public static final int perl=0x7f0900cb;\n        public static final int php=0x7f0900cc;\n        public static final int pike=0x7f0900cd;\n        public static final int pl1=0x7f0900ce;\n        public static final int plperl=0x7f0900cf;\n        public static final int plpython=0x7f0900d0;\n        public static final int pltcl=0x7f0900d1;\n        public static final int pov=0x7f0900d2;\n        public static final int print=0x7f09014d;\n        public static final int pro=0x7f0900d3;\n        public static final int progress=0x7f0900d4;\n        public static final int progress_circular=0x7f090004;\n        public static final int progress_horizontal=0x7f090005;\n        public static final int ps=0x7f0900d5;\n        public static final int ps1=0x7f0900d6;\n        public static final int psl=0x7f0900d7;\n        public static final int pure=0x7f0900d8;\n        public static final int pyrex=0x7f0900d9;\n        public static final int python=0x7f09004d;\n        public static final int q=0x7f0900da;\n        public static final int qmake=0x7f0900db;\n        public static final int qml=0x7f0900dc;\n        public static final int qu=0x7f0900dd;\n        public static final int r=0x7f0900de;\n        public static final int radio=0x7f09002f;\n        public static final int rand01=0x7f09014e;\n        public static final int rdark=0x7f09014f;\n        public static final int rebol=0x7f0900df;\n        public static final int relaxedgreen=0x7f090150;\n        public static final int rexx=0x7f0900e0;\n        public static final int rnc=0x7f0900e1;\n        public static final int rootwater=0x7f090151;\n        public static final int rpg=0x7f0900e2;\n        public static final int rpl=0x7f0900e3;\n        public static final int rs=0x7f0900e4;\n        public static final int ruby=0x7f0900e5;\n        public static final int s=0x7f0900e6;\n        public static final int sas=0x7f0900e7;\n        public static final int scala=0x7f0900e8;\n        public static final int scilab=0x7f0900e9;\n        public static final int scss=0x7f0900ea;\n        public static final int search_badge=0x7f090032;\n        public static final int search_bar=0x7f090031;\n        public static final int search_button=0x7f090033;\n        public static final int search_close_btn=0x7f090038;\n        public static final int search_edit_frame=0x7f090034;\n        public static final int search_go_btn=0x7f09003a;\n        public static final int search_mag_icon=0x7f090035;\n        public static final int search_plate=0x7f090036;\n        public static final int search_src_text=0x7f090037;\n        public static final int search_voice_btn=0x7f09003b;\n        public static final int seashell=0x7f090152;\n        public static final int sh=0x7f0900eb;\n        public static final int shortcut=0x7f09002e;\n        public static final int showCustom=0x7f09000b;\n        public static final int showHome=0x7f09000c;\n        public static final int showTitle=0x7f09000d;\n        public static final int small=0x7f0900ec;\n        public static final int smalltalk=0x7f0900ed;\n        public static final int sml=0x7f0900ee;\n        public static final int snmp=0x7f0900ef;\n        public static final int snobol=0x7f0900f0;\n        public static final int solarized_dark=0x7f090153;\n        public static final int solarized_light=0x7f09010d;\n        public static final int spec=0x7f0900f1;\n        public static final int split_action_bar=0x7f09001e;\n        public static final int spn=0x7f0900f2;\n        public static final int sql=0x7f0900f3;\n        public static final int squirrel=0x7f0900f4;\n        public static final int styl=0x7f0900f5;\n        public static final int submit_area=0x7f090039;\n        public static final int swift=0x7f0900f6;\n        public static final int sybase=0x7f0900f7;\n        public static final int tabMode=0x7f090008;\n        public static final int tabula=0x7f090154;\n        public static final int tcl=0x7f0900f8;\n        public static final int tcsh=0x7f0900f9;\n        public static final int tcsoft=0x7f090155;\n        public static final int tex=0x7f0900fa;\n        public static final int textView1=0x7f090042;\n        public static final int textView2=0x7f090043;\n        public static final int textView3=0x7f090044;\n        public static final int textView5=0x7f090047;\n        public static final int textView6=0x7f090048;\n        public static final int the=0x7f090156;\n        public static final int title=0x7f09002b;\n        public static final int top_action_bar=0x7f090020;\n        public static final int ts=0x7f0900fb;\n        public static final int tsql=0x7f0900fc;\n        public static final int ttcn3=0x7f0900fd;\n        public static final int txt=0x7f0900fe;\n        public static final int up=0x7f090021;\n        public static final int upc=0x7f0900ff;\n        public static final int useLogo=0x7f09000e;\n        public static final int vala=0x7f090100;\n        public static final int vampire=0x7f09010c;\n        public static final int vb=0x7f090101;\n        public static final int verilog=0x7f090102;\n        public static final int vhd=0x7f090103;\n        public static final int whitengrey=0x7f090157;\n        public static final int withText=0x7f090013;\n        public static final int xml=0x7f090104;\n        public static final int xoria256=0x7f090158;\n        public static final int xpp=0x7f090105;\n        public static final int yaiff=0x7f090106;\n        public static final int yang=0x7f090107;\n        public static final int zellner=0x7f090159;\n        public static final int zenburn=0x7f09015a;\n        public static final int zmrok=0x7f09015b;\n        public static final int znn=0x7f090108;\n    }\n    public static final class integer {\n        /**  The maximum number of action buttons that should be permitted within\n         an action bar/action mode. This will be used to determine how many\n         showAsAction=\"ifRoom\" items can fit. \"always\" items can override this. \n The maximum number of action buttons that should be permitted within\n     an action bar/action mode. This will be used to determine how many\n     showAsAction=\"ifRoom\" items can fit. \"always\" items can override this. \n The maximum number of action buttons that should be permitted within\n         an action bar/action mode. This will be used to determine how many\n         showAsAction=\"ifRoom\" items can fit. \"always\" items can override this. \n The maximum number of action buttons that should be permitted within\n         an action bar/action mode. This will be used to determine how many\n         showAsAction=\"ifRoom\" items can fit. \"always\" items can override this. \n The maximum number of action buttons that should be permitted within\n         an action bar/action mode. This will be used to determine how many\n         showAsAction=\"ifRoom\" items can fit. \"always\" items can override this. \n The maximum number of action buttons that should be permitted within\n         an action bar/action mode. This will be used to determine how many\n         showAsAction=\"ifRoom\" items can fit. \"always\" items can override this. \n The maximum number of action buttons that should be permitted within\n         an action bar/action mode. This will be used to determine how many\n         showAsAction=\"ifRoom\" items can fit. \"always\" items can override this. \n         */\n        public static final int abc_max_action_buttons=0x7f080000;\n    }\n    public static final class layout {\n        public static final int abc_action_bar_decor=0x7f030000;\n        public static final int abc_action_bar_decor_include=0x7f030001;\n        public static final int abc_action_bar_decor_overlay=0x7f030002;\n        public static final int abc_action_bar_home=0x7f030003;\n        public static final int abc_action_bar_tab=0x7f030004;\n        public static final int abc_action_bar_tabbar=0x7f030005;\n        public static final int abc_action_bar_title_item=0x7f030006;\n        public static final int abc_action_bar_view_list_nav_layout=0x7f030007;\n        public static final int abc_action_menu_item_layout=0x7f030008;\n        public static final int abc_action_menu_layout=0x7f030009;\n        public static final int abc_action_mode_bar=0x7f03000a;\n        public static final int abc_action_mode_close_item=0x7f03000b;\n        public static final int abc_activity_chooser_view=0x7f03000c;\n        public static final int abc_activity_chooser_view_include=0x7f03000d;\n        public static final int abc_activity_chooser_view_list_item=0x7f03000e;\n        public static final int abc_expanded_menu_layout=0x7f03000f;\n        public static final int abc_list_menu_item_checkbox=0x7f030010;\n        public static final int abc_list_menu_item_icon=0x7f030011;\n        public static final int abc_list_menu_item_layout=0x7f030012;\n        public static final int abc_list_menu_item_radio=0x7f030013;\n        public static final int abc_popup_menu_item_layout=0x7f030014;\n        public static final int abc_search_dropdown_item_icons_2line=0x7f030015;\n        public static final int abc_search_view=0x7f030016;\n        public static final int abc_simple_decor=0x7f030017;\n        public static final int about=0x7f030018;\n        public static final int activity_main=0x7f030019;\n        public static final int support_simple_spinner_dropdown_item=0x7f03001a;\n    }\n    public static final class menu {\n        public static final int main=0x7f0c0000;\n        public static final int mymenu=0x7f0c0001;\n    }\n    public static final class string {\n        /**  Content description for the action bar \"home\" affordance. [CHAR LIMIT=NONE] \n         */\n        public static final int abc_action_bar_home_description=0x7f0a0001;\n        /**  Content description for the action bar \"up\" affordance. [CHAR LIMIT=NONE] \n         */\n        public static final int abc_action_bar_up_description=0x7f0a0002;\n        /**  Content description for the action menu overflow button. [CHAR LIMIT=NONE] \n         */\n        public static final int abc_action_menu_overflow_description=0x7f0a0003;\n        /**  Label for the \"Done\" button on the far left of action mode toolbars. \n         */\n        public static final int abc_action_mode_done=0x7f0a0000;\n        /**  Title for a button to expand the list of activities in ActivityChooserView [CHAR LIMIT=25] \n         */\n        public static final int abc_activity_chooser_view_see_all=0x7f0a000a;\n        /**  ActivityChooserView - accessibility support \n Description of the shwoing of a popup window with activities to choose from. [CHAR LIMIT=NONE] \n         */\n        public static final int abc_activitychooserview_choose_application=0x7f0a0009;\n        /**  SearchView accessibility description for clear button [CHAR LIMIT=NONE] \n         */\n        public static final int abc_searchview_description_clear=0x7f0a0006;\n        /**  SearchView accessibility description for search text field [CHAR LIMIT=NONE] \n         */\n        public static final int abc_searchview_description_query=0x7f0a0005;\n        /**  SearchView accessibility description for search button [CHAR LIMIT=NONE] \n         */\n        public static final int abc_searchview_description_search=0x7f0a0004;\n        /**  SearchView accessibility description for submit button [CHAR LIMIT=NONE] \n         */\n        public static final int abc_searchview_description_submit=0x7f0a0007;\n        /**  SearchView accessibility description for voice button [CHAR LIMIT=NONE] \n         */\n        public static final int abc_searchview_description_voice=0x7f0a0008;\n        /**  Description of the choose target button in a ShareActionProvider (share UI). [CHAR LIMIT=NONE] \n         */\n        public static final int abc_shareactionprovider_share_with=0x7f0a000c;\n        /**  Description of a share target (both in the list of such or the default share button) in a ShareActionProvider (share UI). [CHAR LIMIT=NONE] \n         */\n        public static final int abc_shareactionprovider_share_with_application=0x7f0a000b;\n        public static final int about=0x7f0a001a;\n        public static final int action_settings=0x7f0a000f;\n        public static final int app_name=0x7f0a000d;\n        public static final int extract=0x7f0a0010;\n        public static final int extract_error=0x7f0a0012;\n        public static final int extract_finish=0x7f0a0011;\n        public static final int field_license=0x7f0a0019;\n        public static final int hello_world=0x7f0a000e;\n        public static final int label_author=0x7f0a0014;\n        public static final int label_email=0x7f0a0015;\n        public static final int label_homepage=0x7f0a0016;\n        public static final int label_license=0x7f0a0017;\n        public static final int label_qq_group=0x7f0a0018;\n        public static final int label_version=0x7f0a0013;\n        public static final int myemail=0x7f0a001d;\n        public static final int myhomepage=0x7f0a001e;\n        public static final int myname=0x7f0a001b;\n        public static final int qq_group=0x7f0a001c;\n    }\n    public static final class style {\n        /** \n        Base application theme, dependent on API level. This theme is replaced\n        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.\n    \n\n            Theme customizations available in newer API levels can go in\n            res/values-vXX/styles.xml, while customizations related to\n            backward-compatibility can go here.\n        \n\n        Base application theme for API 11+. This theme completely replaces\n        AppBaseTheme from res/values/styles.xml on API 11+ devices.\n    \n API 11 theme customizations can go here. \n\n        Base application theme for API 14+. This theme completely replaces\n        AppBaseTheme from BOTH res/values/styles.xml and\n        res/values-v11/styles.xml on API 14+ devices.\n    \n API 14 theme customizations can go here. \n         */\n        public static final int AppBaseTheme=0x7f0b008b;\n        /**  Application theme. \n All customizations that are NOT specific to a particular API-level can go here. \n         */\n        public static final int AppTheme=0x7f0b008c;\n        /**  Mimic text appearance in select_dialog_item.xml \n         */\n        public static final int TextAppearance_AppCompat_Base_CompactMenu_Dialog=0x7f0b0063;\n        public static final int TextAppearance_AppCompat_Base_SearchResult=0x7f0b006d;\n        public static final int TextAppearance_AppCompat_Base_SearchResult_Subtitle=0x7f0b006f;\n        /**  Search View result styles \n         */\n        public static final int TextAppearance_AppCompat_Base_SearchResult_Title=0x7f0b006e;\n        public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Large=0x7f0b0069;\n        public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Small=0x7f0b006a;\n        public static final int TextAppearance_AppCompat_Light_Base_SearchResult=0x7f0b0070;\n        public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Subtitle=0x7f0b0072;\n        /** \n        TextAppearance.Holo.Light.SearchResult.* are private so we extend from the default\n        versions instead (which are exactly the same).\n    \n         */\n        public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Title=0x7f0b0071;\n        public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Large=0x7f0b006b;\n        public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Small=0x7f0b006c;\n        public static final int TextAppearance_AppCompat_Light_SearchResult_Subtitle=0x7f0b0035;\n        public static final int TextAppearance_AppCompat_Light_SearchResult_Title=0x7f0b0034;\n        public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Large=0x7f0b0030;\n        public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Small=0x7f0b0031;\n        public static final int TextAppearance_AppCompat_SearchResult_Subtitle=0x7f0b0033;\n        public static final int TextAppearance_AppCompat_SearchResult_Title=0x7f0b0032;\n        public static final int TextAppearance_AppCompat_Widget_ActionBar_Menu=0x7f0b001a;\n        public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle=0x7f0b0006;\n        public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse=0x7f0b0008;\n        public static final int TextAppearance_AppCompat_Widget_ActionBar_Title=0x7f0b0005;\n        public static final int TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse=0x7f0b0007;\n        public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle=0x7f0b001e;\n        public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle_Inverse=0x7f0b0020;\n        public static final int TextAppearance_AppCompat_Widget_ActionMode_Title=0x7f0b001d;\n        public static final int TextAppearance_AppCompat_Widget_ActionMode_Title_Inverse=0x7f0b001f;\n        public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Menu=0x7f0b0054;\n        public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle=0x7f0b0056;\n        public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle_Inverse=0x7f0b0058;\n        public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title=0x7f0b0055;\n        public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title_Inverse=0x7f0b0057;\n        public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle=0x7f0b0051;\n        public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle_Inverse=0x7f0b0053;\n        public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title=0x7f0b0050;\n        public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title_Inverse=0x7f0b0052;\n        public static final int TextAppearance_AppCompat_Widget_Base_DropDownItem=0x7f0b0061;\n        public static final int TextAppearance_AppCompat_Widget_DropDownItem=0x7f0b0021;\n        public static final int TextAppearance_AppCompat_Widget_PopupMenu_Large=0x7f0b002e;\n        public static final int TextAppearance_AppCompat_Widget_PopupMenu_Small=0x7f0b002f;\n        public static final int TextAppearance_Widget_AppCompat_Base_ExpandedMenu_Item=0x7f0b0062;\n        public static final int TextAppearance_Widget_AppCompat_ExpandedMenu_Item=0x7f0b0028;\n        /**  Themes in the \"Theme.AppCompat\" family will contain an action bar by default.\n         If Holo themes are available on the current platform version they will be used.\n         A limited Holo-styled action bar will be provided on platform versions older\n         than 3.0. (API 11)\n\n         These theme declarations contain any version-independent specification. Items\n         that need to vary based on platform version should be defined in the corresponding\n         \"Theme.Base\" theme. \n Platform-independent theme providing an action bar in a dark-themed activity. \n         */\n        public static final int Theme_AppCompat=0x7f0b0077;\n        /**  Menu/item attributes \n         */\n        public static final int Theme_AppCompat_Base_CompactMenu=0x7f0b0083;\n        public static final int Theme_AppCompat_Base_CompactMenu_Dialog=0x7f0b0084;\n        /**  Menu/item attributes \n         */\n        public static final int Theme_AppCompat_CompactMenu=0x7f0b007c;\n        public static final int Theme_AppCompat_CompactMenu_Dialog=0x7f0b007d;\n        public static final int Theme_AppCompat_DialogWhenLarge=0x7f0b007a;\n        /**  Platform-independent theme providing an action bar in a light-themed activity. \n         */\n        public static final int Theme_AppCompat_Light=0x7f0b0078;\n        /**  Platform-independent theme providing an action bar in a dark-themed activity. \n         */\n        public static final int Theme_AppCompat_Light_DarkActionBar=0x7f0b0079;\n        public static final int Theme_AppCompat_Light_DialogWhenLarge=0x7f0b007b;\n        /**  Base platform-dependent theme  \n         */\n        public static final int Theme_Base=0x7f0b007e;\n        /**  Base platform-dependent theme providing an action bar in a dark-themed activity. \n Base platform-dependent theme providing an action bar in a dark-themed activity. \n         */\n        public static final int Theme_Base_AppCompat=0x7f0b0080;\n        public static final int Theme_Base_AppCompat_Dialog_FixedSize=0x7f0b0087;\n        public static final int Theme_Base_AppCompat_Dialog_Light_FixedSize=0x7f0b0088;\n        public static final int Theme_Base_AppCompat_DialogWhenLarge=0x7f0b0085;\n        /** \n        As we have defined the theme in values-large (for compat) and values-large takes precedence\n        over values-v14, we need to reset back to the Holo parent in values-large-v14. As the themes\n        in values-v14 & values-large-v14 are exactly the same, these \"double base\" themes can be\n        inherited from in both values-v14 and values-large-v14.\n    \n         */\n        public static final int Theme_Base_AppCompat_DialogWhenLarge_Base=0x7f0b0089;\n        /**  Base platform-dependent theme providing an action bar in a light-themed activity. \n Base platform-dependent theme providing an action bar in a light-themed activity. \n         */\n        public static final int Theme_Base_AppCompat_Light=0x7f0b0081;\n        /**  Base platform-dependent theme providing a dark action bar in a light-themed activity. \n Base platform-dependent theme providing a dark action bar in a light-themed activity. \n         */\n        public static final int Theme_Base_AppCompat_Light_DarkActionBar=0x7f0b0082;\n        public static final int Theme_Base_AppCompat_Light_DialogWhenLarge=0x7f0b0086;\n        public static final int Theme_Base_AppCompat_Light_DialogWhenLarge_Base=0x7f0b008a;\n        /**  Base platform-dependent theme providing a light-themed activity. \n         */\n        public static final int Theme_Base_Light=0x7f0b007f;\n        /**  Styles in here can be extended for customisation in your application. Each utilises\n         one of the Base styles. If Holo themes are available on the current platform version\n         they will be used instead of the compat styles. \n         */\n        public static final int Widget_AppCompat_ActionBar=0x7f0b0000;\n        public static final int Widget_AppCompat_ActionBar_Solid=0x7f0b0002;\n        public static final int Widget_AppCompat_ActionBar_TabBar=0x7f0b0011;\n        public static final int Widget_AppCompat_ActionBar_TabText=0x7f0b0017;\n        public static final int Widget_AppCompat_ActionBar_TabView=0x7f0b0014;\n        public static final int Widget_AppCompat_ActionButton=0x7f0b000b;\n        public static final int Widget_AppCompat_ActionButton_CloseMode=0x7f0b000d;\n        public static final int Widget_AppCompat_ActionButton_Overflow=0x7f0b000f;\n        public static final int Widget_AppCompat_ActionMode=0x7f0b001b;\n        public static final int Widget_AppCompat_ActivityChooserView=0x7f0b0038;\n        public static final int Widget_AppCompat_AutoCompleteTextView=0x7f0b0036;\n        public static final int Widget_AppCompat_Base_ActionBar=0x7f0b003a;\n        public static final int Widget_AppCompat_Base_ActionBar_Solid=0x7f0b003c;\n        public static final int Widget_AppCompat_Base_ActionBar_TabBar=0x7f0b0045;\n        public static final int Widget_AppCompat_Base_ActionBar_TabText=0x7f0b004b;\n        public static final int Widget_AppCompat_Base_ActionBar_TabView=0x7f0b0048;\n        /**  Action Button Styles \n         */\n        public static final int Widget_AppCompat_Base_ActionButton=0x7f0b003f;\n        public static final int Widget_AppCompat_Base_ActionButton_CloseMode=0x7f0b0041;\n        public static final int Widget_AppCompat_Base_ActionButton_Overflow=0x7f0b0043;\n        public static final int Widget_AppCompat_Base_ActionMode=0x7f0b004e;\n        public static final int Widget_AppCompat_Base_ActivityChooserView=0x7f0b0075;\n        /**  AutoCompleteTextView styles (for SearchView) \n         */\n        public static final int Widget_AppCompat_Base_AutoCompleteTextView=0x7f0b0073;\n        public static final int Widget_AppCompat_Base_DropDownItem_Spinner=0x7f0b005d;\n        /**  Popup Menu \n         */\n        public static final int Widget_AppCompat_Base_ListPopupWindow=0x7f0b0065;\n        /**  Spinner Widgets \n         */\n        public static final int Widget_AppCompat_Base_ListView_DropDown=0x7f0b005f;\n        public static final int Widget_AppCompat_Base_ListView_Menu=0x7f0b0064;\n        public static final int Widget_AppCompat_Base_PopupMenu=0x7f0b0067;\n        public static final int Widget_AppCompat_Base_ProgressBar=0x7f0b005a;\n        /**  Progress Bar \n         */\n        public static final int Widget_AppCompat_Base_ProgressBar_Horizontal=0x7f0b0059;\n        /**  Action Bar Spinner Widgets \n         */\n        public static final int Widget_AppCompat_Base_Spinner=0x7f0b005b;\n        public static final int Widget_AppCompat_DropDownItem_Spinner=0x7f0b0024;\n        public static final int Widget_AppCompat_Light_ActionBar=0x7f0b0001;\n        public static final int Widget_AppCompat_Light_ActionBar_Solid=0x7f0b0003;\n        public static final int Widget_AppCompat_Light_ActionBar_Solid_Inverse=0x7f0b0004;\n        public static final int Widget_AppCompat_Light_ActionBar_TabBar=0x7f0b0012;\n        public static final int Widget_AppCompat_Light_ActionBar_TabBar_Inverse=0x7f0b0013;\n        public static final int Widget_AppCompat_Light_ActionBar_TabText=0x7f0b0018;\n        public static final int Widget_AppCompat_Light_ActionBar_TabText_Inverse=0x7f0b0019;\n        public static final int Widget_AppCompat_Light_ActionBar_TabView=0x7f0b0015;\n        public static final int Widget_AppCompat_Light_ActionBar_TabView_Inverse=0x7f0b0016;\n        public static final int Widget_AppCompat_Light_ActionButton=0x7f0b000c;\n        public static final int Widget_AppCompat_Light_ActionButton_CloseMode=0x7f0b000e;\n        public static final int Widget_AppCompat_Light_ActionButton_Overflow=0x7f0b0010;\n        public static final int Widget_AppCompat_Light_ActionMode_Inverse=0x7f0b001c;\n        public static final int Widget_AppCompat_Light_ActivityChooserView=0x7f0b0039;\n        public static final int Widget_AppCompat_Light_AutoCompleteTextView=0x7f0b0037;\n        public static final int Widget_AppCompat_Light_Base_ActionBar=0x7f0b003b;\n        public static final int Widget_AppCompat_Light_Base_ActionBar_Solid=0x7f0b003d;\n        public static final int Widget_AppCompat_Light_Base_ActionBar_Solid_Inverse=0x7f0b003e;\n        public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar=0x7f0b0046;\n        public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar_Inverse=0x7f0b0047;\n        public static final int Widget_AppCompat_Light_Base_ActionBar_TabText=0x7f0b004c;\n        public static final int Widget_AppCompat_Light_Base_ActionBar_TabText_Inverse=0x7f0b004d;\n        public static final int Widget_AppCompat_Light_Base_ActionBar_TabView=0x7f0b0049;\n        public static final int Widget_AppCompat_Light_Base_ActionBar_TabView_Inverse=0x7f0b004a;\n        public static final int Widget_AppCompat_Light_Base_ActionButton=0x7f0b0040;\n        public static final int Widget_AppCompat_Light_Base_ActionButton_CloseMode=0x7f0b0042;\n        public static final int Widget_AppCompat_Light_Base_ActionButton_Overflow=0x7f0b0044;\n        public static final int Widget_AppCompat_Light_Base_ActionMode_Inverse=0x7f0b004f;\n        public static final int Widget_AppCompat_Light_Base_ActivityChooserView=0x7f0b0076;\n        public static final int Widget_AppCompat_Light_Base_AutoCompleteTextView=0x7f0b0074;\n        public static final int Widget_AppCompat_Light_Base_DropDownItem_Spinner=0x7f0b005e;\n        public static final int Widget_AppCompat_Light_Base_ListPopupWindow=0x7f0b0066;\n        public static final int Widget_AppCompat_Light_Base_ListView_DropDown=0x7f0b0060;\n        public static final int Widget_AppCompat_Light_Base_PopupMenu=0x7f0b0068;\n        public static final int Widget_AppCompat_Light_Base_Spinner=0x7f0b005c;\n        public static final int Widget_AppCompat_Light_DropDownItem_Spinner=0x7f0b0025;\n        public static final int Widget_AppCompat_Light_ListPopupWindow=0x7f0b002a;\n        public static final int Widget_AppCompat_Light_ListView_DropDown=0x7f0b0027;\n        public static final int Widget_AppCompat_Light_PopupMenu=0x7f0b002c;\n        public static final int Widget_AppCompat_Light_Spinner_DropDown_ActionBar=0x7f0b0023;\n        public static final int Widget_AppCompat_ListPopupWindow=0x7f0b0029;\n        public static final int Widget_AppCompat_ListView_DropDown=0x7f0b0026;\n        public static final int Widget_AppCompat_ListView_Menu=0x7f0b002d;\n        public static final int Widget_AppCompat_PopupMenu=0x7f0b002b;\n        public static final int Widget_AppCompat_ProgressBar=0x7f0b000a;\n        public static final int Widget_AppCompat_ProgressBar_Horizontal=0x7f0b0009;\n        public static final int Widget_AppCompat_Spinner_DropDown_ActionBar=0x7f0b0022;\n    }\n    public static final class styleable {\n        /**  ============================================ \n Attributes used to style the Action Bar.\n         These should be set on your theme; the default actionBarStyle will\n         propagate them to the correct elements as needed.\n\n         Please Note: when overriding attributes for an ActionBar style\n         you must specify each attribute twice: once with the \"android:\"\n         namespace prefix and once without. \n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #ActionBar_background org.evilbinary.highliter:background}</code></td><td> Specifies a background drawable for the action bar.</td></tr>\n           <tr><td><code>{@link #ActionBar_backgroundSplit org.evilbinary.highliter:backgroundSplit}</code></td><td> Specifies a background drawable for the bottom component of a split action bar.</td></tr>\n           <tr><td><code>{@link #ActionBar_backgroundStacked org.evilbinary.highliter:backgroundStacked}</code></td><td> Specifies a background drawable for a second stacked row of the action bar.</td></tr>\n           <tr><td><code>{@link #ActionBar_customNavigationLayout org.evilbinary.highliter:customNavigationLayout}</code></td><td> Specifies a layout for custom navigation.</td></tr>\n           <tr><td><code>{@link #ActionBar_displayOptions org.evilbinary.highliter:displayOptions}</code></td><td> Options affecting how the action bar is displayed.</td></tr>\n           <tr><td><code>{@link #ActionBar_divider org.evilbinary.highliter:divider}</code></td><td> Specifies the drawable used for item dividers.</td></tr>\n           <tr><td><code>{@link #ActionBar_height org.evilbinary.highliter:height}</code></td><td> Specifies a fixed height.</td></tr>\n           <tr><td><code>{@link #ActionBar_homeLayout org.evilbinary.highliter:homeLayout}</code></td><td> Specifies a layout to use for the \"home\" section of the action bar.</td></tr>\n           <tr><td><code>{@link #ActionBar_icon org.evilbinary.highliter:icon}</code></td><td> Specifies the drawable used for the application icon.</td></tr>\n           <tr><td><code>{@link #ActionBar_indeterminateProgressStyle org.evilbinary.highliter:indeterminateProgressStyle}</code></td><td> Specifies a style resource to use for an indeterminate progress spinner.</td></tr>\n           <tr><td><code>{@link #ActionBar_itemPadding org.evilbinary.highliter:itemPadding}</code></td><td> Specifies padding that should be applied to the left and right sides of\n             system-provided items in the bar.</td></tr>\n           <tr><td><code>{@link #ActionBar_logo org.evilbinary.highliter:logo}</code></td><td> Specifies the drawable used for the application logo.</td></tr>\n           <tr><td><code>{@link #ActionBar_navigationMode org.evilbinary.highliter:navigationMode}</code></td><td> The type of navigation to use.</td></tr>\n           <tr><td><code>{@link #ActionBar_progressBarPadding org.evilbinary.highliter:progressBarPadding}</code></td><td> Specifies the horizontal padding on either end for an embedded progress bar.</td></tr>\n           <tr><td><code>{@link #ActionBar_progressBarStyle org.evilbinary.highliter:progressBarStyle}</code></td><td> Specifies a style resource to use for an embedded progress bar.</td></tr>\n           <tr><td><code>{@link #ActionBar_subtitle org.evilbinary.highliter:subtitle}</code></td><td> Specifies subtitle text used for navigationMode=\"normal\" </td></tr>\n           <tr><td><code>{@link #ActionBar_subtitleTextStyle org.evilbinary.highliter:subtitleTextStyle}</code></td><td> Specifies a style to use for subtitle text.</td></tr>\n           <tr><td><code>{@link #ActionBar_title org.evilbinary.highliter:title}</code></td><td> Specifies title text used for navigationMode=\"normal\" </td></tr>\n           <tr><td><code>{@link #ActionBar_titleTextStyle org.evilbinary.highliter:titleTextStyle}</code></td><td> Specifies a style to use for title text.</td></tr>\n           </table>\n           @see #ActionBar_background\n           @see #ActionBar_backgroundSplit\n           @see #ActionBar_backgroundStacked\n           @see #ActionBar_customNavigationLayout\n           @see #ActionBar_displayOptions\n           @see #ActionBar_divider\n           @see #ActionBar_height\n           @see #ActionBar_homeLayout\n           @see #ActionBar_icon\n           @see #ActionBar_indeterminateProgressStyle\n           @see #ActionBar_itemPadding\n           @see #ActionBar_logo\n           @see #ActionBar_navigationMode\n           @see #ActionBar_progressBarPadding\n           @see #ActionBar_progressBarStyle\n           @see #ActionBar_subtitle\n           @see #ActionBar_subtitleTextStyle\n           @see #ActionBar_title\n           @see #ActionBar_titleTextStyle\n         */\n        public static final int[] ActionBar = {\n            0x7f010025, 0x7f010026, 0x7f010027, 0x7f010028,\n            0x7f010029, 0x7f01002a, 0x7f01002b, 0x7f01002c,\n            0x7f01002d, 0x7f01002e, 0x7f01002f, 0x7f010030,\n            0x7f010031, 0x7f010032, 0x7f010033, 0x7f010034,\n            0x7f010035, 0x7f010036, 0x7f010037\n        };\n        /**\n          <p>\n          @attr description\n           Specifies a background drawable for the action bar. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:background\n        */\n        public static final int ActionBar_background = 10;\n        /**\n          <p>\n          @attr description\n           Specifies a background drawable for the bottom component of a split action bar. \n\n\n          <p>May be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n<p>May be a color value, in the form of \"<code>#<i>rgb</i></code>\", \"<code>#<i>argb</i></code>\",\n\"<code>#<i>rrggbb</i></code>\", or \"<code>#<i>aarrggbb</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:backgroundSplit\n        */\n        public static final int ActionBar_backgroundSplit = 12;\n        /**\n          <p>\n          @attr description\n           Specifies a background drawable for a second stacked row of the action bar. \n\n\n          <p>May be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n<p>May be a color value, in the form of \"<code>#<i>rgb</i></code>\", \"<code>#<i>argb</i></code>\",\n\"<code>#<i>rrggbb</i></code>\", or \"<code>#<i>aarrggbb</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:backgroundStacked\n        */\n        public static final int ActionBar_backgroundStacked = 11;\n        /**\n          <p>\n          @attr description\n           Specifies a layout for custom navigation. Overrides navigationMode. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:customNavigationLayout\n        */\n        public static final int ActionBar_customNavigationLayout = 13;\n        /**\n          <p>\n          @attr description\n           Options affecting how the action bar is displayed. \n\n\n          <p>Must be one or more (separated by '|') of the following constant values.</p>\n<table>\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<tr><th>Constant</th><th>Value</th><th>Description</th></tr>\n<tr><td><code>useLogo</code></td><td>0x1</td><td></td></tr>\n<tr><td><code>showHome</code></td><td>0x2</td><td></td></tr>\n<tr><td><code>homeAsUp</code></td><td>0x4</td><td></td></tr>\n<tr><td><code>showTitle</code></td><td>0x8</td><td></td></tr>\n<tr><td><code>showCustom</code></td><td>0x10</td><td></td></tr>\n<tr><td><code>disableHome</code></td><td>0x20</td><td></td></tr>\n</table>\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:displayOptions\n        */\n        public static final int ActionBar_displayOptions = 3;\n        /**\n          <p>\n          @attr description\n           Specifies the drawable used for item dividers. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:divider\n        */\n        public static final int ActionBar_divider = 9;\n        /**\n          <p>\n          @attr description\n           Specifies a fixed height. \n\n\n          <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:height\n        */\n        public static final int ActionBar_height = 1;\n        /**\n          <p>\n          @attr description\n           Specifies a layout to use for the \"home\" section of the action bar. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:homeLayout\n        */\n        public static final int ActionBar_homeLayout = 14;\n        /**\n          <p>\n          @attr description\n           Specifies the drawable used for the application icon. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:icon\n        */\n        public static final int ActionBar_icon = 7;\n        /**\n          <p>\n          @attr description\n           Specifies a style resource to use for an indeterminate progress spinner. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:indeterminateProgressStyle\n        */\n        public static final int ActionBar_indeterminateProgressStyle = 16;\n        /**\n          <p>\n          @attr description\n           Specifies padding that should be applied to the left and right sides of\n             system-provided items in the bar. \n\n\n          <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:itemPadding\n        */\n        public static final int ActionBar_itemPadding = 18;\n        /**\n          <p>\n          @attr description\n           Specifies the drawable used for the application logo. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:logo\n        */\n        public static final int ActionBar_logo = 8;\n        /**\n          <p>\n          @attr description\n           The type of navigation to use. \n\n\n          <p>Must be one of the following constant values.</p>\n<table>\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<tr><th>Constant</th><th>Value</th><th>Description</th></tr>\n<tr><td><code>normal</code></td><td>0</td><td> Normal static title text </td></tr>\n<tr><td><code>listMode</code></td><td>1</td><td> The action bar will use a selection list for navigation. </td></tr>\n<tr><td><code>tabMode</code></td><td>2</td><td> The action bar will use a series of horizontal tabs for navigation. </td></tr>\n</table>\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:navigationMode\n        */\n        public static final int ActionBar_navigationMode = 2;\n        /**\n          <p>\n          @attr description\n           Specifies the horizontal padding on either end for an embedded progress bar. \n\n\n          <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:progressBarPadding\n        */\n        public static final int ActionBar_progressBarPadding = 17;\n        /**\n          <p>\n          @attr description\n           Specifies a style resource to use for an embedded progress bar. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:progressBarStyle\n        */\n        public static final int ActionBar_progressBarStyle = 15;\n        /**\n          <p>\n          @attr description\n           Specifies subtitle text used for navigationMode=\"normal\" \n\n\n          <p>Must be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:subtitle\n        */\n        public static final int ActionBar_subtitle = 4;\n        /**\n          <p>\n          @attr description\n           Specifies a style to use for subtitle text. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:subtitleTextStyle\n        */\n        public static final int ActionBar_subtitleTextStyle = 6;\n        /**\n          <p>\n          @attr description\n           Specifies title text used for navigationMode=\"normal\" \n\n\n          <p>Must be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:title\n        */\n        public static final int ActionBar_title = 0;\n        /**\n          <p>\n          @attr description\n           Specifies a style to use for title text. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:titleTextStyle\n        */\n        public static final int ActionBar_titleTextStyle = 5;\n        /**  Valid LayoutParams for views placed in the action bar as custom views. \n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #ActionBarLayout_android_layout_gravity android:layout_gravity}</code></td><td></td></tr>\n           </table>\n           @see #ActionBarLayout_android_layout_gravity\n         */\n        public static final int[] ActionBarLayout = {\n            0x010100b3\n        };\n        /**\n          <p>This symbol is the offset where the {@link android.R.attr#layout_gravity}\n          attribute's value can be found in the {@link #ActionBarLayout} array.\n          @attr name android:layout_gravity\n        */\n        public static final int ActionBarLayout_android_layout_gravity = 0;\n        /**  These attributes are meant to be specified and customized by the app.\n         The system will read and apply them as needed. These attributes control\n         properties of the activity window, such as whether an action bar should\n         be present and whether it should overlay content. \n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #ActionBarWindow_windowActionBar org.evilbinary.highliter:windowActionBar}</code></td><td></td></tr>\n           <tr><td><code>{@link #ActionBarWindow_windowActionBarOverlay org.evilbinary.highliter:windowActionBarOverlay}</code></td><td></td></tr>\n           <tr><td><code>{@link #ActionBarWindow_windowFixedHeightMajor org.evilbinary.highliter:windowFixedHeightMajor}</code></td><td> A fixed height for the window along the major axis of the screen,\n             that is, when in portrait.</td></tr>\n           <tr><td><code>{@link #ActionBarWindow_windowFixedHeightMinor org.evilbinary.highliter:windowFixedHeightMinor}</code></td><td> A fixed height for the window along the minor axis of the screen,\n             that is, when in landscape.</td></tr>\n           <tr><td><code>{@link #ActionBarWindow_windowFixedWidthMajor org.evilbinary.highliter:windowFixedWidthMajor}</code></td><td> A fixed width for the window along the major axis of the screen,\n             that is, when in landscape.</td></tr>\n           <tr><td><code>{@link #ActionBarWindow_windowFixedWidthMinor org.evilbinary.highliter:windowFixedWidthMinor}</code></td><td> A fixed width for the window along the minor axis of the screen,\n             that is, when in portrait.</td></tr>\n           <tr><td><code>{@link #ActionBarWindow_windowSplitActionBar org.evilbinary.highliter:windowSplitActionBar}</code></td><td></td></tr>\n           </table>\n           @see #ActionBarWindow_windowActionBar\n           @see #ActionBarWindow_windowActionBarOverlay\n           @see #ActionBarWindow_windowFixedHeightMajor\n           @see #ActionBarWindow_windowFixedHeightMinor\n           @see #ActionBarWindow_windowFixedWidthMajor\n           @see #ActionBarWindow_windowFixedWidthMinor\n           @see #ActionBarWindow_windowSplitActionBar\n         */\n        public static final int[] ActionBarWindow = {\n            0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,\n            0x7f010004, 0x7f010005, 0x7f010006\n        };\n        /**\n          <p>This symbol is the offset where the {@link org.evilbinary.highliter.R.attr#windowActionBar}\n          attribute's value can be found in the {@link #ActionBarWindow} array.\n\n\n          <p>Must be a boolean value, either \"<code>true</code>\" or \"<code>false</code>\".\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          @attr name org.evilbinary.highliter:windowActionBar\n        */\n        public static final int ActionBarWindow_windowActionBar = 0;\n        /**\n          <p>This symbol is the offset where the {@link org.evilbinary.highliter.R.attr#windowActionBarOverlay}\n          attribute's value can be found in the {@link #ActionBarWindow} array.\n\n\n          <p>Must be a boolean value, either \"<code>true</code>\" or \"<code>false</code>\".\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          @attr name org.evilbinary.highliter:windowActionBarOverlay\n        */\n        public static final int ActionBarWindow_windowActionBarOverlay = 1;\n        /**\n          <p>\n          @attr description\n           A fixed height for the window along the major axis of the screen,\n             that is, when in portrait. Can be either an absolute dimension\n             or a fraction of the screen size in that dimension. \n\n\n          <p>May be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>May be a fractional value, which is a floating point number appended with either % or %p, such as \"<code>14.5%</code>\".\nThe % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to\nsome parent container.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:windowFixedHeightMajor\n        */\n        public static final int ActionBarWindow_windowFixedHeightMajor = 6;\n        /**\n          <p>\n          @attr description\n           A fixed height for the window along the minor axis of the screen,\n             that is, when in landscape. Can be either an absolute dimension\n             or a fraction of the screen size in that dimension. \n\n\n          <p>May be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>May be a fractional value, which is a floating point number appended with either % or %p, such as \"<code>14.5%</code>\".\nThe % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to\nsome parent container.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:windowFixedHeightMinor\n        */\n        public static final int ActionBarWindow_windowFixedHeightMinor = 4;\n        /**\n          <p>\n          @attr description\n           A fixed width for the window along the major axis of the screen,\n             that is, when in landscape. Can be either an absolute dimension\n             or a fraction of the screen size in that dimension. \n\n\n          <p>May be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>May be a fractional value, which is a floating point number appended with either % or %p, such as \"<code>14.5%</code>\".\nThe % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to\nsome parent container.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:windowFixedWidthMajor\n        */\n        public static final int ActionBarWindow_windowFixedWidthMajor = 3;\n        /**\n          <p>\n          @attr description\n           A fixed width for the window along the minor axis of the screen,\n             that is, when in portrait. Can be either an absolute dimension\n             or a fraction of the screen size in that dimension. \n\n\n          <p>May be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>May be a fractional value, which is a floating point number appended with either % or %p, such as \"<code>14.5%</code>\".\nThe % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to\nsome parent container.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:windowFixedWidthMinor\n        */\n        public static final int ActionBarWindow_windowFixedWidthMinor = 5;\n        /**\n          <p>This symbol is the offset where the {@link org.evilbinary.highliter.R.attr#windowSplitActionBar}\n          attribute's value can be found in the {@link #ActionBarWindow} array.\n\n\n          <p>Must be a boolean value, either \"<code>true</code>\" or \"<code>false</code>\".\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          @attr name org.evilbinary.highliter:windowSplitActionBar\n        */\n        public static final int ActionBarWindow_windowSplitActionBar = 2;\n        /** Attributes that can be used with a ActionMenuItemView.\n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #ActionMenuItemView_android_minWidth android:minWidth}</code></td><td></td></tr>\n           </table>\n           @see #ActionMenuItemView_android_minWidth\n         */\n        public static final int[] ActionMenuItemView = {\n            0x0101013f\n        };\n        /**\n          <p>This symbol is the offset where the {@link android.R.attr#minWidth}\n          attribute's value can be found in the {@link #ActionMenuItemView} array.\n          @attr name android:minWidth\n        */\n        public static final int ActionMenuItemView_android_minWidth = 0;\n        /**  Size of padding on either end of a divider. \n         */\n        public static final int[] ActionMenuView = {\n            \n        };\n        /** Attributes that can be used with a ActionMode.\n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #ActionMode_background org.evilbinary.highliter:background}</code></td><td> Specifies a background for the action mode bar.</td></tr>\n           <tr><td><code>{@link #ActionMode_backgroundSplit org.evilbinary.highliter:backgroundSplit}</code></td><td> Specifies a background for the split action mode bar.</td></tr>\n           <tr><td><code>{@link #ActionMode_height org.evilbinary.highliter:height}</code></td><td> Specifies a fixed height for the action mode bar.</td></tr>\n           <tr><td><code>{@link #ActionMode_subtitleTextStyle org.evilbinary.highliter:subtitleTextStyle}</code></td><td> Specifies a style to use for subtitle text.</td></tr>\n           <tr><td><code>{@link #ActionMode_titleTextStyle org.evilbinary.highliter:titleTextStyle}</code></td><td> Specifies a style to use for title text.</td></tr>\n           </table>\n           @see #ActionMode_background\n           @see #ActionMode_backgroundSplit\n           @see #ActionMode_height\n           @see #ActionMode_subtitleTextStyle\n           @see #ActionMode_titleTextStyle\n         */\n        public static final int[] ActionMode = {\n            0x7f010026, 0x7f01002a, 0x7f01002b, 0x7f01002f,\n            0x7f010031\n        };\n        /**\n          <p>\n          @attr description\n           Specifies a background for the action mode bar. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:background\n        */\n        public static final int ActionMode_background = 3;\n        /**\n          <p>\n          @attr description\n           Specifies a background for the split action mode bar. \n\n\n          <p>May be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n<p>May be a color value, in the form of \"<code>#<i>rgb</i></code>\", \"<code>#<i>argb</i></code>\",\n\"<code>#<i>rrggbb</i></code>\", or \"<code>#<i>aarrggbb</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:backgroundSplit\n        */\n        public static final int ActionMode_backgroundSplit = 4;\n        /**\n          <p>\n          @attr description\n           Specifies a fixed height for the action mode bar. \n\n\n          <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:height\n        */\n        public static final int ActionMode_height = 0;\n        /**\n          <p>\n          @attr description\n           Specifies a style to use for subtitle text. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:subtitleTextStyle\n        */\n        public static final int ActionMode_subtitleTextStyle = 2;\n        /**\n          <p>\n          @attr description\n           Specifies a style to use for title text. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:titleTextStyle\n        */\n        public static final int ActionMode_titleTextStyle = 1;\n        /**  Attrbitutes for a ActivityChooserView. \n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #ActivityChooserView_expandActivityOverflowButtonDrawable org.evilbinary.highliter:expandActivityOverflowButtonDrawable}</code></td><td> The drawable to show in the button for expanding the activities overflow popup.</td></tr>\n           <tr><td><code>{@link #ActivityChooserView_initialActivityCount org.evilbinary.highliter:initialActivityCount}</code></td><td> The maximal number of items initially shown in the activity list.</td></tr>\n           </table>\n           @see #ActivityChooserView_expandActivityOverflowButtonDrawable\n           @see #ActivityChooserView_initialActivityCount\n         */\n        public static final int[] ActivityChooserView = {\n            0x7f01006a, 0x7f01006b\n        };\n        /**\n          <p>\n          @attr description\n           The drawable to show in the button for expanding the activities overflow popup.\n             <strong>Note:</strong> Clients would like to set this drawable\n             as a clue about the action the chosen activity will perform. For\n             example, if share activity is to be chosen the drawable should\n             give a clue that sharing is to be performed.\n         \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:expandActivityOverflowButtonDrawable\n        */\n        public static final int ActivityChooserView_expandActivityOverflowButtonDrawable = 1;\n        /**\n          <p>\n          @attr description\n           The maximal number of items initially shown in the activity list. \n\n\n          <p>Must be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:initialActivityCount\n        */\n        public static final int ActivityChooserView_initialActivityCount = 0;\n        /** Attributes that can be used with a CompatTextView.\n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #CompatTextView_textAllCaps org.evilbinary.highliter:textAllCaps}</code></td><td> Present the text in ALL CAPS.</td></tr>\n           </table>\n           @see #CompatTextView_textAllCaps\n         */\n        public static final int[] CompatTextView = {\n            0x7f01006d\n        };\n        /**\n          <p>\n          @attr description\n           Present the text in ALL CAPS. This may use a small-caps form when available. \n\n\n          <p>May be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n<p>May be a boolean value, either \"<code>true</code>\" or \"<code>false</code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:textAllCaps\n        */\n        public static final int CompatTextView_textAllCaps = 0;\n        /** Attributes that can be used with a LinearLayoutICS.\n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #LinearLayoutICS_divider org.evilbinary.highliter:divider}</code></td><td> Drawable to use as a vertical divider between buttons.</td></tr>\n           <tr><td><code>{@link #LinearLayoutICS_dividerPadding org.evilbinary.highliter:dividerPadding}</code></td><td> Size of padding on either end of a divider.</td></tr>\n           <tr><td><code>{@link #LinearLayoutICS_showDividers org.evilbinary.highliter:showDividers}</code></td><td> Setting for which dividers to show.</td></tr>\n           </table>\n           @see #LinearLayoutICS_divider\n           @see #LinearLayoutICS_dividerPadding\n           @see #LinearLayoutICS_showDividers\n         */\n        public static final int[] LinearLayoutICS = {\n            0x7f01002e, 0x7f010055, 0x7f010056\n        };\n        /**\n          <p>\n          @attr description\n           Drawable to use as a vertical divider between buttons. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:divider\n        */\n        public static final int LinearLayoutICS_divider = 0;\n        /**\n          <p>\n          @attr description\n           Size of padding on either end of a divider. \n\n\n          <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:dividerPadding\n        */\n        public static final int LinearLayoutICS_dividerPadding = 2;\n        /**\n          <p>\n          @attr description\n           Setting for which dividers to show. \n\n\n          <p>Must be one or more (separated by '|') of the following constant values.</p>\n<table>\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<tr><th>Constant</th><th>Value</th><th>Description</th></tr>\n<tr><td><code>none</code></td><td>0</td><td></td></tr>\n<tr><td><code>beginning</code></td><td>1</td><td></td></tr>\n<tr><td><code>middle</code></td><td>2</td><td></td></tr>\n<tr><td><code>end</code></td><td>4</td><td></td></tr>\n</table>\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:showDividers\n        */\n        public static final int LinearLayoutICS_showDividers = 1;\n        /**  Base attributes that are available to all groups. \n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #MenuGroup_android_checkableBehavior android:checkableBehavior}</code></td><td> Whether the items are capable of displaying a check mark.</td></tr>\n           <tr><td><code>{@link #MenuGroup_android_enabled android:enabled}</code></td><td> Whether the items are enabled.</td></tr>\n           <tr><td><code>{@link #MenuGroup_android_id android:id}</code></td><td> The ID of the group.</td></tr>\n           <tr><td><code>{@link #MenuGroup_android_menuCategory android:menuCategory}</code></td><td> The category applied to all items within this group.</td></tr>\n           <tr><td><code>{@link #MenuGroup_android_orderInCategory android:orderInCategory}</code></td><td> The order within the category applied to all items within this group.</td></tr>\n           <tr><td><code>{@link #MenuGroup_android_visible android:visible}</code></td><td> Whether the items are shown/visible.</td></tr>\n           </table>\n           @see #MenuGroup_android_checkableBehavior\n           @see #MenuGroup_android_enabled\n           @see #MenuGroup_android_id\n           @see #MenuGroup_android_menuCategory\n           @see #MenuGroup_android_orderInCategory\n           @see #MenuGroup_android_visible\n         */\n        public static final int[] MenuGroup = {\n            0x0101000e, 0x010100d0, 0x01010194, 0x010101de,\n            0x010101df, 0x010101e0\n        };\n        /**\n          <p>\n          @attr description\n           Whether the items are capable of displaying a check mark. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#checkableBehavior}.\n          @attr name android:checkableBehavior\n        */\n        public static final int MenuGroup_android_checkableBehavior = 5;\n        /**\n          <p>\n          @attr description\n           Whether the items are enabled. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#enabled}.\n          @attr name android:enabled\n        */\n        public static final int MenuGroup_android_enabled = 0;\n        /**\n          <p>\n          @attr description\n           The ID of the group. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#id}.\n          @attr name android:id\n        */\n        public static final int MenuGroup_android_id = 1;\n        /**\n          <p>\n          @attr description\n           The category applied to all items within this group.\n             (This will be or'ed with the orderInCategory attribute.) \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#menuCategory}.\n          @attr name android:menuCategory\n        */\n        public static final int MenuGroup_android_menuCategory = 3;\n        /**\n          <p>\n          @attr description\n           The order within the category applied to all items within this group.\n             (This will be or'ed with the category attribute.) \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#orderInCategory}.\n          @attr name android:orderInCategory\n        */\n        public static final int MenuGroup_android_orderInCategory = 4;\n        /**\n          <p>\n          @attr description\n           Whether the items are shown/visible. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#visible}.\n          @attr name android:visible\n        */\n        public static final int MenuGroup_android_visible = 2;\n        /**  Base attributes that are available to all Item objects. \n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #MenuItem_actionLayout org.evilbinary.highliter:actionLayout}</code></td><td> An optional layout to be used as an action view.</td></tr>\n           <tr><td><code>{@link #MenuItem_actionProviderClass org.evilbinary.highliter:actionProviderClass}</code></td><td> The name of an optional ActionProvider class to instantiate an action view\n             and perform operations such as default action for that menu item.</td></tr>\n           <tr><td><code>{@link #MenuItem_actionViewClass org.evilbinary.highliter:actionViewClass}</code></td><td> The name of an optional View class to instantiate and use as an\n             action view.</td></tr>\n           <tr><td><code>{@link #MenuItem_android_alphabeticShortcut android:alphabeticShortcut}</code></td><td> The alphabetic shortcut key.</td></tr>\n           <tr><td><code>{@link #MenuItem_android_checkable android:checkable}</code></td><td> Whether the item is capable of displaying a check mark.</td></tr>\n           <tr><td><code>{@link #MenuItem_android_checked android:checked}</code></td><td> Whether the item is checked.</td></tr>\n           <tr><td><code>{@link #MenuItem_android_enabled android:enabled}</code></td><td> Whether the item is enabled.</td></tr>\n           <tr><td><code>{@link #MenuItem_android_icon android:icon}</code></td><td> The icon associated with this item.</td></tr>\n           <tr><td><code>{@link #MenuItem_android_id android:id}</code></td><td> The ID of the item.</td></tr>\n           <tr><td><code>{@link #MenuItem_android_menuCategory android:menuCategory}</code></td><td> The category applied to the item.</td></tr>\n           <tr><td><code>{@link #MenuItem_android_numericShortcut android:numericShortcut}</code></td><td> The numeric shortcut key.</td></tr>\n           <tr><td><code>{@link #MenuItem_android_onClick android:onClick}</code></td><td> Name of a method on the Context used to inflate the menu that will be\n             called when the item is clicked.</td></tr>\n           <tr><td><code>{@link #MenuItem_android_orderInCategory android:orderInCategory}</code></td><td> The order within the category applied to the item.</td></tr>\n           <tr><td><code>{@link #MenuItem_android_title android:title}</code></td><td> The title associated with the item.</td></tr>\n           <tr><td><code>{@link #MenuItem_android_titleCondensed android:titleCondensed}</code></td><td> The condensed title associated with the item.</td></tr>\n           <tr><td><code>{@link #MenuItem_android_visible android:visible}</code></td><td> Whether the item is shown/visible.</td></tr>\n           <tr><td><code>{@link #MenuItem_showAsAction org.evilbinary.highliter:showAsAction}</code></td><td> How this item should display in the Action Bar, if present.</td></tr>\n           </table>\n           @see #MenuItem_actionLayout\n           @see #MenuItem_actionProviderClass\n           @see #MenuItem_actionViewClass\n           @see #MenuItem_android_alphabeticShortcut\n           @see #MenuItem_android_checkable\n           @see #MenuItem_android_checked\n           @see #MenuItem_android_enabled\n           @see #MenuItem_android_icon\n           @see #MenuItem_android_id\n           @see #MenuItem_android_menuCategory\n           @see #MenuItem_android_numericShortcut\n           @see #MenuItem_android_onClick\n           @see #MenuItem_android_orderInCategory\n           @see #MenuItem_android_title\n           @see #MenuItem_android_titleCondensed\n           @see #MenuItem_android_visible\n           @see #MenuItem_showAsAction\n         */\n        public static final int[] MenuItem = {\n            0x01010002, 0x0101000e, 0x010100d0, 0x01010106,\n            0x01010194, 0x010101de, 0x010101df, 0x010101e1,\n            0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5,\n            0x0101026f, 0x7f01004d, 0x7f01004e, 0x7f01004f,\n            0x7f010050\n        };\n        /**\n          <p>\n          @attr description\n           An optional layout to be used as an action view.\n             See {@link android.view.MenuItem#setActionView(android.view.View)}\n             for more info. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:actionLayout\n        */\n        public static final int MenuItem_actionLayout = 14;\n        /**\n          <p>\n          @attr description\n           The name of an optional ActionProvider class to instantiate an action view\n             and perform operations such as default action for that menu item.\n             See {@link android.view.MenuItem#setActionProvider(android.view.ActionProvider)}\n             for more info. \n\n\n          <p>Must be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:actionProviderClass\n        */\n        public static final int MenuItem_actionProviderClass = 16;\n        /**\n          <p>\n          @attr description\n           The name of an optional View class to instantiate and use as an\n             action view. See {@link android.view.MenuItem#setActionView(android.view.View)}\n             for more info. \n\n\n          <p>Must be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:actionViewClass\n        */\n        public static final int MenuItem_actionViewClass = 15;\n        /**\n          <p>\n          @attr description\n           The alphabetic shortcut key.  This is the shortcut when using a keyboard\n             with alphabetic keys. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#alphabeticShortcut}.\n          @attr name android:alphabeticShortcut\n        */\n        public static final int MenuItem_android_alphabeticShortcut = 9;\n        /**\n          <p>\n          @attr description\n           Whether the item is capable of displaying a check mark. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#checkable}.\n          @attr name android:checkable\n        */\n        public static final int MenuItem_android_checkable = 11;\n        /**\n          <p>\n          @attr description\n           Whether the item is checked.  Note that you must first have enabled checking with\n             the checkable attribute or else the check mark will not appear. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#checked}.\n          @attr name android:checked\n        */\n        public static final int MenuItem_android_checked = 3;\n        /**\n          <p>\n          @attr description\n           Whether the item is enabled. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#enabled}.\n          @attr name android:enabled\n        */\n        public static final int MenuItem_android_enabled = 1;\n        /**\n          <p>\n          @attr description\n           The icon associated with this item.  This icon will not always be shown, so\n             the title should be sufficient in describing this item. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#icon}.\n          @attr name android:icon\n        */\n        public static final int MenuItem_android_icon = 0;\n        /**\n          <p>\n          @attr description\n           The ID of the item. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#id}.\n          @attr name android:id\n        */\n        public static final int MenuItem_android_id = 2;\n        /**\n          <p>\n          @attr description\n           The category applied to the item.\n             (This will be or'ed with the orderInCategory attribute.) \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#menuCategory}.\n          @attr name android:menuCategory\n        */\n        public static final int MenuItem_android_menuCategory = 5;\n        /**\n          <p>\n          @attr description\n           The numeric shortcut key.  This is the shortcut when using a numeric (e.g., 12-key)\n             keyboard. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#numericShortcut}.\n          @attr name android:numericShortcut\n        */\n        public static final int MenuItem_android_numericShortcut = 10;\n        /**\n          <p>\n          @attr description\n           Name of a method on the Context used to inflate the menu that will be\n             called when the item is clicked. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#onClick}.\n          @attr name android:onClick\n        */\n        public static final int MenuItem_android_onClick = 12;\n        /**\n          <p>\n          @attr description\n           The order within the category applied to the item.\n             (This will be or'ed with the category attribute.) \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#orderInCategory}.\n          @attr name android:orderInCategory\n        */\n        public static final int MenuItem_android_orderInCategory = 6;\n        /**\n          <p>\n          @attr description\n           The title associated with the item. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#title}.\n          @attr name android:title\n        */\n        public static final int MenuItem_android_title = 7;\n        /**\n          <p>\n          @attr description\n           The condensed title associated with the item.  This is used in situations where the\n             normal title may be too long to be displayed. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#titleCondensed}.\n          @attr name android:titleCondensed\n        */\n        public static final int MenuItem_android_titleCondensed = 8;\n        /**\n          <p>\n          @attr description\n           Whether the item is shown/visible. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#visible}.\n          @attr name android:visible\n        */\n        public static final int MenuItem_android_visible = 4;\n        /**\n          <p>\n          @attr description\n           How this item should display in the Action Bar, if present. \n\n\n          <p>Must be one or more (separated by '|') of the following constant values.</p>\n<table>\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<tr><th>Constant</th><th>Value</th><th>Description</th></tr>\n<tr><td><code>never</code></td><td>0</td><td> Never show this item in an action bar, show it in the overflow menu instead.\n                 Mutually exclusive with \"ifRoom\" and \"always\". </td></tr>\n<tr><td><code>ifRoom</code></td><td>1</td><td> Show this item in an action bar if there is room for it as determined\n                 by the system. Favor this option over \"always\" where possible.\n                 Mutually exclusive with \"never\" and \"always\". </td></tr>\n<tr><td><code>always</code></td><td>2</td><td> Always show this item in an actionbar, even if it would override\n                 the system's limits of how much stuff to put there. This may make\n                 your action bar look bad on some screens. In most cases you should\n                 use \"ifRoom\" instead. Mutually exclusive with \"ifRoom\" and \"never\". </td></tr>\n<tr><td><code>withText</code></td><td>4</td><td> When this item is shown as an action in the action bar, show a text\n                 label with it even if it has an icon representation. </td></tr>\n<tr><td><code>collapseActionView</code></td><td>8</td><td> This item's action view collapses to a normal menu\n                 item. When expanded, the action view takes over a\n                 larger segment of its container. </td></tr>\n</table>\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:showAsAction\n        */\n        public static final int MenuItem_showAsAction = 13;\n        /** Attributes that can be used with a MenuView.\n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #MenuView_android_headerBackground android:headerBackground}</code></td><td> Default background for the menu header.</td></tr>\n           <tr><td><code>{@link #MenuView_android_horizontalDivider android:horizontalDivider}</code></td><td> Default horizontal divider between rows of menu items.</td></tr>\n           <tr><td><code>{@link #MenuView_android_itemBackground android:itemBackground}</code></td><td> Default background for each menu item.</td></tr>\n           <tr><td><code>{@link #MenuView_android_itemIconDisabledAlpha android:itemIconDisabledAlpha}</code></td><td> Default disabled icon alpha for each menu item that shows an icon.</td></tr>\n           <tr><td><code>{@link #MenuView_android_itemTextAppearance android:itemTextAppearance}</code></td><td> Default appearance of menu item text.</td></tr>\n           <tr><td><code>{@link #MenuView_android_preserveIconSpacing android:preserveIconSpacing}</code></td><td> Whether space should be reserved in layout when an icon is missing.</td></tr>\n           <tr><td><code>{@link #MenuView_android_verticalDivider android:verticalDivider}</code></td><td> Default vertical divider between menu items.</td></tr>\n           <tr><td><code>{@link #MenuView_android_windowAnimationStyle android:windowAnimationStyle}</code></td><td> Default animations for the menu.</td></tr>\n           </table>\n           @see #MenuView_android_headerBackground\n           @see #MenuView_android_horizontalDivider\n           @see #MenuView_android_itemBackground\n           @see #MenuView_android_itemIconDisabledAlpha\n           @see #MenuView_android_itemTextAppearance\n           @see #MenuView_android_preserveIconSpacing\n           @see #MenuView_android_verticalDivider\n           @see #MenuView_android_windowAnimationStyle\n         */\n        public static final int[] MenuView = {\n            0x010100ae, 0x0101012c, 0x0101012d, 0x0101012e,\n            0x0101012f, 0x01010130, 0x01010131, 0x010103ea\n        };\n        /**\n          <p>\n          @attr description\n           Default background for the menu header. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#headerBackground}.\n          @attr name android:headerBackground\n        */\n        public static final int MenuView_android_headerBackground = 4;\n        /**\n          <p>\n          @attr description\n           Default horizontal divider between rows of menu items. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#horizontalDivider}.\n          @attr name android:horizontalDivider\n        */\n        public static final int MenuView_android_horizontalDivider = 2;\n        /**\n          <p>\n          @attr description\n           Default background for each menu item. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#itemBackground}.\n          @attr name android:itemBackground\n        */\n        public static final int MenuView_android_itemBackground = 5;\n        /**\n          <p>\n          @attr description\n           Default disabled icon alpha for each menu item that shows an icon. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#itemIconDisabledAlpha}.\n          @attr name android:itemIconDisabledAlpha\n        */\n        public static final int MenuView_android_itemIconDisabledAlpha = 6;\n        /**\n          <p>\n          @attr description\n           Default appearance of menu item text. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#itemTextAppearance}.\n          @attr name android:itemTextAppearance\n        */\n        public static final int MenuView_android_itemTextAppearance = 1;\n        /**\n          <p>\n          @attr description\n           Whether space should be reserved in layout when an icon is missing. \n          <p>This is a private symbol.\n          @attr name android:preserveIconSpacing\n        */\n        public static final int MenuView_android_preserveIconSpacing = 7;\n        /**\n          <p>\n          @attr description\n           Default vertical divider between menu items. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#verticalDivider}.\n          @attr name android:verticalDivider\n        */\n        public static final int MenuView_android_verticalDivider = 3;\n        /**\n          <p>\n          @attr description\n           Default animations for the menu. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#windowAnimationStyle}.\n          @attr name android:windowAnimationStyle\n        */\n        public static final int MenuView_android_windowAnimationStyle = 0;\n        /** Attributes that can be used with a SearchView.\n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #SearchView_android_imeOptions android:imeOptions}</code></td><td> The IME options to set on the query text field.</td></tr>\n           <tr><td><code>{@link #SearchView_android_inputType android:inputType}</code></td><td> The input type to set on the query text field.</td></tr>\n           <tr><td><code>{@link #SearchView_android_maxWidth android:maxWidth}</code></td><td> An optional maximum width of the SearchView.</td></tr>\n           <tr><td><code>{@link #SearchView_iconifiedByDefault org.evilbinary.highliter:iconifiedByDefault}</code></td><td> The default state of the SearchView.</td></tr>\n           <tr><td><code>{@link #SearchView_queryHint org.evilbinary.highliter:queryHint}</code></td><td> An optional query hint string to be displayed in the empty query field.</td></tr>\n           </table>\n           @see #SearchView_android_imeOptions\n           @see #SearchView_android_inputType\n           @see #SearchView_android_maxWidth\n           @see #SearchView_iconifiedByDefault\n           @see #SearchView_queryHint\n         */\n        public static final int[] SearchView = {\n            0x0101011f, 0x01010220, 0x01010264, 0x7f01005a,\n            0x7f01005b\n        };\n        /**\n          <p>\n          @attr description\n           The IME options to set on the query text field. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#imeOptions}.\n          @attr name android:imeOptions\n        */\n        public static final int SearchView_android_imeOptions = 2;\n        /**\n          <p>\n          @attr description\n           The input type to set on the query text field. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#inputType}.\n          @attr name android:inputType\n        */\n        public static final int SearchView_android_inputType = 1;\n        /**\n          <p>\n          @attr description\n           An optional maximum width of the SearchView. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#maxWidth}.\n          @attr name android:maxWidth\n        */\n        public static final int SearchView_android_maxWidth = 0;\n        /**\n          <p>\n          @attr description\n           The default state of the SearchView. If true, it will be iconified when not in\n             use and expanded when clicked. \n\n\n          <p>Must be a boolean value, either \"<code>true</code>\" or \"<code>false</code>\".\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:iconifiedByDefault\n        */\n        public static final int SearchView_iconifiedByDefault = 3;\n        /**\n          <p>\n          @attr description\n           An optional query hint string to be displayed in the empty query field. \n\n\n          <p>Must be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character.\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:queryHint\n        */\n        public static final int SearchView_queryHint = 4;\n        /** Attributes that can be used with a Spinner.\n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #Spinner_android_dropDownHorizontalOffset android:dropDownHorizontalOffset}</code></td><td> Horizontal offset from the spinner widget for positioning the dropdown\n             in spinnerMode=\"dropdown\".</td></tr>\n           <tr><td><code>{@link #Spinner_android_dropDownSelector android:dropDownSelector}</code></td><td> List selector to use for spinnerMode=\"dropdown\" display.</td></tr>\n           <tr><td><code>{@link #Spinner_android_dropDownVerticalOffset android:dropDownVerticalOffset}</code></td><td> Vertical offset from the spinner widget for positioning the dropdown in\n             spinnerMode=\"dropdown\".</td></tr>\n           <tr><td><code>{@link #Spinner_android_dropDownWidth android:dropDownWidth}</code></td><td> Width of the dropdown in spinnerMode=\"dropdown\".</td></tr>\n           <tr><td><code>{@link #Spinner_android_gravity android:gravity}</code></td><td> Gravity setting for positioning the currently selected item.</td></tr>\n           <tr><td><code>{@link #Spinner_android_popupBackground android:popupBackground}</code></td><td> Background drawable to use for the dropdown in spinnerMode=\"dropdown\".</td></tr>\n           <tr><td><code>{@link #Spinner_disableChildrenWhenDisabled org.evilbinary.highliter:disableChildrenWhenDisabled}</code></td><td> Whether this spinner should mark child views as enabled/disabled when\n             the spinner itself is enabled/disabled.</td></tr>\n           <tr><td><code>{@link #Spinner_popupPromptView org.evilbinary.highliter:popupPromptView}</code></td><td> Reference to a layout to use for displaying a prompt in the dropdown for\n             spinnerMode=\"dropdown\".</td></tr>\n           <tr><td><code>{@link #Spinner_prompt org.evilbinary.highliter:prompt}</code></td><td> The prompt to display when the spinner's dialog is shown.</td></tr>\n           <tr><td><code>{@link #Spinner_spinnerMode org.evilbinary.highliter:spinnerMode}</code></td><td> Display mode for spinner options.</td></tr>\n           </table>\n           @see #Spinner_android_dropDownHorizontalOffset\n           @see #Spinner_android_dropDownSelector\n           @see #Spinner_android_dropDownVerticalOffset\n           @see #Spinner_android_dropDownWidth\n           @see #Spinner_android_gravity\n           @see #Spinner_android_popupBackground\n           @see #Spinner_disableChildrenWhenDisabled\n           @see #Spinner_popupPromptView\n           @see #Spinner_prompt\n           @see #Spinner_spinnerMode\n         */\n        public static final int[] Spinner = {\n            0x010100af, 0x01010175, 0x01010176, 0x01010262,\n            0x010102ac, 0x010102ad, 0x7f010051, 0x7f010052,\n            0x7f010053, 0x7f010054\n        };\n        /**\n          <p>\n          @attr description\n           Horizontal offset from the spinner widget for positioning the dropdown\n             in spinnerMode=\"dropdown\". \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#dropDownHorizontalOffset}.\n          @attr name android:dropDownHorizontalOffset\n        */\n        public static final int Spinner_android_dropDownHorizontalOffset = 4;\n        /**\n          <p>\n          @attr description\n           List selector to use for spinnerMode=\"dropdown\" display. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#dropDownSelector}.\n          @attr name android:dropDownSelector\n        */\n        public static final int Spinner_android_dropDownSelector = 1;\n        /**\n          <p>\n          @attr description\n           Vertical offset from the spinner widget for positioning the dropdown in\n             spinnerMode=\"dropdown\". \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#dropDownVerticalOffset}.\n          @attr name android:dropDownVerticalOffset\n        */\n        public static final int Spinner_android_dropDownVerticalOffset = 5;\n        /**\n          <p>\n          @attr description\n           Width of the dropdown in spinnerMode=\"dropdown\". \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#dropDownWidth}.\n          @attr name android:dropDownWidth\n        */\n        public static final int Spinner_android_dropDownWidth = 3;\n        /**\n          <p>\n          @attr description\n           Gravity setting for positioning the currently selected item. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#gravity}.\n          @attr name android:gravity\n        */\n        public static final int Spinner_android_gravity = 0;\n        /**\n          <p>\n          @attr description\n           Background drawable to use for the dropdown in spinnerMode=\"dropdown\". \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#popupBackground}.\n          @attr name android:popupBackground\n        */\n        public static final int Spinner_android_popupBackground = 2;\n        /**\n          <p>\n          @attr description\n           Whether this spinner should mark child views as enabled/disabled when\n             the spinner itself is enabled/disabled. \n\n\n          <p>Must be a boolean value, either \"<code>true</code>\" or \"<code>false</code>\".\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:disableChildrenWhenDisabled\n        */\n        public static final int Spinner_disableChildrenWhenDisabled = 9;\n        /**\n          <p>\n          @attr description\n           Reference to a layout to use for displaying a prompt in the dropdown for\n             spinnerMode=\"dropdown\". This layout must contain a TextView with the id\n             {@code @android:id/text1} to be populated with the prompt text. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:popupPromptView\n        */\n        public static final int Spinner_popupPromptView = 8;\n        /**\n          <p>\n          @attr description\n           The prompt to display when the spinner's dialog is shown. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:prompt\n        */\n        public static final int Spinner_prompt = 6;\n        /**\n          <p>\n          @attr description\n           Display mode for spinner options. \n\n\n          <p>Must be one of the following constant values.</p>\n<table>\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<colgroup align=\"left\" />\n<tr><th>Constant</th><th>Value</th><th>Description</th></tr>\n<tr><td><code>dialog</code></td><td>0</td><td> Spinner options will be presented to the user as a dialog window. </td></tr>\n<tr><td><code>dropdown</code></td><td>1</td><td> Spinner options will be presented to the user as an inline dropdown\n                 anchored to the spinner widget itself. </td></tr>\n</table>\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:spinnerMode\n        */\n        public static final int Spinner_spinnerMode = 7;\n        /**  These are the standard attributes that make up a complete theme. \n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #Theme_actionDropDownStyle org.evilbinary.highliter:actionDropDownStyle}</code></td><td> Default ActionBar dropdown style.</td></tr>\n           <tr><td><code>{@link #Theme_dropdownListPreferredItemHeight org.evilbinary.highliter:dropdownListPreferredItemHeight}</code></td><td> The preferred item height for dropdown lists.</td></tr>\n           <tr><td><code>{@link #Theme_listChoiceBackgroundIndicator org.evilbinary.highliter:listChoiceBackgroundIndicator}</code></td><td> Drawable used as a background for selected list items.</td></tr>\n           <tr><td><code>{@link #Theme_panelMenuListTheme org.evilbinary.highliter:panelMenuListTheme}</code></td><td> Default Panel Menu style.</td></tr>\n           <tr><td><code>{@link #Theme_panelMenuListWidth org.evilbinary.highliter:panelMenuListWidth}</code></td><td> Default Panel Menu width.</td></tr>\n           <tr><td><code>{@link #Theme_popupMenuStyle org.evilbinary.highliter:popupMenuStyle}</code></td><td> Default PopupMenu style.</td></tr>\n           </table>\n           @see #Theme_actionDropDownStyle\n           @see #Theme_dropdownListPreferredItemHeight\n           @see #Theme_listChoiceBackgroundIndicator\n           @see #Theme_panelMenuListTheme\n           @see #Theme_panelMenuListWidth\n           @see #Theme_popupMenuStyle\n         */\n        public static final int[] Theme = {\n            0x7f010047, 0x7f010048, 0x7f010049, 0x7f01004a,\n            0x7f01004b, 0x7f01004c\n        };\n        /**\n          <p>\n          @attr description\n           Default ActionBar dropdown style. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:actionDropDownStyle\n        */\n        public static final int Theme_actionDropDownStyle = 0;\n        /**\n          <p>\n          @attr description\n           The preferred item height for dropdown lists. \n\n\n          <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:dropdownListPreferredItemHeight\n        */\n        public static final int Theme_dropdownListPreferredItemHeight = 1;\n        /**\n          <p>\n          @attr description\n           Drawable used as a background for selected list items. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:listChoiceBackgroundIndicator\n        */\n        public static final int Theme_listChoiceBackgroundIndicator = 5;\n        /**\n          <p>\n          @attr description\n           Default Panel Menu style. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:panelMenuListTheme\n        */\n        public static final int Theme_panelMenuListTheme = 4;\n        /**\n          <p>\n          @attr description\n           Default Panel Menu width. \n\n\n          <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:panelMenuListWidth\n        */\n        public static final int Theme_panelMenuListWidth = 3;\n        /**\n          <p>\n          @attr description\n           Default PopupMenu style. \n\n\n          <p>Must be a reference to another resource, in the form \"<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>\"\nor to a theme attribute in the form \"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\".\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:popupMenuStyle\n        */\n        public static final int Theme_popupMenuStyle = 2;\n        /** Attributes that can be used with a View.\n           <p>Includes the following attributes:</p>\n           <table>\n           <colgroup align=\"left\" />\n           <colgroup align=\"left\" />\n           <tr><th>Attribute</th><th>Description</th></tr>\n           <tr><td><code>{@link #View_android_focusable android:focusable}</code></td><td> Boolean that controls whether a view can take focus.</td></tr>\n           <tr><td><code>{@link #View_paddingEnd org.evilbinary.highliter:paddingEnd}</code></td><td> Sets the padding, in pixels, of the end edge; see {@link android.R.attr#padding}.</td></tr>\n           <tr><td><code>{@link #View_paddingStart org.evilbinary.highliter:paddingStart}</code></td><td> Sets the padding, in pixels, of the start edge; see {@link android.R.attr#padding}.</td></tr>\n           </table>\n           @see #View_android_focusable\n           @see #View_paddingEnd\n           @see #View_paddingStart\n         */\n        public static final int[] View = {\n            0x010100da, 0x7f010038, 0x7f010039\n        };\n        /**\n          <p>\n          @attr description\n           Boolean that controls whether a view can take focus.  By default the user can not\n             move focus to a view; by setting this attribute to true the view is\n             allowed to take focus.  This value does not impact the behavior of\n             directly calling {@link android.view.View#requestFocus}, which will\n             always request focus regardless of this view.  It only impacts where\n             focus navigation will try to move focus. \n          <p>This corresponds to the global attribute\n          resource symbol {@link android.R.attr#focusable}.\n          @attr name android:focusable\n        */\n        public static final int View_android_focusable = 0;\n        /**\n          <p>\n          @attr description\n           Sets the padding, in pixels, of the end edge; see {@link android.R.attr#padding}. \n\n\n          <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:paddingEnd\n        */\n        public static final int View_paddingEnd = 2;\n        /**\n          <p>\n          @attr description\n           Sets the padding, in pixels, of the start edge; see {@link android.R.attr#padding}. \n\n\n          <p>Must be a dimension value, which is a floating point number appended with a unit such as \"<code>14.5sp</code>\".\nAvailable units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),\nin (inches), mm (millimeters).\n<p>This may also be a reference to a resource (in the form\n\"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>\") or\ntheme attribute (in the form\n\"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>\")\ncontaining a value of this type.\n          <p>This is a private symbol.\n          @attr name org.evilbinary.highliter:paddingStart\n        */\n        public static final int View_paddingStart = 1;\n    };\n}\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Wed Oct 21 11:34:03 PDT 2015\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.8-all.zip\n"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windowz variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "jni/Android.mk",
    "content": "\ninclude $(call all-subdir-makefiles)\n\n"
  },
  {
    "path": "jni/Application.mk",
    "content": "#APP_ABI := armeabi-v7a\n\n#NDK_TOOLCHAIN_VERSION:=4.8\nAPP_STL := stlport_static\n#APP_STL := stlport_shared\nAPP_STL := gnustl_static\nAPP_CPPFLAGS := -frtti -std=c++11\n"
  },
  {
    "path": "jni/highlight/Android.mk",
    "content": "LOCAL_PATH := $(call my-dir)\n\ninclude $(CLEAR_VARS)\n\nLOCAL_MODULE    := highlight\n\nBOOST_VERSION :=1_53_0\nBOOST_VERSION2 :=1_53\n\nMY_LIB_PATH :=$(LOCAL_PATH)/../../../lib\nBOOST_INCLUDE_PATH :=$(MY_LIB_PATH)/boost_$(BOOST_VERSION)/include\nBOOST_LIB_PATH :=$(MY_LIB_PATH)/boost_$(BOOST_VERSION)/armeabi/lib\n\nLUA_INCLUDE_PATH :=$(LOCAL_PATH)/../lua\n\nLOCAL_C_INCLUDES := $(LOCAL_PATH)/include \\\n\t$(BOOST_INCLUDE_PATH) \\\n\t$(LUA_INCLUDE_PATH) \\\n\t$(LOCAL_PATH)/android/ \\\n\t$(LOCAL_PATH)/cli/ \\\n\t\nLOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,, \\\n\t$(wildcard $(LOCAL_PATH)/core/*.cpp) \\\n\t$(wildcard $(LOCAL_PATH)/core/astyle/*.cpp) \\\n\t$(wildcard $(LOCAL_PATH)/core/Diluculum/*.cpp)  \\\n\t$(wildcard $(LOCAL_PATH)/android/*.cpp) \\\n\t$(wildcard $(LOCAL_PATH)/cli/*.cpp) \\\n\t$(wildcard $(LOCAL_PATH)/cli/*.cc) \\\n\t$(wildcard $(LOCAL_PATH)/android/*.cc)  ) \\\n\nLOCAL_LDLIBS += -L$(BOOST_LIB_PATH)     \\\n                -lboost_system-gcc-mt-$(BOOST_VERSION2)  \\\n                -lboost_thread-gcc-mt-$(BOOST_VERSION2) \\\n                \nLOCAL_SHARED_LIBRARIES := lua\n#LOCAL_STATIC_LIBRARIES := lua\n\nLOCAL_LDLIBS := -llog\nLOCAL_CFLAGS += \nLOCAL_CPPFLAGS := -std=c++11  -fpermissive -fexceptions -g -DANDROID\n\n\nLOCAL_ARM_MODE := arm\n\ninclude $(BUILD_SHARED_LIBRARY)\n#include $(BUILD_EXECUTABLE)\n"
  },
  {
    "path": "jni/highlight/android/app.cpp",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"app.h\"\n\n#include <memory>\n#include <algorithm>\n#include <Diluculum/LuaState.hpp>\n\n#include \"main.h\"\n#include \"../include/datadir.h\"\n#include \"syntaxreader.h\"\n\nusing namespace std;\n\nstatic HighliterAndroid *highliter = NULL;\n\nJNIEXPORT jint\n\nJNICALL Java_org_evilbinary_highliter_parsers_SyntaxHighlight_init(\n        JNIEnv *env, jobject obj, jstring args) {\n\n    highliter = new HighliterAndroid();\n    jboolean iscopy = JNI_TRUE;\n    const char *str = env->GetStringUTFChars(args, &iscopy);\n    if (str == NULL) {\n        return -1;\n    }\n    string pargs(str);\n    env->ReleaseStringUTFChars((jstring) args, str);\n    LOGI(\"args:%s\", pargs.c_str());\n    highliter->init(pargs);\n\n    LOGI(\"init highliter:%p\", highliter);\n}\n\nJNIEXPORT jstring\n\nJNICALL Java_org_evilbinary_highliter_parsers_SyntaxHighlight_pase(\n        JNIEnv *env, jobject obj, jstring code) {\n//\tLOGI(\"pase highliter:%p\", highliter);\n\n    jboolean iscopy = JNI_TRUE;\n    const char *str = env->GetStringUTFChars(code, &iscopy);\n    if (str == NULL) {\n        return -1;\n    }\n    string ccontent(str);\n    env->ReleaseStringUTFChars((jstring) code, str);\n\n    vector <Object> out;\n\n    int ret = highliter->parse(ccontent, out);\n\n    jclass cls = env->GetObjectClass(obj);\n    jmethodID mid = env->GetMethodID( cls, \"addToken\",\n                                        \"(ILjava/lang/String;Ljava/lang/String;)V\");\n    assert(mid);\n\n    for (int i = 0; i < out.size(); i++) {\n        Object o = out[i];\n        //LOGI(\"state=%d obj.str=%s style:%s\", o.state, o.str.c_str(), o.style.c_str());\n        jstring string = env->NewStringUTF(o.str.c_str());\n        jstring style = env->NewStringUTF(o.style.c_str());\n        env->CallVoidMethod(obj,mid,o.state,string,style);\n        env->DeleteLocalRef(string );\n        env->DeleteLocalRef(style);\n    }\n    out.clear();\n\n    jstring result = env->NewStringUTF(\"\");\n\n//\tLOGI(\"out:%s\",cstr);\n    return result;\n\n}\n\nHighliterAndroid::HighliterAndroid() {\n\n}\n\nvoid HighliterAndroid::destroy() {\n\n    if (generator != NULL) {\n        delete generator;\n    }\n}\n\nstd::vector <std::string> split(const std::string &s, const std::string &delim) {\n    std::vector <std::string> elems;\n    size_t pos = 0;\n    size_t len = s.length();\n    size_t delim_len = delim.length();\n    if (delim_len == 0) return elems;\n    while (pos < len) {\n        int find_pos = s.find(delim, pos);\n        if (find_pos < 0) {\n            elems.push_back(s.substr(pos, len - pos));\n            break;\n        }\n        elems.push_back(s.substr(pos, find_pos - pos));\n        pos = find_pos + delim_len;\n    }\n    return elems;\n}\n\nint HighliterAndroid::init(string args) {\n    vector <string> vargs = split(args, \":\");\n\n    int argc = vargs.size();\n    //dataDirPath += \"/\";\n    //string outflag = \"-d\" + dataDirPath;\n    //char *argv[7] = { \"hilighlight\", \"--syntax=c\",\"-f\",\"-smolokai\",\"-chighlight.css\",outflag.c_str() };\n    char **argv = new char *[argc];\n    for (int i = 0; i < argc; i++) {\n        argv[i] = vargs[i].c_str();\n        LOGI(\"\t%s\", argv[i]);\n    }\n    LOGI(\"init====\");\n    options.init(argc, argv);\n    delete argv;\n\n\n    LOGI(\"hoptions finish\");\n\n    LOGI(\"initSearchDirectories\");\n    dataDir.initSearchDirectories(options.getDataDir());\n    LOGI(\"loadFileTypeConfig\");\n    //call before printInstalledLanguages!\n    loadFileTypeConfig(\"filetypes\", &extensions, &scriptShebangs);\n\n    if (options.showLangdefs()) {\n        return printInstalledLanguages();\n    }\n\n    inFileList = options.getInputFileNames();\n\n    if (options.enableBatchMode() && inFileList[0].empty()) {\n        return EXIT_FAILURE;\n    }\n    LOGI(\"create generator outtype=%d\", options.getOutputType());\n\n    generator = highlight::CodeGenerator::getInstance(options.getOutputType());\n\n    LOGI(\"themePath\");\n\n    string themePath =\n            options.getAbsThemePath().empty() ?\n            dataDir.getThemePath(options.getThemeName()) :\n            options.getAbsThemePath();\n    LOGI(\n            \"themePath empty:%d %s %s\", options.getAbsThemePath().empty(),\n            dataDir.getThemePath(options.getThemeName()).c_str(),\n            options.getAbsThemePath().c_str());\n\n    LOGI(\"generator set finish\");\n\n    generator->setHTMLAttachAnchors(options.attachLineAnchors());\n    generator->setHTMLOrderedList(options.orderedList());\n    generator->setHTMLInlineCSS(options.inlineCSS());\n    generator->setHTMLEnclosePreTag(options.enclosePreTag());\n    generator->setHTMLAnchorPrefix(options.getAnchorPrefix());\n    generator->setHTMLClassName(options.getClassName());\n\n    LOGI(\"generator set finish2\");\n\n    generator->setLATEXReplaceQuotes(options.replaceQuotes());\n    generator->setLATEXNoShorthands(options.disableBabelShorthands());\n    generator->setLATEXPrettySymbols(options.prettySymbols());\n\n    generator->setRTFPageSize(options.getPageSize());\n    generator->setRTFCharStyles(options.includeCharStyles());\n\n    generator->setSVGSize(options.getSVGWidth(), options.getSVGHeight());\n\n    LOGI(\"generator set finish3\");\n\n    if (options.useCRDelimiter())\n        generator->setEOLDelimiter('\\r');\n\n    generator->setValidateInput(options.validateInput());\n    generator->setNumberWrappedLines(options.numberWrappedLines());\n\n    generator->setStyleInputPath(options.getStyleInFilename());\n    generator->setStyleOutputPath(options.getStyleOutFilename());\n    generator->setIncludeStyle(options.includeStyleDef());\n    generator->setPrintLineNumbers(options.printLineNumbers(),\n                                   options.getNumberStart());\n    generator->setPrintZeroes(options.fillLineNrZeroes());\n    generator->setFragmentCode(options.fragmentOutput());\n    generator->setPreformatting(options.getWrappingStyle(),\n                                (generator->getPrintLineNumbers()) ?\n                                options.getLineLength() - options.getNumberWidth() :\n                                options.getLineLength(), options.getNumberSpaces());\n\n    LOGI(\"generator set finish4\");\n\n    generator->setEncoding(options.getEncoding());\n    generator->setBaseFont(options.getBaseFont());\n    generator->setBaseFontSize(options.getBaseFontSize());\n    generator->setLineNumberWidth(options.getNumberWidth());\n    generator->setStartingNestedLang(options.getStartNestedLang());\n    generator->disableTrailingNL(options.disableTrailingNL());\n    generator->setPluginReadFile(options.getPluginReadFilePath());\n\n    LOGI(\"generator set finish5\");\n\n    styleFileWanted = !options.fragmentOutput()\n                      || options.styleOutPathDefined();\n\n    LOGI(\"styleFileWanted:%d options.fragmentOutput():%d\", styleFileWanted,\n         options.fragmentOutput());\n\n    const vector <string> pluginFileList = collectPluginPaths(\n            options.getPluginPaths());\n    for (unsigned int i = 0; i < pluginFileList.size(); i++) {\n        if (!generator->initPluginScript(pluginFileList[i])) {\n            cerr << \"highlight: \" << generator->getPluginScriptError() << \" in \"\n            << pluginFileList[i] << \"\\n\";\n            LOGE(\n                    \"erro:%s in %s\\n\", generator->getPluginScriptError().c_str(),\n                    pluginFileList[i].c_str());\n\n            return EXIT_FAILURE;\n        }\n    }\n    LOGI(\"generator set finish6 themePath:%s\", themePath.c_str());\n\n    if (!generator->initTheme(themePath)) {\n        cerr << \"highlight: \" << generator->getThemeInitError() << \"\\n\";\n        LOGE(\"erro:%s\", generator->getThemeInitError().c_str());\n        return EXIT_FAILURE;\n    }\n    LOGI(\"generator set finish7\");\n\n    if (options.printOnlyStyle()) {\n        if (!options.formatSupportsExtStyle()) {\n            cerr << \"highlight: output format supports no external styles.\\n\";\n            LOGE(\"output format supports no external styles.\\n\");\n            return EXIT_FAILURE;\n        }\n        bool useStdout = options.getStyleOutFilename() == \"stdout\";\n        string cssOutFile = options.getOutDirectory()\n                            + options.getStyleOutFilename();\n        bool success = generator->printExternalStyle(\n                useStdout ? \"\" : cssOutFile);\n        if (!success) {\n            cerr << \"highlight: Could not write \" << cssOutFile << \".\\n\";\n            LOGE(\"highlight: Could not write %s.\\n\", cssOutFile.c_str());\n            return EXIT_FAILURE;\n        }\n        styleFileWanted = 0;\n        //return EXIT_SUCCESS;\n    }\n    LOGI(\"generator set finish8\");\n\n    formattingEnabled = generator->initIndentationScheme(\n            options.getIndentScheme());\n\n    LOGI(\"generator set finish9\");\n\n    if (!formattingEnabled && !options.getIndentScheme().empty()) {\n        cerr << \"highlight: Undefined indentation scheme \"\n        << options.getIndentScheme() << \".\\n\";\n        LOGE(\n                \"Undefined indentation scheme %s.\\n\", options.getIndentScheme().c_str());\n\n        return EXIT_FAILURE;\n    }\n\n    LOGI(\"init finish\");\n    LOGI(\"generator:%p\", &generator);\n\n}\n\nint HighliterAndroid::parse(string content, vector <Object> &result) {\n    LOGI(\"parse generator:%p\", &generator);\n    string outDirectory = options.getOutDirectory();\n    LOGI(\"outDirectory:%s\", outDirectory.c_str());\n\n    bool initError = false, IOError = false;\n    unsigned int fileCount = inFileList.size(), fileCountWidth = getNumDigits(\n            fileCount), i = 0, numBadFormatting = 0, numBadInput = 0,\n            numBadOutput = 0;\n\n    vector <string> badFormattedFiles, badInputFiles, badOutputFiles;\n    std::set <string> usedFileNames;\n    string inFileName, outFilePath;\n    string suffix, lastSuffix;\n\n    if (options.syntaxGiven()) // user defined language definition, valid for all files\n    {\n        suffix = guessFileType(options.getSyntax(), \"\", true);\n    }\n    LOGI(\"suffix:%s\", suffix.c_str());\n\n    if (!options.syntaxGiven()) // determine file type for each file\n    {\n        suffix = guessFileType(getFileSuffix(inFileList[i]), inFileList[i]);\n    }\n    if (suffix.empty() && options.forceOutput())\n        suffix = \"txt\"; //avoid segfault\n    if (suffix.empty()) {\n        if (!options.enableBatchMode()) {\n            cerr << \"highlight: Undefined language definition. Use --\"\n            << OPT_SYNTAX << \" option.\\n\";\n            LOGE(\n                    \"highlight: Undefined language definition. Use --%s option.\\n\", OPT_SYNTAX);\n        }\n        if (!options.forceOutput()) {\n            initError = true;\n\n        }\n    }\n\n    if (suffix != lastSuffix) {\n        string langDefPath =\n                options.getAbsLangPath().empty() ?\n                dataDir.getLangPath(suffix + \".lang\") :\n                options.getAbsLangPath();\n        LOGI(\"langDefPath:%s\", langDefPath.c_str());\n        LOGI(\"generator addr:%p\", &generator);\n        highlight::LoadResult loadRes = generator->loadLanguage(langDefPath);\n\n        if (loadRes == highlight::LOAD_FAILED_REGEX) {\n            cerr << \"highlight: Regex error ( \"\n            << generator->getSyntaxRegexError() << \" ) in \" << suffix\n            << \".lang\\n\";\n            LOGE(\n                    \"Regex error ( %s ) in %s.lang\\n\", generator->getSyntaxRegexError().c_str(),\n                    suffix.c_str());\n            initError = true;\n\n        } else if (loadRes == highlight::LOAD_FAILED_LUA) {\n            cerr << \"highlight: Lua error ( \" << generator->getSyntaxLuaError()\n            << \" ) in \" << suffix << \".lang\\n\";\n            LOGE(\n                    \"Lua error ( %s ) in %s.lang\\n\", generator->getSyntaxLuaError().c_str(),\n                    suffix.c_str());\n            initError = true;\n\n        } else if (loadRes == highlight::LOAD_FAILED) {\n            // do also ignore error msg if --syntax parameter should be skipped\n            if (!(options.quietMode() || options.isSkippedExt(suffix))) {\n                cerr << \"highlight: Unknown source file extension \\\"\" << suffix\n                << \"\\\".\\n\";\n                LOGE(\n                        \"Unknown source file extension \\\"%s\\\".\\n\", suffix.c_str());\n            }\n            if (!options.forceOutput()) {\n                initError = true;\n            }\n        }\n        if (options.printDebugInfo() && loadRes == highlight::LOAD_OK) {\n            printDebugInfo(generator->getSyntaxReader(), langDefPath);\n        }\n        lastSuffix = suffix;\n    }\n\n    if (options.useFNamesAsAnchors()) {\n        generator->setHTMLAnchorPrefix(inFileName);\n    }\n\n    generator->setTitle(\n            options.getDocumentTitle().empty() ?\n            inFileList[i] : options.getDocumentTitle());\n\n    generator->setKeyWordCase(options.getKeywordCase());\n\n    //out = generator->generateString(content);\n\n    result = generator->generateObject(content);\n\n//\tLOGI(\"generate out:%s\",out.c_str() );\n\n    if (formattingEnabled && !generator->formattingIsPossible()) {\n        if (numBadFormatting++ < IO_ERROR_REPORT_LENGTH\n            || options.printDebugInfo()) {\n            badFormattedFiles.push_back(outFilePath);\n        }\n    }\n\n    if (!options.includeStyleDef() && styleFileWanted\n        && options.formatSupportsExtStyle()) {\n        string cssOutFile = outDirectory + options.getStyleOutFilename();\n        bool success = generator->printExternalStyle(cssOutFile);\n        if (!success) {\n            cerr << \"highlight: Could not write \" << cssOutFile << \".\\n\";\n            LOGE(\"highlight: Could not write %s.\\n\", cssOutFile.c_str());\n            IOError = true;\n        }\n    }\n\n    if (options.printIndexFile()) {\n        bool success = generator->printIndexFile(inFileList, outDirectory);\n        if (!success) {\n            cerr << \"highlight: Could not write index file.\\n\";\n            LOGE(\"highlight: Could not write index file.\\n\");\n            IOError = true;\n        }\n    }\n\n    if (numBadInput) {\n        printIOErrorReport(numBadInput, badInputFiles, \"read input\");\n        IOError = true;\n    }\n    if (numBadOutput) {\n        printIOErrorReport(numBadOutput, badOutputFiles, \"write output\");\n        IOError = true;\n    }\n    if (numBadFormatting) {\n        printIOErrorReport(numBadFormatting, badFormattedFiles, \"reformat\");\n    }\n    return (initError || IOError) ? EXIT_FAILURE : EXIT_SUCCESS;\n}\n\nint HighliterAndroid::getNumDigits(int i) {\n    int res = 0;\n    while (i) {\n        i /= 10;\n        ++res;\n    }\n    return res;\n}\n\nvoid HighliterAndroid::printProgressBar(int total, int count) {\n    if (!total)\n        return;\n    int p = 100 * count / total;\n    int numProgressItems = p / 10;\n    cout << \"\\r[\";\n    for (int i = 0; i < 10; i++) {\n        cout << ((i < numProgressItems) ? \"#\" : \" \");\n    }\n    cout << \"] \" << setw(3) << p << \"%, \" << count << \" / \" << total << \"  \"\n    << flush;\n    if (p == 100) {\n        cout << endl;\n    }\n}\n\nvoid HighliterAndroid::printCurrentAction(const string &outfilePath, int total,\n                                          int count, int countWidth) {\n    cout << \"Writing file \" << setw(countWidth) << count << \" of \" << total\n    << \": \" << outfilePath << \"\\n\";\n}\n\nvoid HighliterAndroid::printIOErrorReport(unsigned int numberErrorFiles,\n                                          vector <string> &fileList, const string &action) {\n    cerr << \"highlight: Could not \" << action << \" file\"\n    << ((numberErrorFiles > 1) ? \"s\" : \"\") << \":\\n\";\n    LOGE(\n            \"highlight: Could not %s file%s:\\n\", action.c_str(),\n            ((numberErrorFiles > 1) ? \"s\" : \"\"));\n\n    copy(fileList.begin(), fileList.end(),\n         ostream_iterator<string>(cerr, \"\\n\"));\n\n    if (fileList.size() < numberErrorFiles) {\n        cerr << \"... [\" << (numberErrorFiles - fileList.size()) << \" of \"\n        << numberErrorFiles << \" failures not shown, use --\"\n        << OPT_VERBOSE << \" switch to print all failures]\\n\";\n        LOGE(\n                \"... [%d of %d failures not shown, use -- %s switch to print all failures]\\n\",\n                (numberErrorFiles - fileList.size()), numberErrorFiles, OPT_VERBOSE);\n\n    }\n}\n\nstring HighliterAndroid::analyzeFile(const string &file) {\n    string firstLine;\n    if (!file.empty()) {\n        ifstream inFile(file.c_str());\n        getline(inFile, firstLine);\n    } else {\n        //  This copies all the data to a new buffer, uses the data to get the\n        //  first line, then makes cin use the new buffer that underlies the\n        //  stringstream instance\n        cin_bufcopy << cin.rdbuf();\n        getline(cin_bufcopy, firstLine);\n        cin_bufcopy.seekg(0, ios::beg);\n        cin.rdbuf(cin_bufcopy.rdbuf());\n    }\n    StringMap::iterator it;\n    boost::xpressive::sregex rex;\n    boost::xpressive::smatch what;\n    for (it = scriptShebangs.begin(); it != scriptShebangs.end(); it++) {\n        rex = boost::xpressive::sregex::compile(it->first);\n        if (boost::xpressive::regex_search(firstLine, what, rex))\n            return it->second;\n    }\n    return \"\";\n}\n\nstring HighliterAndroid::guessFileType(const string &suffix,\n                                       const string &inputFile, bool useUserSuffix) {\n    string lcSuffix = StringTools::change_case(suffix);\n    if (extensions.count(lcSuffix)) {\n        return extensions[lcSuffix];\n    }\n\n    if (!useUserSuffix) {\n        string shebang = analyzeFile(inputFile);\n        if (!shebang.empty())\n            return shebang;\n    }\n    return lcSuffix;\n}\n\nvoid HighliterAndroid::printDebugInfo(const highlight::SyntaxReader *lang,\n                                      const string &langDefPath) {\n    if (!lang)\n        return;\n    cerr << \"\\nLoading language definition:\\n\" << langDefPath;\n    cerr << \"\\n\\nDescription: \" << lang->getDescription();\n\n    Diluculum::LuaState *luaState = lang->getLuaState();\n    if (luaState) {\n        cerr << \"\\n\\nLUA GLOBALS:\\n\";\n        Diluculum::LuaValueMap::iterator it;\n        Diluculum::LuaValueMap glob = luaState->globals();\n        for (it = glob.begin(); it != glob.end(); it++) {\n            Diluculum::LuaValue first = it->first;\n            Diluculum::LuaValue second = it->second;\n            std::cerr << first.asString() << \": \";\n            switch (second.type()) {\n                case LUA_TSTRING:\n                    cerr << \"string [ \" << second.asString() << \" ]\";\n                    break;\n                case LUA_TNUMBER:\n                    cerr << \"number [ \" << second.asNumber() << \" ]\";\n                    break;\n                case LUA_TBOOLEAN:\n                    cerr << \"boolean [ \" << second.asBoolean() << \" ]\";\n                    break;\n                default:\n                    cerr << second.typeName();\n            }\n            cerr << endl;\n        }\n\n    }\n    /*\n     cerr << \"\\nREGEX:\\n\";\n     highlight::RegexElement *re=NULL;\n     for ( unsigned int i=0; i<lang->getRegexElements().size(); i++ )\n     {\n     re = lang->getRegexElements() [i];\n     cerr << \"State \"<<re->open<<\":\\t\"<<re->rex. <<\"\\n\";\n     }*/\n    cerr << \"\\nKEYWORDS:\\n\";\n    highlight::KeywordMap::iterator it;\n    highlight::KeywordMap keys = lang->getKeywords();\n    for (it = keys.begin(); it != keys.end(); it++) {\n        cerr << \" \" << it->first << \"(\" << it->second << \")\";\n    }\n    cerr << \"\\n\\n\";\n}\n\nvoid HighliterAndroid::printConfigInfo() {\n    cout << \"\\nConfig file search directories:\\n\";\n    dataDir.printConfigPaths();\n    cout << \"\\nFiletype config file:\\n\"\n    << dataDir.getFiletypesConfPath(\"filetypes\") << \"\\n\";\n    cout << endl;\n#ifdef HL_DATA_DIR\n    cout << \"Compiler directive HL_DATA_DIR = \" <<HL_DATA_DIR<< \"\\n\";\n#endif\n#ifdef HL_CONFIG_DIR\n    cout << \"Compiler directive HL_CONFIG_DIR = \" <<HL_CONFIG_DIR<< \"\\n\";\n#endif\n    cout << endl;\n}\n\nint HighliterAndroid::printInstalledLanguages() {\n    vector <string> filePaths;\n    string wildcard = \"*.lang\";\n    string directory = dataDir.getLangPath();\n    string searchDir = directory + wildcard;\n\n    bool directoryOK = Platform::getDirectoryEntries(filePaths, searchDir,\n                                                     true);\n    if (!directoryOK) {\n        cerr << \"highlight: Could not access directory \" << searchDir\n        << \", aborted.\\n\";\n        return EXIT_FAILURE;\n    }\n\n    sort(filePaths.begin(), filePaths.end());\n    string suffix, desc;\n    cout << \"\\nInstalled language definitions\" << \" (located in \" << directory\n    << \"):\\n\\n\";\n\n    for (unsigned int i = 0; i < filePaths.size(); i++) {\n        Diluculum::LuaState ls;\n        highlight::SyntaxReader::initLuaState(ls, filePaths[i], \"\");\n        ls.doFile(filePaths[i]);\n        desc = ls[\"Description\"].value().asString();\n        suffix = (filePaths[i]).substr(directory.length());\n        suffix = suffix.substr(1, suffix.length() - wildcard.length());\n        cout << setw(30) << setiosflags(ios::left) << desc << \": \" << suffix;\n        int extCnt = 0;\n        for (StringMap::iterator it = extensions.begin();\n             it != extensions.end(); it++) {\n            if (it->second == suffix) {\n                cout << ((++extCnt == 1) ? \" ( \" : \" \") << it->first;\n            }\n        }\n        cout << ((extCnt) ? \" )\" : \"\") << endl;\n    }\n    cout << \"\\nUse name of the desired language\"\n    << \" with the --\"\n    OPT_SYNTAX\n    \" option.\\n\" << endl;\n    return EXIT_SUCCESS;\n}\n\nstring HighliterAndroid::getFileSuffix(const string &fileName) {\n    size_t ptPos = fileName.rfind(\".\");\n    size_t psPos = fileName.rfind(Platform::pathSeparator);\n    if (ptPos == string::npos) {\n        return (psPos == string::npos) ?\n               fileName : fileName.substr(psPos + 1, fileName.length());\n    }\n    //return (ptPos == string::npos || (psPos!=string::npos && psPos>ptPos)) ? \"\" : fileName.substr(ptPos+1, fileName.length());\n    return (psPos != string::npos && psPos > ptPos) ?\n           \"\" : fileName.substr(ptPos + 1, fileName.length());\n\n}\n\nvector <string> HighliterAndroid::collectPluginPaths(\n        const vector <string> &plugins) {\n    vector <string> absolutePaths;\n    for (unsigned int i = 0; i < plugins.size(); i++) {\n        if (Platform::fileExists(plugins[i])) {\n            absolutePaths.push_back(plugins[i]);\n        } else {\n            absolutePaths.push_back(dataDir.getPluginPath(plugins[i] + \".lua\"));\n        }\n    }\n    return absolutePaths;\n}\n\nbool HighliterAndroid::loadFileTypeConfig(const string &name, StringMap *extMap,\n                                          StringMap *shebangMap) {\n    if (!extMap || !shebangMap)\n        return false;\n\n    //  string confPath=dataDir.getConfDir() + name + \".conf\";\n    string confPath = dataDir.getFiletypesConfPath(name);\n    try {\n        Diluculum::LuaState ls;\n        Diluculum::LuaValueList ret = ls.doFile(confPath);\n\n        int idx = 1;\n        string langName;\n        Diluculum::LuaValue mapEntry;\n        while ((mapEntry = ls[\"FileMapping\"][idx].value()) != Diluculum::Nil) {\n            langName = mapEntry[\"Lang\"].asString();\n            if (mapEntry[\"Extensions\"] != Diluculum::Nil) {\n                int extIdx = 1;\n                while (mapEntry[\"Extensions\"][extIdx] != Diluculum::Nil) {\n                    extMap->insert(\n                            make_pair(mapEntry[\"Extensions\"][extIdx].asString(),\n                                      langName));\n                    extIdx++;\n                }\n            } else if (mapEntry[\"Shebang\"] != Diluculum::Nil) {\n                shebangMap->insert(\n                        make_pair(mapEntry[\"Shebang\"].asString(), langName));\n            }\n            idx++;\n        }\n\n    } catch (Diluculum::LuaError err) {\n        cerr << err.what() << \"\\n\";\n        return false;\n    }\n    return true;\n}\n"
  },
  {
    "path": "jni/highlight/android/app.h",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef HIGHLIGHT_APP\n#define HIGHLIGHT_APP\n\n#include <iostream>\n#include <fstream>\n#include <string>\n#include <vector>\n#include <map>\n#include <iomanip>\n#include <cassert>\n#include <memory>\n\n#include \"cmdlineoptions.h\"\n#include \"datadir.h\"\n#include \"codegenerator.h\"\n\n\n\n#include \"../include/codegenerator.h\"\n\nusing namespace std;\nusing namespace highlight;\n\n\n#define EXIT_FAILURE 1\n#define EXIT_SUCCESS 0\n\n\n#define IO_ERROR_REPORT_LENGTH 5\n#define SHEBANG_CNT 12\n\n\n#if ANDROID\n\t#include <android/log.h>\n\t#ifndef TAG_NAME\n\t\t#define TAG_NAME \"highliter\"\n\t#endif\n\t#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, TAG_NAME, __VA_ARGS__))\n\t#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, TAG_NAME, __VA_ARGS__))\n\t#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, TAG_NAME, __VA_ARGS__))\n\t#define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, TAG_NAME, __VA_ARGS__))\n#else\n\t#define LOGI(...)\n\t#define LOGW(...)\n\t#define LOGE(...)\n#endif\n\n\n/* DO NOT EDIT THIS FILE - it is machine generated */\n#include <jni.h>\n/* Header for class org_evilbinary_highliter_parsers_SyntaxHighlight */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nJNIEXPORT jint JNICALL Java_org_evilbinary_highliter_parsers_SyntaxHighlight_init\n  (JNIEnv *, jobject,jstring);\n\n\nJNIEXPORT jstring JNICALL Java_org_evilbinary_highliter_parsers_SyntaxHighlight_pase(\n\t\tJNIEnv *env, jobject obj, jstring code);\n\n\n\n#ifdef __cplusplus\n}\n#endif\n\ntypedef map<string, string> StringMap;\n\nclass HighliterAndroid {\n\nprivate:\n\tDataDir dataDir;\n\tStringMap extensions;\n\tStringMap scriptShebangs;\n\tstringstream cin_bufcopy;\n\tCmdLineOptions options;\n\thighlight::CodeGenerator* generator;\n\tvector<string> inFileList;\n\n\tbool formattingEnabled;\n\tbool styleFileWanted;\n\npublic:\n\tHighliterAndroid();\n\n\tint init(string dataDirPath);\n\tvoid destroy();\n\tint parse(string content, vector<Object> &out);\n\n\t/** print version info*/\n\tvoid printVersionInfo();\n\n\t/** print configuration info*/\n\tvoid printConfigInfo();\n\n\t/** print error message*/\n\tvoid printBadInstallationInfo();\n\n\t/** print input and output errors */\n\tvoid printIOErrorReport(unsigned int numberErrorFiles,\n\t\t\tvector<string> & fileList, const string &action);\n\n\t/** list installed  files\n\t \\return true if files were found\n\t */\n\tint printInstalledFiles(const string& where, const string& wildcard,\n\t\t\tconst string& what, const string&option);\n\n\t/** list installed language definition files\n\t \\return true if lang files were found\n\t */\n\tint printInstalledLanguages();\n\n\t/** print debug information\n\t \\param  lang language definition\n\t \\param langDefPath path to language definition\n\t */\n\tvoid printDebugInfo(const highlight::SyntaxReader *lang,\n\t\t\tconst string &langDefPath);\n\n\tstring getFileSuffix(const string &fileName);\n\n\tstring guessFileType(const string &suffix, const string &inputFile = \"\",\n\t\t\tbool useUserSuffix = false);\n\n\tint getNumDigits(int i);\n\n\tvoid printProgressBar(int total, int count);\n\tvoid printCurrentAction(const string&outfilePath, int total, int count,\n\t\t\tint countWidth);\n\n\tbool readInputFilePaths(vector<string> &fileList, string wildcard,\n\t\t\tbool recursiveSearch);\n\n\tstring analyzeFile(const string& file);\n\tbool loadFileTypeConfig(const string& name, StringMap* map,\n\t\t\tStringMap* shebangMap);\n\tvoid printInstalledFiles();\n\n\tvector<string> collectPluginPaths(const vector<string>& plugins);\n\n};\n\n#endif\n"
  },
  {
    "path": "jni/highlight/cli/arg_parser.cc",
    "content": "/*  Arg_parser - A POSIX/GNU command line argument parser.\n    Copyright (C) 2006, 2007, 2008 Antonio Diaz Diaz.\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n#include <cstring>\n#include <string>\n#include <vector>\n\n#include \"arg_parser.h\"\n\n\nbool Arg_parser::parse_long_option( const char * const opt, const char * const arg,\n                                    const Option options[], int & argind ) throw()\n  {\n  unsigned int len;\n  int index = -1;\n  bool exact = false, ambig = false;\n\n  for( len = 0; opt[len+2] && opt[len+2] != '='; ++len ) ;\n\n  // Test all long options for either exact match or abbreviated matches.\n  for( int i = 0; options[i].code != 0; ++i )\n    if( options[i].name && !std::strncmp( options[i].name, &opt[2], len ) )\n      {\n      if( std::strlen( options[i].name ) == len )\t// Exact match found\n        { index = i; exact = true; break; }\n      else if( index < 0 ) index = i;\t\t// First nonexact match found\n      else if( options[index].code != options[i].code ||\n               options[index].has_arg != options[i].has_arg )\n        ambig = true;\t\t\t// Second or later nonexact match found\n      }\n\n  if( ambig && !exact )\n    {\n    _error = \"option `\"; _error += opt; _error += \"' is ambiguous\";\n    return false;\n    }\n\n  if( index < 0 )\t\t// nothing found\n    {\n    _error = \"unrecognized option `\"; _error += opt; _error += '\\'';\n    return false;\n    }\n\n  ++argind;\n  data.push_back( Record( options[index].code ) );\n\n  if( opt[len+2] )\t\t// `--<long_option>=<argument>' syntax\n    {\n    if( options[index].has_arg == no )\n      {\n      _error = \"option `--\"; _error += options[index].name;\n      _error += \"' doesn't allow an argument\";\n      return false;\n      }\n    if( options[index].has_arg == yes && !opt[len+3] )\n      {\n      _error = \"option `--\"; _error += options[index].name;\n      _error += \"' requires an argument\";\n      return false;\n      }\n    data.back().argument = &opt[len+3];\n    return true;\n    }\n\n  if( options[index].has_arg == yes )\n    {\n    if( !arg )\n      {\n      _error = \"option `--\"; _error += options[index].name;\n      _error += \"' requires an argument\";\n      return false;\n      }\n    ++argind; data.back().argument = arg;\n    return true;\n    }\n\n  return true;\n  }\n\n\nbool Arg_parser::parse_short_option( const char * const opt, const char * const arg,\n                                     const Option options[], int & argind ) throw()\n  {\n  int cind = 1;\t\t\t// character index in opt\n\n  while( cind > 0 )\n    {\n    int index = -1;\n    const unsigned char code = opt[cind];\n\n    if( code != 0 )\n      for( int i = 0; options[i].code; ++i )\n        if( code == options[i].code )\n          { index = i; break; }\n\n    if( index < 0 )\n      {\n      _error = \"invalid option -- \"; _error += code;\n      return false;\n      }\n\n    data.push_back( Record( code ) );\n    if( opt[++cind] == 0 ) { ++argind; cind = 0; }\t// opt finished\n\n    if( options[index].has_arg != no && cind > 0 && opt[cind] )\n      {\n      data.back().argument = &opt[cind]; ++argind; cind = 0;\n      }\n    else if( options[index].has_arg == yes )\n      {\n      if( !arg || !arg[0] )\n        {\n        _error = \"option requires an argument -- \"; _error += code;\n        return false;\n        }\n      data.back().argument = arg; ++argind; cind = 0;\n      }\n    }\n  return true;\n  }\n\n\nArg_parser::Arg_parser( const int argc, const char * const argv[],\n                        const Option options[], const bool in_order ) throw()\n  {\n  if( argc < 2 || !argv || !options ) return;\n\n  std::vector< std::string > non_options;\t// skipped non-options\n  int argind = 1;\t\t\t\t// index in argv\n\n  while( argind < argc )\n    {\n    const unsigned char ch1 = argv[argind][0];\n    const unsigned char ch2 = ( ch1 ? argv[argind][1] : 0 );\n\n    if( ch1 == '-' && ch2 )\t\t// we found an option\n      {\n      const char * const opt = argv[argind];\n      const char * const arg = (argind + 1 < argc) ? argv[argind+1] : 0;\n      if( ch2 == '-' )\n        {\n        if( !argv[argind][2] ) { ++argind; break; }\t// we found \"--\"\n        else if( !parse_long_option( opt, arg, options, argind ) ) break;\n        }\n      else if( !parse_short_option( opt, arg, options, argind ) ) break;\n      }\n    else\n      {\n      if( !in_order ) non_options.push_back( argv[argind++] );\n      else { data.push_back( Record() ); data.back().argument = argv[argind++]; }\n      }\n    }\n  if( _error.size() ) data.clear();\n  else\n    {\n    for( unsigned int i = 0; i < non_options.size(); ++i )\n      { data.push_back( Record() ); data.back().argument.swap( non_options[i] ); }\n    while( argind < argc )\n      { data.push_back( Record() ); data.back().argument = argv[argind++]; }\n    }\n  }\n\n\nArg_parser::Arg_parser( const char * const opt, const char * const arg,\n                        const Option options[] ) throw()\n  {\n  if( !opt || !opt[0] || !options ) return;\n\n  if( opt[0] == '-' && opt[1] )\t\t// we found an option\n    {\n    int argind = 1;\t\t\t// dummy\n    if( opt[1] == '-' )\n      { if( opt[2] ) parse_long_option( opt, arg, options, argind ); }\n    else\n      parse_short_option( opt, arg, options, argind );\n    if( _error.size() ) data.clear();\n    }\n  else { data.push_back( Record() ); data.back().argument = opt; }\n  }\n"
  },
  {
    "path": "jni/highlight/cli/arg_parser.h",
    "content": "/*  Arg_parser - A POSIX/GNU command line argument parser.\n    Copyright (C) 2006, 2007, 2008 Antonio Diaz Diaz.\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n/*  Arg_parser reads the arguments in `argv' and creates a number of\n    option codes, option arguments and non-option arguments.\n\n    In case of error, `error' returns a non-empty error message.\n\n    `options' is an array of `struct Option' terminated by an element\n    containing a code which is zero. A null name means a short-only\n    option. A code value outside the unsigned char range means a\n    long-only option.\n\n    Arg_parser normally makes it appear as if all the option arguments\n    were specified before all the non-option arguments for the purposes\n    of parsing, even if the user of your program intermixed option and\n    non-option arguments. If you want the arguments in the exact order\n    the user typed them, call `Arg_parser' with `in_order' = true.\n\n    The argument `--' terminates all options; any following arguments are\n    treated as non-option arguments, even if they begin with a hyphen.\n\n    The syntax for optional option arguments is `-<short_option><argument>'\n    (without whitespace), or `--<long_option>=<argument>'.\n*/\n\nclass Arg_parser\n{\n\tpublic:\n\t\tenum Has_arg { no, yes, maybe };\n\n\t\tstruct Option\n\t\t{\n\t\t\tint code;\t\t\t// Short option letter or code ( code != 0 )\n\t\t\tconst char * name;\t\t// Long option name (maybe null)\n\t\t\tHas_arg has_arg;\n\t\t};\n\n\tprivate:\n\t\tstruct Record\n\t\t{\n\t\t\tint code;\n\t\t\tstd::string argument;\n\t\t\tRecord ( const int c = 0 ) : code ( c ) {}\n\t\t};\n\n\t\tstd::string _error;\n\t\tstd::vector< Record > data;\n\n\t\tbool parse_long_option ( const char * const opt, const char * const arg,\n\t\t                         const Option options[], int & argind ) throw();\n\t\tbool parse_short_option ( const char * const opt, const char * const arg,\n\t\t                          const Option options[], int & argind ) throw();\n\n\tpublic:\n\t\tArg_parser ( const int argc, const char * const argv[],\n\t\t             const Option options[], const bool in_order = false ) throw();\n\n\t\t// Restricted constructor. Parses a single token and argument (if any)\n\t\tArg_parser ( const char * const opt, const char * const arg,\n\t\t             const Option options[] ) throw();\n\n\t\tconst std::string & error() const throw() { return _error; }\n\n\t\t// The number of arguments parsed (may be different from argc)\n\t\tint arguments() const throw() { return data.size(); }\n\n\t\t// If code( i ) is 0, argument( i ) is a non-option.\n\t\t// Else argument( i ) is the option's argument (or empty).\n\t\tint code ( const int i ) const throw()\n\t\t{\n\t\t\tif ( i >= 0 && i < arguments() ) return data[i].code;\n\t\t\telse return 0;\n\t\t}\n\n\t\tconst std::string & argument ( const int i ) const throw()\n\t\t{\n\t\t\tif ( i >= 0 && i < arguments() ) return data[i].argument;\n\t\t\telse return _error;\n\t\t}\n};\n"
  },
  {
    "path": "jni/highlight/cli/cmdlineoptions.cpp",
    "content": "/***************************************************************************\n cmdlineoptions.cpp  -  description\n -------------------\n begin                : Sun Nov 25 2001\n copyright            : (C) 2001-2010 by Andre Simon\n email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n/*\n This file is part of Highlight.\n\n Highlight is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n Highlight is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"cmdlineoptions.h\"\n#include \"platform_fs.h\"\n#include \"datadir.h\"\n#include <sstream>\n#include <cstdio>\n\n#include \"arg_parser.h\"\n\nusing namespace std;\n\nCmdLineOptions::CmdLineOptions() :\n\t\tnumberSpaces(0), lineNrWidth(5), lineLength(80), lineNrStart(1), wrappingStyle(\n\t\t\t\thighlight::WRAP_DISABLED), outputType(highlight::HTML), keywordCase(\n\t\t\t\tStringTools::CASE_UNCHANGED), baseFontSize(\"10\"), className(\n\t\t\t\t\"hl\"), opt_syntax(false), opt_include_style(false), opt_help(\n\t\t\t\tfalse), opt_version(false), opt_verbose(false), opt_print_config(\n\t\t\t\tfalse), opt_linenumbers(false), opt_style(false), opt_batch_mode(\n\t\t\t\tfalse), opt_fragment(false), opt_attach_line_anchors(false), opt_show_themes(\n\t\t\t\tfalse), opt_show_langdefs(false), opt_show_plugins(false), opt_printindex(\n\t\t\t\tfalse), opt_quiet(false), opt_replacequotes(false), opt_babel(\n\t\t\t\tfalse), opt_print_progress(false), opt_fill_zeroes(false), opt_stylepath_explicit(\n\t\t\t\tfalse), opt_force_output(false), opt_ordered_list(false), opt_fnames_as_anchors(\n\t\t\t\tfalse), opt_validate(false), opt_number_wrapped_lines(true), //before the patch, this was always true, so by default it stays true.\n\t\topt_inline_css(false), opt_enclose_pre(false), opt_char_styles(false), opt_pretty_symbols(\n\t\t\t\tfalse), opt_delim_CR(false), opt_print_style(false), opt_no_trailing_nl(\n\t\t\t\tfalse), anchorPrefix(\"l\"), helpLang(\"en\"), encodingName(\n\t\t\t\t\"ISO-8859-1\") {\n\tLOGI(\"CmdLineOptions construct\");\n}\n\nCmdLineOptions::CmdLineOptions(const int argc, const char *argv[]) :\n\t\tnumberSpaces(0), lineNrWidth(5), lineLength(80), lineNrStart(1), wrappingStyle(\n\t\t\t\thighlight::WRAP_DISABLED), outputType(highlight::HTML), keywordCase(\n\t\t\t\tStringTools::CASE_UNCHANGED), baseFontSize(\"10\"), className(\n\t\t\t\t\"hl\"), opt_syntax(false), opt_include_style(false), opt_help(\n\t\t\t\tfalse), opt_version(false), opt_verbose(false), opt_print_config(\n\t\t\t\tfalse), opt_linenumbers(false), opt_style(false), opt_batch_mode(\n\t\t\t\tfalse), opt_fragment(false), opt_attach_line_anchors(false), opt_show_themes(\n\t\t\t\tfalse), opt_show_langdefs(false), opt_show_plugins(false), opt_printindex(\n\t\t\t\tfalse), opt_quiet(false), opt_replacequotes(false), opt_babel(\n\t\t\t\tfalse), opt_print_progress(false), opt_fill_zeroes(false), opt_stylepath_explicit(\n\t\t\t\tfalse), opt_force_output(false), opt_ordered_list(false), opt_fnames_as_anchors(\n\t\t\t\tfalse), opt_validate(false), opt_number_wrapped_lines(true), //before the patch, this was always true, so by default it stays true.\n\t\topt_inline_css(false), opt_enclose_pre(false), opt_char_styles(false), opt_pretty_symbols(\n\t\t\t\tfalse), opt_delim_CR(false), opt_print_style(false), opt_no_trailing_nl(\n\t\t\t\tfalse), anchorPrefix(\"l\"), helpLang(\"en\"), encodingName(\n\t\t\t\t\"ISO-8859-1\") {\n\tenum Optcode {\n\t\tS_OPT_ENCLOSE_PRE = 256,\n\t\tS_OPT_FORCE_OUTPUT,\n\t\tS_OPT_INLINE_CSS,\n\t\tS_OPT_KW_CASE,\n\t\tS_OPT_PRINT_CONFIG,\n\t\tS_OPT_TEST_INPUT,\n\t\tS_OPT_NO_NUMBER_WL,\n\t\tS_OPT_SVG_WIDTH,\n\t\tS_OPT_SVG_HEIGHT,\n\t\tS_OPT_CLASSNAME,\n\t\tS_OPT_RTF_CHAR_STYLES,\n\t\tS_OPT_SKIP_UNKNOWN,\n\t\tS_OPT_COMPAT_DOC,\n\t\tS_OPT_COMPAT_NODOC,\n\t\tS_OPT_COMPAT_TAB,\n\t\tS_OPT_COMPAT_CSS,\n\t\tS_OPT_COMPAT_OUTDIR,\n\t\tS_OPT_COMPAT_FAILSAFE,\n\t\tS_OPT_COMPAT_SRCLANG,\n\t\tS_OPT_COMPAT_LINENUM,\n\t\tS_OPT_COMPAT_LINEREF,\n\t\tS_OPT_PRETTY_SYMBOLS,\n\t\tS_OPT_EOL_DELIM_CR,\n\t\tS_OPT_START_NESTED,\n\t\tS_OPT_PRINT_STYLE,\n\t\tS_OPT_NO_TRAILING_NL,\n\t\tS_OPT_PLUGIN,\n\t\tS_OPT_ABS_CFG_PATH,\n\t\tS_OPT_PLUGIN_READFILE,\n\t\tS_LIST_SCRIPTS\n\t};\n\n\tconst Arg_parser::Option options[] = { { 'a', OPT_ANCHORS, Arg_parser::no },\n\t\t\t{ 'b', OPT_BABEL, Arg_parser::no }, { 'B', OPT_BATCHREC,\n\t\t\t\t\tArg_parser::yes }, { 'c', OPT_STYLE_OUT, Arg_parser::yes },\n\t\t\t{ 'C', OPT_INDEXFILE, Arg_parser::no }, { 'd', OPT_OUTDIR,\n\t\t\t\t\tArg_parser::yes }, { 'D', OPT_DATADIR, Arg_parser::yes }, {\n\t\t\t\t\t'e', OPT_STYLE_IN, Arg_parser::yes }, { 'f', OPT_FRAGMENT,\n\t\t\t\t\tArg_parser::no }, { 'F', OPT_FORMAT, Arg_parser::yes },\n\n\t\t\t{ 'h', OPT_HELP, Arg_parser::no }, { 'i', OPT_IN, Arg_parser::yes },\n\t\t\t{ 'I', OPT_INC_STYLE, Arg_parser::no }, { 'j', OPT_LNR_LEN,\n\t\t\t\t\tArg_parser::yes }, { 'J', OPT_LINE_LEN, Arg_parser::yes }, {\n\t\t\t\t\t'k', OPT_BASE_FONT, Arg_parser::yes }, { 'K',\n\t\t\t\t\tOPT_BASE_FONT_SIZE, Arg_parser::yes }, { 'l', OPT_LINENO,\n\t\t\t\t\tArg_parser::no }, { 'm', OPT_LNR_START, Arg_parser::yes }, {\n\t\t\t\t\t'n', OPT_ORDERED_LIST, Arg_parser::no }, { 'N',\n\t\t\t\t\tOPT_ANCHOR_FN, Arg_parser::no }, { 'o', OPT_OUT,\n\t\t\t\t\tArg_parser::yes }, { 'O', OPT_OUTFORMAT, Arg_parser::yes },\n\t\t\t{ 'p', OPT_LISTLANGS, Arg_parser::no }, { 'P', OPT_PROGRESSBAR,\n\t\t\t\t\tArg_parser::no }, { 'q', OPT_QUIET, Arg_parser::no }, { 'Q',\n\t\t\t\t\tOPT_VERSION, Arg_parser::no }, { 'r', OPT_REPLACE_QUOTES,\n\t\t\t\t\tArg_parser::no }, { 's', OPT_STYLE, Arg_parser::yes }, {\n\t\t\t\t\t'S', OPT_SYNTAX, Arg_parser::yes }, { 't', OPT_DELTABS,\n\t\t\t\t\tArg_parser::yes }, { 'T', OPT_DOC_TITLE, Arg_parser::yes },\n\t\t\t{ 'u', OPT_ENCODING, Arg_parser::yes }, { 'v', OPT_VERBOSE,\n\t\t\t\t\tArg_parser::no }, { 'V', OPT_WRAPSIMPLE, Arg_parser::no }, {\n\t\t\t\t\t'w', OPT_LISTTHEMES, Arg_parser::no }, { 'W', OPT_WRAP,\n\t\t\t\t\tArg_parser::no },\n\t\t\t{ 'x', OPT_RTF_PAGE_SIZE, Arg_parser::yes }, { 'y', OPT_ANCHOR_PFX,\n\t\t\t\t\tArg_parser::yes }, { 'z', OPT_FILLZEROES, Arg_parser::no },\n\n\t\t\t{ S_OPT_CLASSNAME, OPT_CLASSNAME, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_SVG_WIDTH, OPT_SVG_WIDTH, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_SVG_HEIGHT, OPT_SVG_HEIGHT, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_ENCLOSE_PRE, OPT_ENCLOSE_PRE, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_FORCE_OUTPUT, OPT_FORCE_OUTPUT, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_INLINE_CSS, OPT_INLINE_CSS, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_KW_CASE, OPT_KW_CASE, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_PRINT_CONFIG, OPT_PRINT_CONFIG, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_TEST_INPUT, OPT_TEST_INPUT, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_NO_NUMBER_WL, OPT_NO_NUMBER_WL, Arg_parser::no },\n\t\t\t{ S_OPT_RTF_CHAR_STYLES, OPT_RTF_CHAR_STYLES, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_SKIP_UNKNOWN, OPT_SKIP_UNKNOWN, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_START_NESTED, OPT_START_NESTED, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_COMPAT_DOC, OPT_COMPAT_DOC, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_COMPAT_NODOC, OPT_COMPAT_NODOC, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_COMPAT_TAB, OPT_COMPAT_TAB, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_COMPAT_CSS, OPT_COMPAT_CSS, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_COMPAT_OUTDIR, OPT_COMPAT_OUTDIR, Arg_parser::yes },\n\t\t\t{ S_OPT_COMPAT_FAILSAFE, OPT_COMPAT_FAILSAFE, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_COMPAT_SRCLANG, OPT_COMPAT_SRCLANG, Arg_parser::yes },\n\t\t\t{ S_OPT_COMPAT_LINENUM, OPT_COMPAT_LINENUM, Arg_parser::maybe },\n\t\t\t{ S_OPT_COMPAT_LINEREF, OPT_COMPAT_LINEREF, Arg_parser::maybe }, {\n\t\t\t\t\tS_OPT_PRETTY_SYMBOLS, OPT_PRETTY_SYMBOLS, Arg_parser::no },\n\t\t\t{ S_OPT_EOL_DELIM_CR, OPT_EOL_DELIM_CR, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_PRINT_STYLE, OPT_PRINT_STYLE, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_NO_TRAILING_NL, OPT_NO_TRAILING_NL, Arg_parser::no },\n\t\t\t{ S_OPT_PLUGIN, OPT_PLUGIN, Arg_parser::yes },\n\t\t\t{ S_OPT_PLUGIN_READFILE, OPT_PLUGIN_READFILE, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_ABS_CFG_PATH, OPT_ABS_CFG_PATH, Arg_parser::yes }, {\n\t\t\t\t\tS_LIST_SCRIPTS, OPT_LIST_SCRIPTS, Arg_parser::yes },\n\n\t\t\t{ 0, 0, Arg_parser::no } };\n\n\tArg_parser parser(argc, argv, options);\n\tif (parser.error().size()) // bad option\n\t{\n\t\tcerr << \"highlight: \" << parser.error() << \"\\n\";\n\t\tcerr << \"Try `highlight --help' for more information.\\n\";\n\t\texit(1);\n\t}\n\n\tint argind = 0;\n\tfor (; argind < parser.arguments(); ++argind) {\n\t\tconst int code = parser.code(argind);\n\t\tconst std::string & arg = parser.argument(argind);\n\t\tif (!code)\n\t\t\tbreak; // no more options\n\t\tswitch (code) {\n\t\tcase 'O': {\n\t\t\tconst string tmp = StringTools::change_case(arg);\n\t\t\tif(tmp==\"object\")\n\t\t\t\toutputType=highlight::OBJECT;\n\t\t\telse if (tmp == \"xhtml\")\n\t\t\t\toutputType = highlight::XHTML;\n\t\t\telse if (tmp == \"tex\")\n\t\t\t\toutputType = highlight::TEX;\n\t\t\telse if (tmp == \"latex\")\n\t\t\t\toutputType = highlight::LATEX;\n\t\t\telse if (tmp == \"rtf\")\n\t\t\t\toutputType = highlight::RTF;\n\t\t\telse if (tmp == \"ansi\" || tmp == \"esc\") // gnu source-highlight esc parameter\n\t\t\t\toutputType = highlight::ANSI;\n\t\t\telse if (tmp == \"xterm256\")\n\t\t\t\toutputType = highlight::XTERM256;\n\t\t\telse if (tmp == \"svg\")\n\t\t\t\toutputType = highlight::SVG;\n\t\t\telse if (tmp == \"bbcode\")\n\t\t\t\toutputType = highlight::BBCODE;\n\t\t\telse if (tmp == \"pango\")\n\t\t\t\toutputType = highlight::PANGO;\n\t\t\telse if (tmp == \"odt\")\n\t\t\t\toutputType = highlight::ODTFLAT;\n\t\t\telse\n\t\t\t\toutputType = highlight::HTML;\n\t\t}\n\t\t\tbreak;\n\t\tcase 'a':\n\t\t\topt_attach_line_anchors = true;\n\t\t\tbreak;\n\t\tcase 'b':\n\t\t\topt_babel = true;\n\t\t\tbreak;\n\t\tcase 'B':\n\t\t\topt_batch_mode = true;\n\t\t\treadDirectory(arg);\n\t\t\tbreak;\n\t\tcase 'c':\n\t\tcase S_OPT_COMPAT_CSS:\n\t\t\tstyleOutFilename = arg;\n\t\t\topt_stylepath_explicit = true;\n\t\t\tbreak;\n\t\tcase 'C':\n\t\t\topt_printindex = true;\n\t\t\tbreak;\n\t\tcase 'T':\n\t\t\tdocTitle = arg;\n\t\t\tbreak;\n\t\tcase 'D':\n\t\t\tdataDir = validateDirPath(arg);\n\t\t\tbreak;\n\t\tcase 'e':\n\t\t\tstyleInFilename = arg;\n\t\t\tbreak;\n\t\tcase 'f':\n\t\tcase S_OPT_COMPAT_NODOC:\n\t\t\topt_fragment = true;\n\t\t\tbreak;\n\t\tcase 'F':\n\t\t\tindentScheme = arg;\n\t\t\tbreak;\n\t\tcase S_OPT_CLASSNAME:\n\t\t\tclassName = arg;\n\t\t\tbreak;\n\t\tcase 'h':\n\t\t\topt_help = true;\n\t\t\tbreak;\n\t\tcase 'i':\n\t\t\tinputFileNames.push_back(arg);\n\t\t\tbreak;\n\t\tcase 'I':\n\t\t\topt_include_style = true;\n\t\t\tbreak;\n\t\tcase 'j':\n\t\t\tStringTools::str2num<int>(lineNrWidth, arg, std::dec);\n\t\t\tbreak;\n\t\tcase 'J':\n\t\t\tStringTools::str2num<int>(lineLength, arg, std::dec);\n\t\t\tbreak;\n\t\tcase 'k':\n\t\t\tbaseFont = arg;\n\t\t\tbreak;\n\t\tcase 'K':\n\t\t\tbaseFontSize = arg;\n\t\t\tbreak;\n\t\tcase S_OPT_COMPAT_LINENUM:\n\t\t\tif (arg == \"0\")\n\t\t\t\topt_fill_zeroes = true;\n\t\tcase 'l':\n\t\t\topt_linenumbers = true;\n\t\t\tbreak;\n\t\tcase 'm':\n\t\t\tStringTools::str2num<int>(lineNrStart, arg, std::dec);\n\t\t\tbreak;\n\t\tcase 'M':\n\t\t\toutputType = highlight::XTERM256;\n\t\t\tbreak;\n\t\tcase 'n':\n\t\t\topt_ordered_list = opt_linenumbers = true;\n\t\t\tbreak;\n\t\tcase 'N':\n\t\t\topt_fnames_as_anchors = true;\n\t\t\tbreak;\n\t\tcase 'o':\n\t\t\toutFilename = arg;\n\t\t\tbreak;\n\t\tcase 'd':\n\t\tcase S_OPT_COMPAT_OUTDIR:\n\t\t\toutDirectory = validateDirPath(arg);\n\t\t\tbreak;\n\t\tcase 'p':\n\t\t\topt_show_langdefs = true;\n\t\t\tbreak;\n\t\tcase 'P':\n\t\t\topt_print_progress = true;\n\t\t\tbreak;\n\t\tcase 'q':\n\t\t\topt_quiet = true;\n\t\t\tbreak;\n\t\tcase 'Q':\n\t\t\topt_version = true;\n\t\t\tbreak;\n\t\tcase 'r':\n\t\t\topt_replacequotes = true;\n\t\t\tbreak;\n\t\tcase 's':\n\t\t\tstyleName = arg;\n\t\t\topt_style = true;\n\t\t\tbreak;\n\t\tcase 'S':\n\t\tcase S_OPT_COMPAT_SRCLANG:\n\t\t\tsyntax = arg;\n\t\t\topt_syntax = true;\n\t\t\tbreak;\n\t\tcase 't':\n\t\tcase S_OPT_COMPAT_TAB:\n\t\t\tStringTools::str2num<int>(numberSpaces, arg, std::dec);\n\t\t\tbreak;\n\t\tcase 'u':\n\t\t\tencodingName = arg;\n\t\t\tbreak;\n\t\tcase 'v':\n\t\t\topt_verbose = true;\n\t\t\tbreak;\n\t\tcase 'V':\n\t\t\twrappingStyle = highlight::WRAP_SIMPLE;\n\t\t\tbreak;\n\t\tcase 'w':\n\t\t\topt_show_themes = true;\n\t\t\tbreak;\n\t\tcase 'W':\n\t\t\twrappingStyle = highlight::WRAP_DEFAULT;\n\t\t\tbreak;\n\t\tcase 'x':\n\t\t\tpageSize = arg;\n\t\t\tbreak;\n\t\tcase 'y':\n\t\t\tanchorPrefix = arg;\n\t\t\tbreak;\n\t\tcase 'z':\n\t\t\topt_fill_zeroes = true;\n\t\t\tbreak;\n\t\tcase S_OPT_SVG_WIDTH:\n\t\t\tsvg_width = arg;\n\t\t\tbreak;\n\t\tcase S_OPT_SVG_HEIGHT:\n\t\t\tsvg_height = arg;\n\t\t\tbreak;\n\t\tcase S_OPT_ENCLOSE_PRE:\n\t\t\topt_enclose_pre = true;\n\t\t\tbreak;\n\t\tcase S_OPT_FORCE_OUTPUT:\n\t\tcase S_OPT_COMPAT_FAILSAFE:\n\t\t\topt_force_output = true;\n\t\t\tbreak;\n\t\tcase S_OPT_INLINE_CSS:\n\t\t\topt_inline_css = true;\n\t\t\tbreak;\n\t\tcase S_OPT_KW_CASE: {\n\t\t\tconst string tmp = StringTools::change_case(arg);\n\t\t\tif (tmp == \"upper\")\n\t\t\t\tkeywordCase = StringTools::CASE_UPPER;\n\t\t\telse if (tmp == \"lower\")\n\t\t\t\tkeywordCase = StringTools::CASE_LOWER;\n\t\t\telse if (tmp == \"capitalize\")\n\t\t\t\tkeywordCase = StringTools::CASE_CAPITALIZE;\n\t\t}\n\t\t\tbreak;\n\n\t\tcase S_OPT_PRINT_CONFIG:\n\t\t\topt_print_config = true;\n\t\t\tbreak;\n\t\tcase S_OPT_TEST_INPUT:\n\t\t\topt_validate = true;\n\t\t\tbreak;\n\t\tcase S_OPT_NO_NUMBER_WL:\n\t\t\topt_number_wrapped_lines = false;\n\t\t\tbreak;\n\t\tcase S_OPT_RTF_CHAR_STYLES:\n\t\t\topt_char_styles = true;\n\t\t\tbreak;\n\t\tcase S_OPT_SKIP_UNKNOWN:\n\t\t\tskipArg = arg;\n\t\t\tbreak;\n\t\tcase S_OPT_PLUGIN:\n\t\t\tuserPlugins.push_back(arg);\n\t\t\tbreak;\n\t\tcase S_OPT_PLUGIN_READFILE:\n\t\t\tpluginReadFilePath = arg;\n\t\t\tbreak;\n\n\t\tcase S_OPT_PRETTY_SYMBOLS:\n\t\t\topt_pretty_symbols = true;\n\t\t\tbreak;\n\t\tcase S_OPT_COMPAT_DOC:\n\t\t\topt_fragment = false;\n\t\t\tbreak;\n\t\tcase S_OPT_COMPAT_LINEREF:\n\t\t\topt_linenumbers = true;\n\t\t\topt_attach_line_anchors = true;\n\t\t\tanchorPrefix = (arg.empty()) ? \"line\" : arg;\n\t\t\tbreak;\n\t\tcase S_OPT_EOL_DELIM_CR:\n\t\t\topt_delim_CR = true;\n\t\t\tbreak;\n\t\tcase S_OPT_START_NESTED:\n\t\t\tstartNestedLang = arg;\n\t\t\tbreak;\n\t\tcase S_OPT_PRINT_STYLE:\n\t\t\topt_print_style = true;\n\t\t\tbreak;\n\t\tcase S_OPT_NO_TRAILING_NL:\n\t\t\topt_no_trailing_nl = true;\n\t\t\tbreak;\n\t\tcase S_OPT_ABS_CFG_PATH:\n\t\t\tif (arg.find(\".lang\") != string::npos) {\n\t\t\t\tabsLangPath = arg;\n\t\t\t\tsyntax = arg.substr(0, arg.find_last_of('.'));\n\t\t\t\topt_syntax = true;\n\t\t\t} else if (arg.find(\".theme\") != string::npos)\n\t\t\t\tabsThemePath = arg;\n\t\t\telse\n\t\t\t\tcerr << \"highlight: unknown config file type\" << endl;\n\t\t\tbreak;\n\t\tcase S_LIST_SCRIPTS:\n\t\t\topt_show_themes = (arg == \"themes\");\n\t\t\topt_show_plugins = (arg == \"plugins\");\n\t\t\topt_show_langdefs = !(opt_show_themes && opt_show_plugins);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tcerr << \"highlight: option parsing failed\" << endl;\n\t\t}\n\t}\n\n\tif (argind < parser.arguments()) //still args left\n\t\t\t{\n\t\tif (inputFileNames.empty()) {\n\t\t\twhile (argind < parser.arguments()) {\n\t\t\t\tinputFileNames.push_back(parser.argument(argind++));\n\t\t\t}\n\t\t}\n\t} else if (inputFileNames.empty()) {\n\t\tinputFileNames.push_back(\"\");\n\t}\n\n\tif (skipArg.size()) {\n\t\tistringstream valueStream;\n\t\tstring elem;\n\t\tstring wildcard;\n\t\tvalueStream.str(\n\t\t\t\tStringTools::change_case(skipArg, StringTools::CASE_LOWER));\n\n\t\twhile (getline(valueStream, elem, ';')) {\n\t\t\tignoredFileTypes.insert(elem);\n\t\t}\n\t\tfor (vector<string>::iterator file = inputFileNames.begin();\n\t\t\t\tfile != inputFileNames.end(); file++) {\n\t\t\tfor (set<string>::iterator ext = ignoredFileTypes.begin();\n\t\t\t\t\text != ignoredFileTypes.end(); ext++) {\n\t\t\t\twildcard = \"*.\" + *ext;\n\t\t\t\tif (Platform::wildcmp(wildcard.c_str(), (*file).c_str())) {\n\t\t\t\t\tinputFileNames.erase(file);\n\t\t\t\t\tfile--;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid CmdLineOptions::init(const int argc, const char *argv[]) {\n\tLOGI(\"cmdoptions init\");\n\n\tenum Optcode {\n\t\tS_OPT_ENCLOSE_PRE = 256,\n\t\tS_OPT_FORCE_OUTPUT,\n\t\tS_OPT_INLINE_CSS,\n\t\tS_OPT_KW_CASE,\n\t\tS_OPT_PRINT_CONFIG,\n\t\tS_OPT_TEST_INPUT,\n\t\tS_OPT_NO_NUMBER_WL,\n\t\tS_OPT_SVG_WIDTH,\n\t\tS_OPT_SVG_HEIGHT,\n\t\tS_OPT_CLASSNAME,\n\t\tS_OPT_RTF_CHAR_STYLES,\n\t\tS_OPT_SKIP_UNKNOWN,\n\t\tS_OPT_COMPAT_DOC,\n\t\tS_OPT_COMPAT_NODOC,\n\t\tS_OPT_COMPAT_TAB,\n\t\tS_OPT_COMPAT_CSS,\n\t\tS_OPT_COMPAT_OUTDIR,\n\t\tS_OPT_COMPAT_FAILSAFE,\n\t\tS_OPT_COMPAT_SRCLANG,\n\t\tS_OPT_COMPAT_LINENUM,\n\t\tS_OPT_COMPAT_LINEREF,\n\t\tS_OPT_PRETTY_SYMBOLS,\n\t\tS_OPT_EOL_DELIM_CR,\n\t\tS_OPT_START_NESTED,\n\t\tS_OPT_PRINT_STYLE,\n\t\tS_OPT_NO_TRAILING_NL,\n\t\tS_OPT_PLUGIN,\n\t\tS_OPT_ABS_CFG_PATH,\n\t\tS_OPT_PLUGIN_READFILE,\n\t\tS_LIST_SCRIPTS\n\t};\n\n\tconst Arg_parser::Option options[] = { { 'a', OPT_ANCHORS, Arg_parser::no },\n\t\t\t{ 'b', OPT_BABEL, Arg_parser::no }, { 'B', OPT_BATCHREC,\n\t\t\t\t\tArg_parser::yes }, { 'c', OPT_STYLE_OUT, Arg_parser::yes },\n\t\t\t{ 'C', OPT_INDEXFILE, Arg_parser::no }, { 'd', OPT_OUTDIR,\n\t\t\t\t\tArg_parser::yes }, { 'D', OPT_DATADIR, Arg_parser::yes }, {\n\t\t\t\t\t'e', OPT_STYLE_IN, Arg_parser::yes }, { 'f', OPT_FRAGMENT,\n\t\t\t\t\tArg_parser::no }, { 'F', OPT_FORMAT, Arg_parser::yes },\n\n\t\t\t{ 'h', OPT_HELP, Arg_parser::no }, { 'i', OPT_IN, Arg_parser::yes },\n\t\t\t{ 'I', OPT_INC_STYLE, Arg_parser::no }, { 'j', OPT_LNR_LEN,\n\t\t\t\t\tArg_parser::yes }, { 'J', OPT_LINE_LEN, Arg_parser::yes }, {\n\t\t\t\t\t'k', OPT_BASE_FONT, Arg_parser::yes }, { 'K',\n\t\t\t\t\tOPT_BASE_FONT_SIZE, Arg_parser::yes }, { 'l', OPT_LINENO,\n\t\t\t\t\tArg_parser::no }, { 'm', OPT_LNR_START, Arg_parser::yes }, {\n\t\t\t\t\t'n', OPT_ORDERED_LIST, Arg_parser::no }, { 'N',\n\t\t\t\t\tOPT_ANCHOR_FN, Arg_parser::no }, { 'o', OPT_OUT,\n\t\t\t\t\tArg_parser::yes }, { 'O', OPT_OUTFORMAT, Arg_parser::yes },\n\t\t\t{ 'p', OPT_LISTLANGS, Arg_parser::no }, { 'P', OPT_PROGRESSBAR,\n\t\t\t\t\tArg_parser::no }, { 'q', OPT_QUIET, Arg_parser::no }, { 'Q',\n\t\t\t\t\tOPT_VERSION, Arg_parser::no }, { 'r', OPT_REPLACE_QUOTES,\n\t\t\t\t\tArg_parser::no }, { 's', OPT_STYLE, Arg_parser::yes }, {\n\t\t\t\t\t'S', OPT_SYNTAX, Arg_parser::yes }, { 't', OPT_DELTABS,\n\t\t\t\t\tArg_parser::yes }, { 'T', OPT_DOC_TITLE, Arg_parser::yes },\n\t\t\t{ 'u', OPT_ENCODING, Arg_parser::yes }, { 'v', OPT_VERBOSE,\n\t\t\t\t\tArg_parser::no }, { 'V', OPT_WRAPSIMPLE, Arg_parser::no }, {\n\t\t\t\t\t'w', OPT_LISTTHEMES, Arg_parser::no }, { 'W', OPT_WRAP,\n\t\t\t\t\tArg_parser::no },\n\t\t\t{ 'x', OPT_RTF_PAGE_SIZE, Arg_parser::yes }, { 'y', OPT_ANCHOR_PFX,\n\t\t\t\t\tArg_parser::yes }, { 'z', OPT_FILLZEROES, Arg_parser::no },\n\n\t\t\t{ S_OPT_CLASSNAME, OPT_CLASSNAME, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_SVG_WIDTH, OPT_SVG_WIDTH, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_SVG_HEIGHT, OPT_SVG_HEIGHT, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_ENCLOSE_PRE, OPT_ENCLOSE_PRE, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_FORCE_OUTPUT, OPT_FORCE_OUTPUT, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_INLINE_CSS, OPT_INLINE_CSS, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_KW_CASE, OPT_KW_CASE, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_PRINT_CONFIG, OPT_PRINT_CONFIG, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_TEST_INPUT, OPT_TEST_INPUT, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_NO_NUMBER_WL, OPT_NO_NUMBER_WL, Arg_parser::no },\n\t\t\t{ S_OPT_RTF_CHAR_STYLES, OPT_RTF_CHAR_STYLES, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_SKIP_UNKNOWN, OPT_SKIP_UNKNOWN, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_START_NESTED, OPT_START_NESTED, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_COMPAT_DOC, OPT_COMPAT_DOC, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_COMPAT_NODOC, OPT_COMPAT_NODOC, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_COMPAT_TAB, OPT_COMPAT_TAB, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_COMPAT_CSS, OPT_COMPAT_CSS, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_COMPAT_OUTDIR, OPT_COMPAT_OUTDIR, Arg_parser::yes },\n\t\t\t{ S_OPT_COMPAT_FAILSAFE, OPT_COMPAT_FAILSAFE, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_COMPAT_SRCLANG, OPT_COMPAT_SRCLANG, Arg_parser::yes },\n\t\t\t{ S_OPT_COMPAT_LINENUM, OPT_COMPAT_LINENUM, Arg_parser::maybe },\n\t\t\t{ S_OPT_COMPAT_LINEREF, OPT_COMPAT_LINEREF, Arg_parser::maybe }, {\n\t\t\t\t\tS_OPT_PRETTY_SYMBOLS, OPT_PRETTY_SYMBOLS, Arg_parser::no },\n\t\t\t{ S_OPT_EOL_DELIM_CR, OPT_EOL_DELIM_CR, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_PRINT_STYLE, OPT_PRINT_STYLE, Arg_parser::no }, {\n\t\t\t\t\tS_OPT_NO_TRAILING_NL, OPT_NO_TRAILING_NL, Arg_parser::no },\n\t\t\t{ S_OPT_PLUGIN, OPT_PLUGIN, Arg_parser::yes },\n\t\t\t{ S_OPT_PLUGIN_READFILE, OPT_PLUGIN_READFILE, Arg_parser::yes }, {\n\t\t\t\t\tS_OPT_ABS_CFG_PATH, OPT_ABS_CFG_PATH, Arg_parser::yes }, {\n\t\t\t\t\tS_LIST_SCRIPTS, OPT_LIST_SCRIPTS, Arg_parser::yes },\n\n\t\t\t{ 0, 0, Arg_parser::no } };\n\n\tLOGI(\"cmdoptions\");\n\n\tArg_parser parser(argc, argv, options);\n\tif (parser.error().size()) // bad option\n\t{\n\t\tcerr << \"highlight: \" << parser.error() << \"\\n\";\n\t\tcerr << \"Try `highlight --help' for more information.\\n\";\n\t\texit(1);\n\t}\n\n\tint argind = 0;\n\tfor (; argind < parser.arguments(); ++argind) {\n\t\tconst int code = parser.code(argind);\n\t\tconst std::string & arg = parser.argument(argind);\n\t\tif (!code)\n\t\t\tbreak; // no more options\n\t\tswitch (code) {\n\t\tcase 'O': {\n\t\t\tconst string tmp = StringTools::change_case(arg);\n\t\t\tif (tmp == \"xhtml\")\n\t\t\t\toutputType = highlight::XHTML;\n\t\t\telse if (tmp == \"tex\")\n\t\t\t\toutputType = highlight::TEX;\n\t\t\telse if (tmp == \"latex\")\n\t\t\t\toutputType = highlight::LATEX;\n\t\t\telse if (tmp == \"rtf\")\n\t\t\t\toutputType = highlight::RTF;\n\t\t\telse if (tmp == \"ansi\" || tmp == \"esc\") // gnu source-highlight esc parameter\n\t\t\t\toutputType = highlight::ANSI;\n\t\t\telse if (tmp == \"xterm256\")\n\t\t\t\toutputType = highlight::XTERM256;\n\t\t\telse if (tmp == \"svg\")\n\t\t\t\toutputType = highlight::SVG;\n\t\t\telse if (tmp == \"bbcode\")\n\t\t\t\toutputType = highlight::BBCODE;\n\t\t\telse if (tmp == \"pango\")\n\t\t\t\toutputType = highlight::PANGO;\n\t\t\telse if (tmp == \"odt\")\n\t\t\t\toutputType = highlight::ODTFLAT;\n\t\t\telse if (tmp == \"html\")\n\t\t\t\toutputType = highlight::HTML;\n\t\t\telse if (tmp == \"object\")\n\t\t\t\toutputType=highlight::OBJECT;\n\t\t}\n\t\t\tbreak;\n\t\tcase 'a':\n\t\t\topt_attach_line_anchors = true;\n\t\t\tbreak;\n\t\tcase 'b':\n\t\t\topt_babel = true;\n\t\t\tbreak;\n\t\tcase 'B':\n\t\t\topt_batch_mode = true;\n\t\t\treadDirectory(arg);\n\t\t\tbreak;\n\t\tcase 'c':\n\t\tcase S_OPT_COMPAT_CSS:\n\t\t\tstyleOutFilename = arg;\n\t\t\topt_stylepath_explicit = true;\n\t\t\tbreak;\n\t\tcase 'C':\n\t\t\topt_printindex = true;\n\t\t\tbreak;\n\t\tcase 'T':\n\t\t\tdocTitle = arg;\n\t\t\tbreak;\n\t\tcase 'D':\n\t\t\tdataDir = validateDirPath(arg);\n\t\t\tbreak;\n\t\tcase 'e':\n\t\t\tstyleInFilename = arg;\n\t\t\tbreak;\n\t\tcase 'f':\n\t\tcase S_OPT_COMPAT_NODOC:\n\t\t\topt_fragment = true;\n\t\t\tbreak;\n\t\tcase 'F':\n\t\t\tindentScheme = arg;\n\t\t\tbreak;\n\t\tcase S_OPT_CLASSNAME:\n\t\t\tclassName = arg;\n\t\t\tbreak;\n\t\tcase 'h':\n\t\t\topt_help = true;\n\t\t\tbreak;\n\t\tcase 'i':\n\t\t\tinputFileNames.push_back(arg);\n\t\t\tbreak;\n\t\tcase 'I':\n\t\t\topt_include_style = true;\n\t\t\tbreak;\n\t\tcase 'j':\n\t\t\tStringTools::str2num<int>(lineNrWidth, arg, std::dec);\n\t\t\tbreak;\n\t\tcase 'J':\n\t\t\tStringTools::str2num<int>(lineLength, arg, std::dec);\n\t\t\tbreak;\n\t\tcase 'k':\n\t\t\tbaseFont = arg;\n\t\t\tbreak;\n\t\tcase 'K':\n\t\t\tbaseFontSize = arg;\n\t\t\tbreak;\n\t\tcase S_OPT_COMPAT_LINENUM:\n\t\t\tif (arg == \"0\")\n\t\t\t\topt_fill_zeroes = true;\n\t\tcase 'l':\n\t\t\topt_linenumbers = true;\n\t\t\tbreak;\n\t\tcase 'm':\n\t\t\tStringTools::str2num<int>(lineNrStart, arg, std::dec);\n\t\t\tbreak;\n\t\tcase 'M':\n\t\t\toutputType = highlight::XTERM256;\n\t\t\tbreak;\n\t\tcase 'n':\n\t\t\topt_ordered_list = opt_linenumbers = true;\n\t\t\tbreak;\n\t\tcase 'N':\n\t\t\topt_fnames_as_anchors = true;\n\t\t\tbreak;\n\t\tcase 'o':\n\t\t\toutFilename = arg;\n\t\t\tbreak;\n\t\tcase 'd':\n\t\tcase S_OPT_COMPAT_OUTDIR:\n\t\t\toutDirectory = validateDirPath(arg);\n\t\t\tbreak;\n\t\tcase 'p':\n\t\t\topt_show_langdefs = true;\n\t\t\tbreak;\n\t\tcase 'P':\n\t\t\topt_print_progress = true;\n\t\t\tbreak;\n\t\tcase 'q':\n\t\t\topt_quiet = true;\n\t\t\tbreak;\n\t\tcase 'Q':\n\t\t\topt_version = true;\n\t\t\tbreak;\n\t\tcase 'r':\n\t\t\topt_replacequotes = true;\n\t\t\tbreak;\n\t\tcase 's':\n\t\t\tstyleName = arg;\n\t\t\topt_style = true;\n\t\t\tbreak;\n\t\tcase 'S':\n\t\tcase S_OPT_COMPAT_SRCLANG:\n\t\t\tsyntax = arg;\n\t\t\topt_syntax = true;\n\t\t\tbreak;\n\t\tcase 't':\n\t\tcase S_OPT_COMPAT_TAB:\n\t\t\tStringTools::str2num<int>(numberSpaces, arg, std::dec);\n\t\t\tbreak;\n\t\tcase 'u':\n\t\t\tencodingName = arg;\n\t\t\tbreak;\n\t\tcase 'v':\n\t\t\topt_verbose = true;\n\t\t\tbreak;\n\t\tcase 'V':\n\t\t\twrappingStyle = highlight::WRAP_SIMPLE;\n\t\t\tbreak;\n\t\tcase 'w':\n\t\t\topt_show_themes = true;\n\t\t\tbreak;\n\t\tcase 'W':\n\t\t\twrappingStyle = highlight::WRAP_DEFAULT;\n\t\t\tbreak;\n\t\tcase 'x':\n\t\t\tpageSize = arg;\n\t\t\tbreak;\n\t\tcase 'y':\n\t\t\tanchorPrefix = arg;\n\t\t\tbreak;\n\t\tcase 'z':\n\t\t\topt_fill_zeroes = true;\n\t\t\tbreak;\n\t\tcase S_OPT_SVG_WIDTH:\n\t\t\tsvg_width = arg;\n\t\t\tbreak;\n\t\tcase S_OPT_SVG_HEIGHT:\n\t\t\tsvg_height = arg;\n\t\t\tbreak;\n\t\tcase S_OPT_ENCLOSE_PRE:\n\t\t\topt_enclose_pre = true;\n\t\t\tbreak;\n\t\tcase S_OPT_FORCE_OUTPUT:\n\t\tcase S_OPT_COMPAT_FAILSAFE:\n\t\t\topt_force_output = true;\n\t\t\tbreak;\n\t\tcase S_OPT_INLINE_CSS:\n\t\t\topt_inline_css = true;\n\t\t\tbreak;\n\t\tcase S_OPT_KW_CASE: {\n\t\t\tconst string tmp = StringTools::change_case(arg);\n\t\t\tif (tmp == \"upper\")\n\t\t\t\tkeywordCase = StringTools::CASE_UPPER;\n\t\t\telse if (tmp == \"lower\")\n\t\t\t\tkeywordCase = StringTools::CASE_LOWER;\n\t\t\telse if (tmp == \"capitalize\")\n\t\t\t\tkeywordCase = StringTools::CASE_CAPITALIZE;\n\t\t}\n\t\t\tbreak;\n\n\t\tcase S_OPT_PRINT_CONFIG:\n\t\t\topt_print_config = true;\n\t\t\tbreak;\n\t\tcase S_OPT_TEST_INPUT:\n\t\t\topt_validate = true;\n\t\t\tbreak;\n\t\tcase S_OPT_NO_NUMBER_WL:\n\t\t\topt_number_wrapped_lines = false;\n\t\t\tbreak;\n\t\tcase S_OPT_RTF_CHAR_STYLES:\n\t\t\topt_char_styles = true;\n\t\t\tbreak;\n\t\tcase S_OPT_SKIP_UNKNOWN:\n\t\t\tskipArg = arg;\n\t\t\tbreak;\n\t\tcase S_OPT_PLUGIN:\n\t\t\tuserPlugins.push_back(arg);\n\t\t\tbreak;\n\t\tcase S_OPT_PLUGIN_READFILE:\n\t\t\tpluginReadFilePath = arg;\n\t\t\tbreak;\n\n\t\tcase S_OPT_PRETTY_SYMBOLS:\n\t\t\topt_pretty_symbols = true;\n\t\t\tbreak;\n\t\tcase S_OPT_COMPAT_DOC:\n\t\t\topt_fragment = false;\n\t\t\tbreak;\n\t\tcase S_OPT_COMPAT_LINEREF:\n\t\t\topt_linenumbers = true;\n\t\t\topt_attach_line_anchors = true;\n\t\t\tanchorPrefix = (arg.empty()) ? \"line\" : arg;\n\t\t\tbreak;\n\t\tcase S_OPT_EOL_DELIM_CR:\n\t\t\topt_delim_CR = true;\n\t\t\tbreak;\n\t\tcase S_OPT_START_NESTED:\n\t\t\tstartNestedLang = arg;\n\t\t\tbreak;\n\t\tcase S_OPT_PRINT_STYLE:\n\t\t\topt_print_style = true;\n\t\t\tbreak;\n\t\tcase S_OPT_NO_TRAILING_NL:\n\t\t\topt_no_trailing_nl = true;\n\t\t\tbreak;\n\t\tcase S_OPT_ABS_CFG_PATH:\n\t\t\tif (arg.find(\".lang\") != string::npos) {\n\t\t\t\tabsLangPath = arg;\n\t\t\t\tsyntax = arg.substr(0, arg.find_last_of('.'));\n\t\t\t\topt_syntax = true;\n\t\t\t} else if (arg.find(\".theme\") != string::npos)\n\t\t\t\tabsThemePath = arg;\n\t\t\telse\n\t\t\t\tcerr << \"highlight: unknown config file type\" << endl;\n\t\t\tbreak;\n\t\tcase S_LIST_SCRIPTS:\n\t\t\topt_show_themes = (arg == \"themes\");\n\t\t\topt_show_plugins = (arg == \"plugins\");\n\t\t\topt_show_langdefs = !(opt_show_themes && opt_show_plugins);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tcerr << \"highlight: option parsing failed\" << endl;\n\t\t}\n\t}\n\n\tif (argind < parser.arguments()) //still args left\n\t\t\t{\n\t\tif (inputFileNames.empty()) {\n\t\t\twhile (argind < parser.arguments()) {\n\t\t\t\tinputFileNames.push_back(parser.argument(argind++));\n\t\t\t}\n\t\t}\n\t} else if (inputFileNames.empty()) {\n\t\tinputFileNames.push_back(\"\");\n\t}\n\n\tif (skipArg.size()) {\n\t\tistringstream valueStream;\n\t\tstring elem;\n\t\tstring wildcard;\n\t\tvalueStream.str(\n\t\t\t\tStringTools::change_case(skipArg, StringTools::CASE_LOWER));\n\n\t\twhile (getline(valueStream, elem, ';')) {\n\t\t\tignoredFileTypes.insert(elem);\n\t\t}\n\t\tfor (vector<string>::iterator file = inputFileNames.begin();\n\t\t\t\tfile != inputFileNames.end(); file++) {\n\t\t\tfor (set<string>::iterator ext = ignoredFileTypes.begin();\n\t\t\t\t\text != ignoredFileTypes.end(); ext++) {\n\t\t\t\twildcard = \"*.\" + *ext;\n\t\t\t\tif (Platform::wildcmp(wildcard.c_str(), (*file).c_str())) {\n\t\t\t\t\tinputFileNames.erase(file);\n\t\t\t\t\tfile--;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\tLOGI(\"cmdlineoptions init finish\");\n\tLOGI(\"outFilename:%d\",this->outFilename.empty());\n}\n\nCmdLineOptions::~CmdLineOptions() {\n}\n\nconst string &CmdLineOptions::getSingleOutFilename() {\n\tif (!inputFileNames.empty() && !outDirectory.empty()) {\n\t\tif (outFilename.empty()) {\n\t\t\toutFilename = outDirectory;\n\t\t\tint delim = getSingleInFilename().find_last_of(\n\t\t\t\t\tPlatform::pathSeparator) + 1;\n\t\t\toutFilename += getSingleInFilename().substr(\n\t\t\t\t\t(delim > -1) ? delim : 0) + getOutFileSuffix();\n\t\t}\n\t}\n\treturn outFilename;\n}\n\nconst string &CmdLineOptions::getSingleInFilename() const {\n\treturn inputFileNames[0];\n}\n\nconst string &CmdLineOptions::getOutDirectory() {\n\n\tif (!outFilename.empty() && !enableBatchMode()) {\n\t\toutDirectory = getDirName(outFilename);\n\t}\n\treturn outDirectory;\n}\n\nconst string CmdLineOptions::getStyleOutFilename() const {\n\tif (!styleOutFilename.empty())\n\t\treturn styleOutFilename;\n\n\tif (outputType == highlight::TEX || outputType == highlight::LATEX) {\n\t\treturn \"highlight.sty\";\n\t} else {\n\t\treturn \"highlight.css\";\n\t}\n}\nconst string &CmdLineOptions::getStyleInFilename() const {\n\treturn styleInFilename;\n}\nconst string& CmdLineOptions::getSVGWidth() const {\n\treturn svg_width;\n}\nconst string& CmdLineOptions::getSVGHeight() const {\n\treturn svg_height;\n}\nint CmdLineOptions::getNumberSpaces() const {\n\treturn numberSpaces;\n}\nbool CmdLineOptions::printVersion() const {\n\treturn opt_version;\n}\nbool CmdLineOptions::printHelp() const {\n\treturn opt_help;\n}\nbool CmdLineOptions::printDebugInfo() const {\n\treturn opt_verbose;\n}\nbool CmdLineOptions::printConfigInfo() const {\n\treturn opt_print_config;\n}\nbool CmdLineOptions::quietMode() const {\n\treturn opt_quiet;\n}\nbool CmdLineOptions::includeStyleDef() const {\n\treturn opt_include_style;\n}\nbool CmdLineOptions::useFNamesAsAnchors() const {\n\treturn opt_fnames_as_anchors;\n}\n\nbool CmdLineOptions::formatSupportsExtStyle() {\n\treturn outputType == highlight::OBJECT||outputType == highlight::HTML || outputType == highlight::XHTML\n\t\t\t|| outputType == highlight::LATEX || outputType == highlight::TEX\n\t\t\t|| outputType == highlight::SVG;\n}\n\nbool CmdLineOptions::printLineNumbers() const {\n\treturn opt_linenumbers;\n}\n\nstring CmdLineOptions::getThemeName() const {\n\treturn ((opt_style) ? styleName + \".theme\" :\n\t\t\t(outputType == highlight::XTERM256) ?\n\t\t\t\t\t\"edit-vim-dark.theme\" : \"edit-kwrite.theme\");\n}\nbool CmdLineOptions::enableBatchMode() const {\n\treturn inputFileNames.size() > 1 || opt_batch_mode;\n}\nbool CmdLineOptions::fragmentOutput() const {\n\treturn opt_fragment;\n}\nstring CmdLineOptions::getOutFileSuffix() const {\n\tswitch (outputType) {\n\tcase highlight::OBJECT:\n\t\treturn \".obj\";\n\tcase highlight::XHTML:\n\t\treturn \".xhtml\";\n\tcase highlight::RTF:\n\t\treturn \".rtf\";\n\tcase highlight::TEX:\n\tcase highlight::LATEX:\n\t\treturn \".tex\";\n\tcase highlight::SVG:\n\t\treturn \".svg\";\n\tcase highlight::ANSI:\n\t\treturn \".ansi\";\n\tcase highlight::XTERM256:\n\t\treturn \".xterm\";\n\tcase highlight::BBCODE:\n\t\treturn \".bbcode\";\n\tcase highlight::ODTFLAT:\n\t\treturn \".fodt\";\n\tdefault:\n\t\treturn \".html\";\n\t}\n}\nstring CmdLineOptions::getDirName(const string & path) {\n\tsize_t dirNameLength = path.rfind(Platform::pathSeparator);\n\treturn (dirNameLength == string::npos) ?\n\t\t\tstring() : path.substr(0, dirNameLength + 1);\n}\nbool CmdLineOptions::attachLineAnchors() const {\n\treturn opt_attach_line_anchors;\n}\nbool CmdLineOptions::showThemes() const {\n\treturn opt_show_themes;\n}\nbool CmdLineOptions::showLangdefs() const {\n\treturn opt_show_langdefs;\n}\nbool CmdLineOptions::showPlugins() const {\n\treturn opt_show_plugins;\n}\nbool CmdLineOptions::outDirGiven() const {\n\treturn !outFilename.empty();\n}\nbool CmdLineOptions::replaceQuotes() const {\n\treturn opt_replacequotes;\n}\nbool CmdLineOptions::disableBabelShorthands() const {\n\treturn opt_babel;\n}\nbool CmdLineOptions::prettySymbols() const {\n\treturn opt_pretty_symbols;\n}\nbool CmdLineOptions::getFlag(const string& paramVal) {\n\treturn StringTools::change_case(paramVal) == \"true\";\n}\nbool CmdLineOptions::orderedList() const {\n\treturn opt_ordered_list;\n}\nbool CmdLineOptions::useCRDelimiter() const {\n\treturn opt_delim_CR;\n}\nconst string &CmdLineOptions::getDataDir() const {\n\treturn dataDir;\n}\nconst vector<string> &CmdLineOptions::getPluginPaths() const {\n\treturn userPlugins;\n}\nbool CmdLineOptions::printOnlyStyle() const {\n\treturn opt_print_style;\n}\n\nstring CmdLineOptions::getIndentScheme() const {\n\treturn StringTools::change_case(indentScheme);\n}\n\nconst string &CmdLineOptions::getSyntax() const {\n\treturn syntax;\n}\nconst string&CmdLineOptions::getEncoding() const {\n\treturn encodingName;\n}\n\nconst string& CmdLineOptions::getAnchorPrefix() const {\n\treturn anchorPrefix;\n}\n\nconst string &CmdLineOptions::getPageSize() const {\n\treturn pageSize;\n}\n\nbool CmdLineOptions::printIndexFile() const {\n\treturn opt_printindex\n\t\t\t&& (outputType == highlight::HTML || outputType == highlight::XHTML);\n}\nbool CmdLineOptions::printProgress() const {\n\treturn opt_print_progress;\n}\nbool CmdLineOptions::fillLineNrZeroes() const {\n\treturn opt_fill_zeroes;\n}\nbool CmdLineOptions::syntaxGiven() const {\n\treturn opt_syntax;\n}\nbool CmdLineOptions::omitEncoding() const {\n\treturn StringTools::change_case(encodingName) == \"none\";\n}\nbool CmdLineOptions::forceOutput() const {\n\treturn opt_force_output;\n}\nbool CmdLineOptions::validateInput() const {\n\treturn opt_validate;\n}\nbool CmdLineOptions::numberWrappedLines() const {\n\treturn opt_number_wrapped_lines;\n}\nbool CmdLineOptions::inlineCSS() const {\n\treturn opt_inline_css;\n}\nbool CmdLineOptions::enclosePreTag() const {\n\treturn opt_enclose_pre;\n}\nbool CmdLineOptions::includeCharStyles() const {\n\treturn opt_char_styles;\n}\nbool CmdLineOptions::disableTrailingNL() const {\n\treturn opt_no_trailing_nl;\n}\n\nconst string& CmdLineOptions::getDocumentTitle() const {\n\treturn docTitle;\n}\n\nhighlight::WrapMode CmdLineOptions::getWrappingStyle() const {\n\treturn wrappingStyle;\n}\nconst vector<string> & CmdLineOptions::getInputFileNames() const {\n\treturn inputFileNames;\n}\n\nvoid CmdLineOptions::readDirectory(const string & wildcard) {\n\t// get matching files, use  recursive search\n\tbool directoryOK = Platform::getDirectoryEntries(inputFileNames, wildcard,\n\t\t\ttrue);\n\tif (!directoryOK) {\n\t\tcerr << \"highlight: No files matched the pattern \\\"\" << wildcard\n\t\t\t\t<< \"\\\".\" << endl;\n\t}\n}\n\nstring CmdLineOptions::validateDirPath(const string & path) {\n\treturn (path[path.length() - 1] != Platform::pathSeparator) ?\n\t\t\tpath + Platform::pathSeparator : path;\n}\n\nhighlight::OutputType CmdLineOptions::getOutputType() const {\n\treturn outputType;\n}\n\nStringTools::KeywordCase CmdLineOptions::getKeywordCase() const {\n\treturn keywordCase;\n}\n\nbool CmdLineOptions::hasBaseFont() const {\n\treturn (!baseFont.empty());\n}\n\nconst string& CmdLineOptions::getBaseFont() const {\n\treturn baseFont;\n}\n\nconst string& CmdLineOptions::getBaseFontSize() const {\n\treturn baseFontSize;\n}\n\nconst string& CmdLineOptions::getClassName() const {\n\treturn className;\n}\n\nconst string& CmdLineOptions::getStartNestedLang() const {\n\treturn startNestedLang;\n}\nconst string& CmdLineOptions::getAbsThemePath() const {\n\treturn absThemePath;\n}\n\nconst string& CmdLineOptions::getAbsLangPath() const {\n\treturn absLangPath;\n}\nconst string& CmdLineOptions::getPluginReadFilePath() const {\n\treturn pluginReadFilePath;\n}\nint CmdLineOptions::getNumberWidth() {\n\treturn lineNrWidth;\n}\n\nint CmdLineOptions::getLineLength() {\n\treturn lineLength;\n}\n\nint CmdLineOptions::getNumberStart() {\n\treturn lineNrStart;\n}\n"
  },
  {
    "path": "jni/highlight/cli/cmdlineoptions.h",
    "content": "/***************************************************************************\n                          cmdlineoptions.h  -  description\n                             -------------------\n    begin                : Sun Nov 25 2001\n    copyright            : (C) 2001-2010 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef CMDLINEOPTIONS_H\n#define CMDLINEOPTIONS_H\n\n#ifdef _WIN32\n#include <windows.h>\n#endif\n\n#include <string>\n#include <map>\n#include <set>\n#include <cstdlib>\n#include <iostream>\n#include <fstream>\n#include <vector>\n\n#include \"stringtools.h\"\n#include \"enums.h\"\n\n\n#if ANDROID\n#include <android/log.h>\n\t#ifndef TAG_NAME\n\t\t#define TAG_NAME \"highliter\"\n\t#endif\n\t#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, TAG_NAME, __VA_ARGS__))\n\t#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, TAG_NAME, __VA_ARGS__))\n\t#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, TAG_NAME, __VA_ARGS__))\n\t#define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, TAG_NAME, __VA_ARGS__))\n#else\n\t#define LOGI(...)\n\t#define LOGW(...)\n\t#define LOGE(...)\n#endif\n\n#define OPT_OUTFORMAT      \"out-format\"\n#define OPT_ANCHORS        \"anchors\"\n#define OPT_ANCHOR_FN      \"anchor-filename\"\n#define OPT_ANCHOR_PFX     \"anchor-prefix\"\n#define OPT_BABEL          \"babel\"\n#define OPT_BASE_FONT      \"font\"\n#define OPT_BASE_FONT_SIZE \"font-size\"\n#define OPT_BATCHREC       \"batch-recursive\"\n#define OPT_CLASSNAME      \"class-name\"\n#define OPT_DATADIR        \"data-dir\"\n#define OPT_DELTABS        \"replace-tabs\"\n#define OPT_DOC_TITLE      \"doc-title\"\n#define OPT_ENCLOSE_PRE    \"enclose-pre\"\n#define OPT_ENCODING       \"encoding\"\n#define OPT_FILLZEROES     \"zeroes\"\n#define OPT_FORCE_OUTPUT   \"force\"\n#define OPT_FORMAT         \"reformat\"\n#define OPT_FRAGMENT       \"fragment\"\n#define OPT_HELP           \"help\"\n#define OPT_IN             \"input\"\n#define OPT_INC_STYLE      \"include-style\"\n#define OPT_INDEXFILE      \"print-index\"\n#define OPT_INLINE_CSS     \"inline-css\"\n#define OPT_KW_CASE        \"kw-case\"\n#define OPT_LINENO         \"line-numbers\"\n#define OPT_LINE_LEN       \"line-length\"\n#define OPT_LISTLANGS      \"list-langs\"\n#define OPT_LISTTHEMES     \"list-themes\"\n#define OPT_LIST_SCRIPTS   \"list-scripts\"\n#define OPT_LNR_LEN        \"line-number-length\"\n#define OPT_LNR_START      \"line-number-start\"\n#define OPT_ORDERED_LIST   \"ordered-list\"\n#define OPT_OUT            \"output\"\n#define OPT_OUTDIR         \"outdir\"\n#define OPT_RTF_PAGE_SIZE  \"page-size\"\n#define OPT_RTF_CHAR_STYLES \"char-styles\"\n#define OPT_PRINT_CONFIG   \"print-config\"\n#define OPT_PROGRESSBAR    \"progress\"\n#define OPT_QUIET          \"quiet\"\n#define OPT_REPLACE_QUOTES \"replace-quotes\"\n#define OPT_STYLE          \"style\"\n#define OPT_STYLE_IN       \"style-infile\"\n#define OPT_STYLE_OUT      \"style-outfile\"\n#define OPT_SYNTAX         \"syntax\"\n#define OPT_TEST_INPUT     \"validate-input\"\n#define OPT_VERBOSE        \"verbose\"\n#define OPT_VERSION        \"version\"\n#define OPT_WRAP           \"wrap\"\n#define OPT_WRAPSIMPLE     \"wrap-simple\"\n#define OPT_SVG_WIDTH      \"width\"\n#define OPT_SVG_HEIGHT     \"height\"\n#define OPT_SKIP_UNKNOWN   \"skip\"\n#define OPT_PRETTY_SYMBOLS \"pretty-symbols\"\n#define OPT_EOL_DELIM_CR   \"delim-cr\"\n#define OPT_START_NESTED   \"start-nested\"\n#define OPT_PRINT_STYLE    \"print-style\"\n#define OPT_NO_TRAILING_NL \"no-trailing-nl\"\n#define OPT_PLUGIN         \"plug-in\"\n#define OPT_ABS_CFG_PATH   \"config-file\"\n#define OPT_PLUGIN_READFILE  \"plug-in-read\"\n#define OPT_NO_NUMBER_WL   \"wrap-no-numbers\"\n#define OPT_USE_NBSP       \"nbsp\"\n\n// Improve CLI option compatibility with GNU source-highlight\n#define OPT_COMPAT_DOC       \"doc\"\n#define OPT_COMPAT_NODOC     \"no-doc\"\n#define OPT_COMPAT_TAB       \"tab\"\n#define OPT_COMPAT_CSS       \"css\"\n#define OPT_COMPAT_OUTDIR    \"output-dir\"\n#define OPT_COMPAT_FAILSAFE  \"failsafe\"\n#define OPT_COMPAT_SRCLANG   \"src-lang\"\n#define OPT_COMPAT_LINENUM   \"line-number\"\n#define OPT_COMPAT_LINEREF   \"line-number-ref\"\n\nusing namespace std;\n\n/// handle command line options\n\nclass CmdLineOptions\n{\n\tpublic:\n\n\t\t/**Constructor\n\t\t \\param argc Argument count\n\t\t \\param argv Argument strings\n\t\t*/\n\t\tvoid init (const int argc, const char *argv[] ) ;\n\t\tCmdLineOptions();\n\t\tCmdLineOptions ( const int argc, const char *argv[] );\n\t\t~CmdLineOptions();\n\n\t\t/** \\return Single output file name*/\n\t\tconst string &getSingleOutFilename();\n\n\t\t/** \\return Single input file name*/\n\t\tconst string &getSingleInFilename() const;\n\n\t\t/** \\return Output directory*/\n\t\tconst string& getOutDirectory() ;\n\n\t\t/** \\return Style output file name*/\n\t\tconst string getStyleOutFilename() const;\n\n\t\t/** \\return Style input file name*/\n\t\tconst string& getStyleInFilename() const;\n\n\t\t/** \\return Char set*/\n\t\tconst string& getEncoding() const;\n\n\t\t/** \\return SVG width*/\n\t\tconst string& getSVGWidth() const;\n\n\t\t/** \\return SVG height*/\n\t\tconst string& getSVGHeight() const;\n\n\t\t/** \\return Number of spaces to replace a tab*/\n\t\tint getNumberSpaces() const;\n\n\t\t/** \\return True if version information should be printed*/\n\t\tbool printVersion() const;\n\n\t\t/** \\return True if help information should be printed*/\n\t\tbool printHelp() const;\n\n\t\t/** \\return True if debug information should be printed*/\n\t\tbool printDebugInfo() const;\n\n\t\t/** \\return True if configuration information should be printed*/\n\t\tbool printConfigInfo() const;\n\n\t\t/** \\return True if Style definition should be included in output*/\n\t\tbool includeStyleDef() const;\n\n\t\t/** \\return True if line numbers should be printed*/\n\t\tbool printLineNumbers() const;\n\n\t\t/** \\return True if CR is eol delimiter */\n\t\tbool useCRDelimiter() const;\n\n\t\t/** \\return colour theme name */\n\t\tstring getThemeName() const ;\n\n\t\t/** gibt true zurck, falls deutsche Hilfe ausgegeben werden soll */\n\t\tint helpLanguage() const;\n\n\t\t/** \\return True if batch mode is active*/\n\t\tbool enableBatchMode() const;\n\n\t\t/** \\return True if output shluld be fragmented*/\n\t\tbool fragmentOutput() const;\n\n\t\t/** \\return output file suffix */\n\t\tstring getOutFileSuffix() const;\n\n\t\t/** \\return True if anchors should be attached to line numbers*/\n\t\tbool attachLineAnchors() const;\n\n\t\t/** \\return True if list of installed themes should be printed*/\n\t\tbool showThemes() const;\n\n\t\t/** \\return True if list of installed language definitions should be printed*/\n\t\tbool showLangdefs() const;\n\n\t\t/** \\return True if list of installed language definitions should be printed*/\n\t\tbool showPlugins() const;\n\t\t\n\t\t/** \\return True if loutput directory is given*/\n\t\tbool outDirGiven() const;\n\n\t\t/** \\return True if a new data directory is given*/\n\t\tbool dataDirGiven() const;\n\n\t\t/** \\return True if index file should be printed*/\n\t\tbool printIndexFile() const;\n\n\t\t/** \\return True if quotes should be replaced by /dq in LaTeX*/\n\t\tbool replaceQuotes() const;\n\n\t\t/** \\return True if shorthands of LaTeX Babel package should be disabled*/\n\t\tbool disableBabelShorthands() const;\n\n\t\t/** \\return True if input file name should be used as anchor name */\n\t\tbool useFNamesAsAnchors() const;\n\n\t\t/** \\return Data directory*/\n\t\tconst string &getDataDir() const;\n\n\t\t/** \\return True if language syntax is given*/\n\t\tbool syntaxGiven() const;\n\n\t\t/** \\return True if quiet mode is active*/\n\t\tbool quietMode() const;\n\n\t\t/** \\return True if progress bar should be printed in batch mode */\n\t\tbool printProgress() const;\n\n\t\t/** \\return True if line numbers are filled with leading zeroes */\n\t\tbool fillLineNrZeroes() const;\n\n\t\t/** \\return programming syntax */\n\t\tconst string &getSyntax() const ;\n\n\t\t/** \\return Wrapping style*/\n\t\thighlight::WrapMode getWrappingStyle() const;\n\n\t\t/** \\return List of input file names*/\n\t\tconst vector <string> & getInputFileNames() const;\n\n\t\t/** \\return indentation and reformatting scheme*/\n\t\tstring getIndentScheme() const;\n\n\t\t/** \\return RTF page size */\n\t\tconst string &getPageSize() const;\n\n\t\t/** \\return Output file format */\n\t\thighlight::OutputType getOutputType() const;\n\n\t\t/** \\return True if chosen output format supports referenced style files */\n\t\tbool formatSupportsExtStyle();\n\n\t\t/** \\return True if style output path was defined by user*/\n\t\tbool styleOutPathDefined() const\n\t\t{\n\t\t\treturn opt_stylepath_explicit;\n\t\t}\n\n\t\t/** \\return True if encoding specification should be omitted in output*/\n\t\tbool omitEncoding() const;\n\n\t\t/** \\return True if output should be generated if languege type is unknown*/\n\t\tbool forceOutput() const;\n\n\t\t/** \\return True if line numbers should be replaced by ordered list (HTML) */\n\t\tbool orderedList() const;\n\t\t\n\t\t/** \\return True if spaces should be replaced by &nbsp; (HTML) */\n\t\t//bool useNonBreakingSpace() const;\n\n\t\t/** \\return True if a base font has been given */\n\t\tbool hasBaseFont() const ;\n\n\t\t/** \\return True if input should be validated */\n\t\tbool validateInput() const ;\n\n\t\t/** \\return True if wrapped lines should get unique numbers */\n\t\tbool numberWrappedLines() const ;\n\n\t\t/** \\return True if CSS should be outputted within tag elements */\n\t\tbool inlineCSS() const ;\n\n\t\t/** \\return True if fragmented html output should be enclosed with pre tags */\n\t\tbool enclosePreTag() const ;\n\n\t\t/** \\return True if RTF output should include character styles */\n\t\tbool includeCharStyles() const ;\n\n\t\t/** \\return True if LaTeX output should includ fancier symbols */\n\t\tbool prettySymbols() const;\n\n\t\t/** \\return True if style should be printed */\n\t\tbool printOnlyStyle() const;\n\n\t\t/** \\return The given base font, empty string by default */\n\t\tconst string& getBaseFont() const ;\n\n\t\t/** \\return Document title */\n\t\tconst string& getDocumentTitle() const ;\n\n\t\t/** \\return anchor prefix */\n\t\tconst string& getAnchorPrefix() const ;\n\n\t\t/** \\return class name */\n\t\tconst string& getClassName() const ;\n\n\t\tconst vector <string> &getPluginPaths() const;\n\n\t\t/** \\return True if trailing nl should be omitted */\n\t\tbool disableTrailingNL() const ;\n\n\t\t/** \\return The given base font size, empty string by default */\n\t\tconst string& getBaseFontSize() const ;\n\n\t\t/** \\return name of nested syntax which starts the input */\n\t\tconst string& getStartNestedLang() const ;\n\n\t\t/** \\return absolute theme definition path name */\n\t\tconst string& getAbsThemePath() const ;\n\n\t\t/** \\return absolute language definition path name */\n\t\tconst string& getAbsLangPath() const ;\n\t\t\n\t\t/** \\return path of input file passed to plugin */\n\t\tconst string& getPluginReadFilePath() const ;\n\n\t\t/** \\return line number width */\n\t\tint getNumberWidth();\n\n\t\t/** \\return line length */\n\t\tint getLineLength();\n\n\t\t/** \\return Line number start count */\n\t\tint getNumberStart();\n\n\t\t/** \\return Keyword Case (upper, lower, unchanged) */\n\t\tStringTools::KeywordCase getKeywordCase() const;\n\n\t\tbool isSkippedExt ( const string& ext )\n\t\t{\n\t\t\treturn ignoredFileTypes.count ( ext );\n\t\t}\n\n\tprivate:\n\n\t\tint numberSpaces;   // number of spaces which replace a tab\n\t\tint lineNrWidth;    // width of line number (left padding)\n\t\tint lineLength;    // length of line before wrapping\n\t\tint lineNrStart;    // line number start count\n\t\thighlight::WrapMode wrappingStyle; // line wrapping mode\n\t\thighlight::OutputType outputType;\n\t\tStringTools::KeywordCase keywordCase;\n\n\t\t// name of single output file\n\t\tstring outFilename,\n\t\t// output directory\n\t\toutDirectory,\n\t\t// programming syntax which will be loaded\n\t\tsyntax,\n\t\t// name of colour theme\n\t\tstyleName,\n\t\t// name of external style file\n\t\tstyleOutFilename,\n\t\t// name of file to be included in external style file\n\t\tstyleInFilename,\n\t\t// used to define data directories at runtime\n\t\tdataDir;\n\t\t// name of indenation scheme\n\t\tstring indentScheme,\n\t\tpageSize, startNestedLang;\n\n\t\tstring baseFont, baseFontSize;\n\t\tstring docTitle, className;\n\t\tstring skipArg;\n\t\tstring svg_height, svg_width;\n\t\tstring absThemePath, absLangPath;\n\n\t\tbool opt_syntax;\n\t\tbool opt_include_style;\n\t\tbool opt_help;\n\t\tbool opt_version ;\n\t\tbool opt_verbose;\n\t\tbool opt_print_config;\n\t\tbool opt_linenumbers;\n\t\tbool opt_style;\n\t\tbool opt_batch_mode;\n\t\tbool opt_fragment;\n\t\tbool opt_attach_line_anchors;\n\t\tbool opt_show_themes;\n\t\tbool opt_show_langdefs;\n\t\tbool opt_show_plugins;\n\t\tbool opt_asformat_output;\n\t\tbool opt_printindex;\n\t\tbool opt_quiet;\n\t\tbool opt_replacequotes;\n\t\tbool opt_babel;\n\t\tbool opt_print_progress;\n\t\tbool opt_fill_zeroes;\n\t\tbool opt_stylepath_explicit;\n\t\tbool opt_force_output;\n\t\tbool opt_ordered_list;\n\t\tbool opt_fnames_as_anchors;\n\t\tbool opt_validate;\n\t\tbool opt_number_wrapped_lines;\n\t\tbool opt_inline_css;\n\t\tbool opt_enclose_pre;\n\t\tbool opt_char_styles;\n\t\tbool opt_pretty_symbols;\n\t\tbool opt_delim_CR;\n\t\tbool opt_print_style;\n\t\tbool opt_no_trailing_nl;\n\n\t\tstring anchorPrefix;\n\t\tstring helpLang, encodingName;\n\n\t\tstring pluginPath, pluginReadFilePath;\n\n\t\t/** list of all input file names */\n\t\tvector <string> inputFileNames;\n\n\t\t/** list of plugin file names */\n\t\tvector <string> userPlugins;\n\n\t\t/** list lines which should be marked and supplied with help string */\n\t\tmap <int, string> markLines;\n\n\t\t/** list of file types which should be ignored */\n\t\tset <string> ignoredFileTypes;\n\n\t\t/** \\return file suffix */\n\t\tstring getFileSuffix ( const string & fileName ) const;\n\n\t\t/** \\return directory name of path */\n\t\tstring getDirName ( const string & path );\n\n\t\t/** get all entries in the directory defined by wildcard */\n\t\tvoid readDirectory ( const string & wildcard );\n\n\t\t/** \\return Boolean value of paramVal */\n\t\tbool getFlag ( const string& paramVal );\n\n\t\t/** \\return Valid path name */\n\t\tstring validateDirPath ( const string & path );\n};\n\n#endif\n"
  },
  {
    "path": "jni/highlight/cli/help.cpp",
    "content": "/***************************************************************************\n                          help.cpp  -  description\n                             -------------------\n    begin                : Die Apr 23 2002\n    copyright            : (C) 2002-2010 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n#include <iostream>\n#include \"help.h\"\n\nusing namespace std;\n\nnamespace Help\n{\n\tvoid printHelp()\n\t{\n\t\tcout<<\"USAGE: highlight [OPTIONS]... [FILES]...\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"General options:\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\" -B, --batch-recursive=<wc>     convert all matching files, searches subdirs\\n\";\n\t\tcout<<\"                                  (Example: -B '*.cpp')\\n\";\n\t\tcout<<\" -D, --data-dir=<directory>     set path to data directory (deprecated)\\n\";\n\t\tcout<<\"     --config-file=<file>       set path to a lang or theme file\\n\";\n\t\tcout<<\" -d, --outdir=<directory>       name of output directory\\n\";\n\t\tcout<<\" -h, --help                     print this help\\n\";\n\t\tcout<<\" -i, --input=<file>             name of single input file\\n\";\n\t\tcout<<\" -o, --output=<file>            name of single output file\\n\";\n\n\t\tcout<<\" -p, --list-langs               list installed language definitions (deprecated)\\n\";\n\t\tcout<<\" -P, --progress                 print progress bar in batch mode\\n\";\n\t\tcout<<\" -q, --quiet                    supress progress info in batch mode\\n\";\n\t\tcout<<\" -S, --syntax=<type>            specify type of source code\\n\";\n\t\tcout<<\" -v, --verbose                  print debug info\\n\";\n\t\tcout<<\" -w, --list-themes              list installed colour themes (deprecated)\\n\";\n\t\tcout<<\"     --force                    generate output if input syntax is unknown\\n\";\n\t\tcout<<\"     --list-scripts=<type>      list installed scripts\\n\";\n\t\tcout<<\"                                  <type>=[langs, themes, plugins]\\n\";\n\t\tcout<<\"     --plug-in=<script>         execute Lua plug-in script; repeat option to\\n\";\n\t\tcout<<\"                                  execute multiple plug-ins\\n\";\n\t\tcout<<\"     --plug-in-read=<path>      set input file for a plug-in (e.g. \\\"tags\\\")\\n\";\n\t\tcout<<\"     --print-config             print path configuration\\n\";\n\t\tcout<<\"     --print-style              print stylesheet only (see --style-outfile)\\n\";\n\t\tcout<<\"     --skip=<list>              ignore listed unknown file types\\n\";\n\t\tcout<<\"                                  (Example: --skip='bak;c~;h~')\\n\";\n\t\tcout<<\"     --start-nested=<lang>      define nested language which starts input\\n\";\n\t\tcout<<\"                                  without opening delimiter\\n\";\n\t\tcout<<\"     --validate-input           test if input is text, remove Unicode BOM\\n\";\n\t\tcout<<\"     --version                  print version and copyright information\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"Output formatting options:\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\" -O, --out-format=<format>      output file in given format\\n\";\n\t\tcout<<\"                                  <format>=[html, xhtml, latex, tex, odt, rtf,\\n\";\n\t\tcout<<\"                                  ansi, xterm256, bbcode, pango, svg]\\n\";\n\t\tcout<<\" -c, --style-outfile=<file>     name of style file or print to stdout, if\\n\";\n\t\tcout<<\"                                  'stdout' is given as file argument\\n\";\n\n\t\tcout<<\" -e, --style-infile=<file>      file to be included in style-outfile\\n\";\n\n\t\tcout<<\" -f, --fragment                 omit document header and footer\\n\";\n\t\tcout<<\" -F, --reformat=<style>         reformats and indents output in given style\\n\";\n\t\tcout<<\"                                  <style>=[allman, banner, gnu,\\n\";\n\t\tcout<<\"                                  horstmann, java, kr, linux, otbs, vtk,\\n\";\n\t\tcout<<\"                                  stroustrup, whitesmith, google, pico, lisp]\\n\";\n\t\tcout<<\" -I, --include-style            include style definition\\n\";\n\t\tcout<<\" -J, --line-length=<num>        line length before wrapping (see -W, -V)\\n\";\n\t\tcout<<\" -j, --line-number-length=<num> line number width incl. left padding\\n\";\n\t\tcout<<\" -k, --font=<font>              set font (specific to output format)\\n\";\n\t\tcout<<\" -K, --font-size=<num?>         set font size (specific to output format)\\n\";\n\t\tcout<<\" -l, --line-numbers             print line numbers in output file\\n\";\n\t\tcout<<\" -m, --line-number-start=<cnt>  start line numbering with cnt (assumes -l)\\n\";\n\t\tcout<<\" -s, --style=<style>            set colour style (see -w)\\n\";\n\t\tcout<<\" -t, --replace-tabs=<num>       replace tabs by <num> spaces\\n\";\n\t\tcout<<\" -T, --doc-title=<title>        document title\\n\";\n\t\tcout<<\" -u, --encoding=<enc>           set output encoding which matches input file\\n\";\n\t\tcout<<\"                                  encoding; omit encoding info if set to NONE\\n\";\n\t\tcout<<\" -V, --wrap-simple              wrap long lines without indenting function\\n\";\n\t\tcout<<\"                                  parameters and statements\\n\";\n\t\tcout<<\" -W, --wrap                     wrap long lines\\n\";\n\t\tcout<<\"     --wrap-no-numbers          omit line numbers of wrapped lines\\n\";\n\t\tcout<<\"                                  (assumes -l)\\n\";\n\t\tcout<<\" -z, --zeroes                   pad line numbers with 0's\\n\";\n\t\tcout<<\"     --kw-case=<case>           change case of case insensitive keywords\\n\";\n\t\tcout<<\"                                  <case> =  [upper, lower, capitalize]\\n\";\n\t\tcout<<\"     --delim-cr                 set CR as end-of-line delimiter (MacOS 9)\\n\";\n\t\tcout<<\"     --no-trailing-nl           omit trailing newline\\n\";\n\t\tcout<<\"\\n\\n\";\n\t\tcout<<\"(X)HTML output options:\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\" -a, --anchors                  attach anchor to line numbers\\n\";\n\t\tcout<<\" -y, --anchor-prefix=<str>      set anchor name prefix\\n\";\n\t\tcout<<\" -N, --anchor-filename          use input file name as anchor prefix\\n\";\n\t\tcout<<\" -C, --print-index              print index with hyperlinks to output files\\n\";\n\t\tcout<<\" -n, --ordered-list             print lines as ordered list items\\n\";\n\t\tcout<<\"     --class-name=<name>        set CSS class name prefix;\\n\";\n\t\tcout<<\"                                  omit class name if set to NONE\\n\";\n\t\tcout<<\"     --inline-css               output CSS within each tag (verbose output)\\n\";\n\t\tcout<<\"     --enclose-pre              enclose fragmented output with pre tag \\n\";\n\t\tcout<<\"                                  (assumes -f)\\n\";\n\t\tcout<<\"\\n\\n\";\n\t\tcout<<\"LaTeX output options:\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\" -b, --babel                    disable Babel package shorthands\\n\";\n\t\tcout<<\" -r, --replace-quotes           replace double quotes by \\\\dq{}\\n\";\n\t\tcout<<\"     --pretty-symbols           improve appearance of brackets and other symbols\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"RTF output options:\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\" -x, --page-size=<ps>           set page size \\n\";\n\t\tcout<<\"                                  <ps> = [a3, a4, a5, b4, b5, b6, letter]\\n\";\n\t\tcout<<\"     --char-styles              include character stylesheets\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"SVG output options:\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"     --height                   set image height (units allowed)\\n\";\n\t\tcout<<\"     --width                    set image width (see --height)\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"GNU source-highlight compatibility options:\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"     --doc                      create stand alone document\\n\";\n\t\tcout<<\"     --no-doc                   cancel the --doc option\\n\";\n\t\tcout<<\"     --css=filename             the external style sheet filename\\n\";\n\t\tcout<<\"     --src-lang=STRING          source language\\n\";\n\t\tcout<<\" -t, --tab=INT                  specify tab length\\n\";\n\t\tcout<<\" -n, --line-number[=0]          number all output lines, optional padding\\n\";\n\t\tcout<<\"     --line-number-ref[=p]      number all output lines and generate an anchor,\\n\";\n\t\tcout<<\"                                  made of the specified prefix p + the line\\n\";\n\t\tcout<<\"                                  number  (default='line')\\n\";\n\t\tcout<<\"     --output-dir=path          output directory\\n\";\n\t\tcout<<\"     --failsafe                 if no language definition is found for the\\n\";\n\t\tcout<<\"                                  input, it is simply copied to the output\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"If no in- or output files are specified, stdin and stdout will be used.\\n\";\n\t\tcout<<\"HTML will be generated unless an other output format is given. Style definitions\\n\";\n\t\tcout<<\"are stored in highlight.css (HTML, XHTML, SVG) or highlight.sty (LaTeX, TeX)\\n\";\n\t\tcout<<\"if neither -c nor -I is given.\\n\";\n\t\tcout<<\"Reformatting code (-F) will only work with C, C++, C# and Java input files.\\n\";\n\t\tcout<<\"Wrapping lines with -V or -W will cause faulty highlighting of long single\\n\";\n\t\tcout<<\"line comments and directives. Use with caution.\\n\";\n\t\tcout<<\"See README how to install own scripts in the home directory.\\n\";\n\t\tcout<<\"\\n\";\n\t\tcout<<\"Updates and information: http://www.andre-simon.de/\\n\";\n\t}\n\n}\n"
  },
  {
    "path": "jni/highlight/cli/help.h",
    "content": "/***************************************************************************\n                          help.h  -  description\n                             -------------------\n    begin                : Die Apr 23 2002\n    copyright            : (C) 2002-2007 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef HELP_H\n#define HELP_H\n\n#include <string>\n\n///Contains methods for printing help messages\n\nnamespace Help\n{\n\t/** print help message to stdout\n\t */\n\tvoid printHelp();\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/cli/main.cpp",
    "content": "/***************************************************************************\n                          main.cpp  -  description\n                             -------------------\n    begin                : Die Apr 23 22:16:35 CEST 2002\n    copyright            : (C) 2002-2012 by Andre Simon\n    email                : andre.simon1@gmx.de\n\n   Highlight is a universal source code to HTML converter. Syntax highlighting\n   is formatted by Cascading Style Sheets. It's possible to easily enhance\n   highlight's parsing database.\n\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include <memory>\n#include <algorithm>\n#include <Diluculum/LuaState.hpp>\n\n#include \"main.h\"\n#include \"../include/datadir.h\"\n#include \"syntaxreader.h\"\n\n#define MAX_LINE__WIDTH       80\n\nusing namespace std;\n\nvoid HLCmdLineApp::printVersionInfo()\n{\n    cout << \"\\n highlight version \"\n         << HIGHLIGHT_VERSION\n         << \"\\n Copyright (C) 2002-2015 Andre Simon <andre.simon1 at gmx.de>\"\n         << \"\\n\\n Argparser class\"\n         << \"\\n Copyright (C) 2006-2008 Antonio Diaz Diaz <ant_diaz at teleline.es>\"\n         << \"\\n\\n Artistic Style Classes (2.05)\"\n         << \"\\n Copyright (C) 2006-2014 by Jim Pattee <jimp03 at email.com>\"\n         << \"\\n Copyright (C) 1998-2002 by Tal Davidson\"\n         << \"\\n\\n Diluculum Lua wrapper (1.0)\"\n         << \"\\n Copyright (C) 2005-2013 by Leandro Motta Barros\"\n         << \"\\n\\n xterm 256 color matching functions\"\n         << \"\\n Copyright (C) 2006 Wolfgang Frisch <wf at frexx.de>\"\n\n         << \"\\n\\n This software is released under the terms of the GNU General \"\n         << \"Public License.\"\n         << \"\\n For more information about these matters, see the file named \"\n         << \"COPYING.\\n\\n\";\n}\n\nvoid HLCmdLineApp::printBadInstallationInfo()\n{\n    cerr << \"highlight: Data directory not found (\"<<DataDir::LSB_DATA_DIR<<\").\"\n         \" Bad installation or wrong \"<< OPT_DATADIR << \" parameter.\"\n         << \"\\n\\nCopy the highlight files into one of the directories listed \"\n         << \"in INSTALL.\\nYou may also set the data directory with \"\n         << OPT_DATADIR << \".\\n\";\n}\n\nint HLCmdLineApp::printInstalledFiles(const string& where, const string& wildcard, const string& what, const string&option)\n{\n    vector <string> filePaths;\n    string searchDir = where + wildcard;\n\n    bool directoryOK = Platform::getDirectoryEntries ( filePaths, searchDir, true );\n    if ( !directoryOK )\n    {\n        cerr << \"highlight: Could not access directory \"\n             <<  searchDir\n             << \", aborted.\\n\";\n        return EXIT_FAILURE;\n    }\n\n    cout << \"\\nInstalled \"<< what << \" (located in \" << where << \"):\\n\\n\";\n\n    sort ( filePaths.begin(), filePaths.end() );\n    string temp;\n\n    for ( unsigned int i=0; i< filePaths.size(); i++ )\n    {\n        temp = ( filePaths[i] ).substr ( where.length() );\n        cout <<temp.substr ( 1, temp.length()- wildcard.length() ) << endl;\n    }\n    cout <<\"\\nUse name of the desired \"<<what\n         << \" with the --\" <<option<< \" option.\\n\" << endl;\n\t \n    return EXIT_SUCCESS;\n}\n\n\nint HLCmdLineApp::printInstalledLanguages()\n{\n    vector <string> filePaths;\n    string wildcard=\"*.lang\";\n    string directory=dataDir.getLangPath();\n    string searchDir = directory + wildcard;\n\n    bool directoryOK = Platform::getDirectoryEntries ( filePaths, searchDir, true );\n    if ( !directoryOK )\n    {\n        cerr << \"highlight: Could not access directory \"\n             <<  searchDir\n             << \", aborted.\\n\";\n        return EXIT_FAILURE;\n    }\n\n    sort ( filePaths.begin(), filePaths.end() );\n    string suffix, desc;\n    cout << \"\\nInstalled language definitions\"\n         << \" (located in \" << directory << \"):\\n\\n\";\n\n    for ( unsigned int i=0; i< filePaths.size(); i++ )\n    {\n        Diluculum::LuaState ls;\n        highlight::SyntaxReader::initLuaState(ls, filePaths[i],\"\");\n        ls.doFile(filePaths[i]);\n        desc = ls[\"Description\"].value().asString();\n        suffix = ( filePaths[i] ).substr ( directory.length() ) ;\n        suffix = suffix.substr ( 1, suffix.length()- wildcard.length() );\n        cout << setw ( 30 ) <<setiosflags ( ios::left ) <<desc<<\": \"<<suffix;\n        int extCnt=0;\n        for (StringMap::iterator it=extensions.begin(); it!=extensions.end(); it++) {\n            if (it->second==suffix ) {\n                cout << ((++extCnt==1)?\" ( \":\" \")<<it->first;\n            }\n        }\n        cout << ((extCnt)?\" )\":\"\")<<endl;\n    }\n    cout <<\"\\nUse name of the desired language\"\n         << \" with the --\" OPT_SYNTAX \" option.\\n\" << endl;\n    return EXIT_SUCCESS;\n}\n\nvoid HLCmdLineApp::printDebugInfo ( const highlight::SyntaxReader *lang,\n                                    const string & langDefPath )\n{\n    if (!lang) return;\n    cerr << \"\\nLoading language definition:\\n\" << langDefPath;\n    cerr << \"\\n\\nDescription: \" << lang->getDescription();\n\n    Diluculum::LuaState* luaState=lang->getLuaState();\n    if (luaState) {\n        cerr << \"\\n\\nLUA GLOBALS:\\n\" ;\n        Diluculum::LuaValueMap::iterator it;\n        Diluculum::LuaValueMap glob =luaState->globals();\n        for(it = glob.begin(); it != glob.end(); it++)\n        {\n            Diluculum::LuaValue first = it->first;\n            Diluculum::LuaValue second = it->second;\n            std::cerr << first.asString()<<\": \";\n            switch (second.type()) {\n            case  LUA_TSTRING:\n                cerr << \"string [ \"<<second.asString()<<\" ]\";\n                break;\n            case  LUA_TNUMBER:\n                cerr << \"number [ \"<<second.asNumber()<<\" ]\";\n                break;\n            case  LUA_TBOOLEAN:\n                cerr << \"boolean [ \"<<second.asBoolean()<<\" ]\";\n                break;\n            default:\n                cerr << second.typeName();\n            }\n            cerr << endl;\n        }\n\n    }\n    /*\n    cerr << \"\\nREGEX:\\n\";\n    highlight::RegexElement *re=NULL;\n    for ( unsigned int i=0; i<lang->getRegexElements().size(); i++ )\n    {\n        re = lang->getRegexElements() [i];\n        cerr << \"State \"<<re->open<<\":\\t\"<<re->rex. <<\"\\n\";\n    }*/\n    cerr << \"\\nKEYWORDS:\\n\";\n    highlight::KeywordMap::iterator it;\n    highlight::KeywordMap keys=lang->getKeywords();\n    for ( it=keys.begin(); it!=keys.end(); it++ )\n    {\n        cerr << \" \"<< it->first << \"(\"<< it->second << \")\";\n    }\n    cerr <<\"\\n\\n\";\n}\n\nvoid HLCmdLineApp::printConfigInfo ( )\n{\n    cout << \"\\nConfig file search directories:\\n\";\n    dataDir.printConfigPaths();\n    cout << \"\\nFiletype config file:\\n\"<<dataDir.getFiletypesConfPath ( \"filetypes\" ) <<\"\\n\";\n    cout << endl;\n#ifdef HL_DATA_DIR\n    cout << \"Compiler directive HL_DATA_DIR = \" <<HL_DATA_DIR<< \"\\n\";\n#endif\n#ifdef HL_CONFIG_DIR\n    cout << \"Compiler directive HL_CONFIG_DIR = \" <<HL_CONFIG_DIR<< \"\\n\";\n#endif\n    cout << endl;\n}\n\nstring HLCmdLineApp::getFileSuffix(const string& fileName)\n{\n    size_t ptPos=fileName.rfind(\".\");\n    size_t psPos = fileName.rfind ( Platform::pathSeparator );\n    if (ptPos == string::npos){\n     return  (psPos==string::npos) ? fileName : fileName.substr(psPos+1, fileName.length());\n    }\n    //return (ptPos == string::npos || (psPos!=string::npos && psPos>ptPos)) ? \"\" : fileName.substr(ptPos+1, fileName.length()); \n    return (psPos!=string::npos && psPos>ptPos) ? \"\" : fileName.substr(ptPos+1, fileName.length()); \n  \n}\n\nbool HLCmdLineApp::loadFileTypeConfig ( const string& name, StringMap* extMap, StringMap* shebangMap )\n{\n    if ( !extMap || !shebangMap ) return false;\n\n  //  string confPath=dataDir.getConfDir() + name + \".conf\";\n    string confPath=dataDir.getFiletypesConfPath(name);\n    try {\n        Diluculum::LuaState ls;\n        Diluculum::LuaValueList ret= ls.doFile (confPath);\n\n        int idx=1;\n        string langName;\n        Diluculum::LuaValue mapEntry;\n        while ((mapEntry = ls[\"FileMapping\"][idx].value()) !=Diluculum::Nil) {\n            langName = mapEntry[\"Lang\"].asString();\n            if (mapEntry[\"Extensions\"] !=Diluculum::Nil) {\n                int extIdx=1;\n                while (mapEntry[\"Extensions\"][extIdx] !=Diluculum::Nil) {\n                    extMap->insert ( make_pair ( mapEntry[\"Extensions\"][extIdx].asString(),  langName ) );\n                    extIdx++;\n                }\n            } else if (mapEntry[\"Shebang\"] !=Diluculum::Nil) {\n                shebangMap->insert ( make_pair ( mapEntry[\"Shebang\"].asString(),  langName ) );\n            }\n            idx++;\n        }\n\n    }\n    catch (Diluculum::LuaError err) {\n        cerr <<err.what()<<\"\\n\";\n        return false;\n    }\n    return true;\n}\n\n\nint HLCmdLineApp::getNumDigits ( int i )\n{\n    int res=0;\n    while ( i )\n    {\n        i/=10;\n        ++res;\n    }\n    return res;\n}\n\nvoid HLCmdLineApp::printProgressBar ( int total, int count )\n{\n    if ( !total ) return;\n    int p=100*count / total;\n    int numProgressItems=p/10;\n    cout << \"\\r[\";\n    for ( int i=0; i<10; i++ )\n    {\n        cout << ( ( i<numProgressItems ) ?\"#\":\" \" );\n    }\n    cout<< \"] \" <<setw ( 3 ) <<p<<\"%, \"<<count << \" / \" << total << \"  \" <<flush;\n    if ( p==100 )\n    {\n        cout << endl;\n    }\n}\n\nvoid HLCmdLineApp::printCurrentAction ( const string&outfilePath,\n                                        int total, int count, int countWidth )\n{\n    cout << \"Writing file \"\n         << setw ( countWidth ) << count\n         << \" of \"\n         << total\n         << \": \"\n         << outfilePath\n         << \"\\n\";\n}\n\nvoid HLCmdLineApp::printIOErrorReport ( unsigned int numberErrorFiles,\n                                        vector<string> & fileList,\n                                        const string &action )\n{\n    cerr << \"highlight: Could not \"\n         << action\n         << \" file\"\n         << ( ( numberErrorFiles>1 ) ?\"s\":\"\" ) <<\":\\n\";\n    copy ( fileList.begin(), fileList.end(), ostream_iterator<string> ( cerr, \"\\n\" ) );\n    if ( fileList.size() < numberErrorFiles )\n    {\n        cerr << \"... [\"\n             << ( numberErrorFiles - fileList.size() )\n             << \" of \"\n             << numberErrorFiles\n             << \" failures not shown, use --\"\n             << OPT_VERBOSE\n             << \" switch to print all failures]\\n\";\n    }\n}\n\nstring HLCmdLineApp::analyzeFile ( const string& file )\n{\n    string firstLine;\n    if ( !file.empty() )\n    {\n        ifstream inFile ( file.c_str() );\n        getline ( inFile, firstLine );\n    }\n    else\n    {\n        //  This copies all the data to a new buffer, uses the data to get the\n        //  first line, then makes cin use the new buffer that underlies the\n        //  stringstream instance\n        cin_bufcopy << cin.rdbuf();\n        getline ( cin_bufcopy, firstLine );\n        cin_bufcopy.seekg ( 0, ios::beg );\n        cin.rdbuf ( cin_bufcopy.rdbuf() );\n    }\n    StringMap::iterator it;\n    boost::xpressive::sregex rex;\n    boost::xpressive::smatch what;\n    for ( it=scriptShebangs.begin(); it!=scriptShebangs.end(); it++ )\n    {\n        rex = boost::xpressive::sregex::compile( it->first );\n        if ( boost::xpressive::regex_search( firstLine, what, rex )  ) return it->second;\n    }\n    return \"\";\n}\n\nstring HLCmdLineApp::guessFileType ( const string& suffix, const string &inputFile, bool useUserSuffix )\n{\n    string lcSuffix = StringTools::change_case(suffix);    \n    if (extensions.count(lcSuffix))\n    {\n      return extensions[lcSuffix];\n    }\n    \n    if (!useUserSuffix){\n      string shebang =  analyzeFile(inputFile);\n      if (!shebang.empty()) return shebang;\n    }\n    return lcSuffix;\n}\n\nvector <string> HLCmdLineApp::collectPluginPaths(const vector<string>& plugins){\n  vector<string> absolutePaths;\n  for (unsigned int i=0; i<plugins.size(); i++) {\n    if (Platform::fileExists(plugins[i])){\n      absolutePaths.push_back(plugins[i]);\n    } else {\n\tabsolutePaths.push_back(dataDir.getPluginPath(plugins[i]+\".lua\"));\n    }\n  }\n  return absolutePaths;\n}\n\nint HLCmdLineApp::run ( const int argc, const char*argv[] )\n{\n    CmdLineOptions options ( argc, argv );\n\n    // set data directory path, where /langDefs and /themes reside\n    string dataDirPath = ( options.getDataDir().empty() ) ?  Platform::getAppPath() :options.getDataDir();\n\n    if ( options.printVersion() )\n    {\n        printVersionInfo();\n        return EXIT_SUCCESS;\n    }\n\n    dataDir.initSearchDirectories ( dataDirPath );\n\n    if ( options.printHelp() )\n    {\n        Help::printHelp();\n        return EXIT_SUCCESS;\n    }\n\n    if ( options.printConfigInfo() )\n    {\n        printConfigInfo ( );\n        return EXIT_SUCCESS;\n    }\n\n    if ( options.showThemes() )\n    {\n        return printInstalledFiles(dataDir.getThemePath(), \"*.theme\", \"themes\", OPT_STYLE) ?EXIT_SUCCESS:EXIT_FAILURE;\n    }\n    if ( options.showPlugins() )\n    {\n        return printInstalledFiles(dataDir.getPluginPath(), \"*.lua\", \"plug-ins\", OPT_PLUGIN) ?EXIT_SUCCESS:EXIT_FAILURE;\n    }\n\n    //call before printInstalledLanguages!\n    loadFileTypeConfig ( \"filetypes\", &extensions, &scriptShebangs );\n\n    if ( options.showLangdefs() )\n    {\n        return printInstalledLanguages();\n    }\n\n    const  vector <string> inFileList=options.getInputFileNames();\n\n    if ( options.enableBatchMode() && inFileList[0].empty() )\n    {\n        return EXIT_FAILURE;\n    }\n\n    string themePath=options.getAbsThemePath().empty() ? dataDir.getThemePath ( options.getThemeName() ): options.getAbsThemePath();\n\n    auto_ptr<highlight::CodeGenerator> generator ( highlight::CodeGenerator::getInstance ( options.getOutputType() ) );\n\n    generator->setHTMLAttachAnchors ( options.attachLineAnchors() );\n    generator->setHTMLOrderedList ( options.orderedList() );\n    generator->setHTMLInlineCSS ( options.inlineCSS() );\n    generator->setHTMLEnclosePreTag ( options.enclosePreTag() );\n    generator->setHTMLAnchorPrefix ( options.getAnchorPrefix() );\n    generator->setHTMLClassName ( options.getClassName() );\n\n    generator->setLATEXReplaceQuotes ( options.replaceQuotes() );\n    generator->setLATEXNoShorthands ( options.disableBabelShorthands() );\n    generator->setLATEXPrettySymbols ( options.prettySymbols() );\n\n    generator->setRTFPageSize ( options.getPageSize() );\n    generator->setRTFCharStyles ( options.includeCharStyles() );\n\n    generator->setSVGSize ( options.getSVGWidth(),  options.getSVGHeight() );\n\n    if (options.useCRDelimiter())\n        generator->setEOLDelimiter('\\r');\n\n    generator->setValidateInput ( options.validateInput() );\n    generator->setNumberWrappedLines ( options.numberWrappedLines() );\n\n    generator->setStyleInputPath ( options.getStyleInFilename() );\n    generator->setStyleOutputPath ( options.getStyleOutFilename() );\n    generator->setIncludeStyle ( options.includeStyleDef() );\n    generator->setPrintLineNumbers ( options.printLineNumbers(), options.getNumberStart() );\n    generator->setPrintZeroes ( options.fillLineNrZeroes() );\n    generator->setFragmentCode ( options.fragmentOutput() );\n    generator->setPreformatting ( options.getWrappingStyle(),\n                                  ( generator->getPrintLineNumbers() ) ?\n                                  options.getLineLength() - options.getNumberWidth() : options.getLineLength(),\n                                  options.getNumberSpaces() );\n\n    generator->setEncoding ( options.getEncoding() );\n    generator->setBaseFont ( options.getBaseFont() ) ;\n    generator->setBaseFontSize ( options.getBaseFontSize() ) ;\n    generator->setLineNumberWidth ( options.getNumberWidth() );\n    generator->setStartingNestedLang( options.getStartNestedLang());\n    generator->disableTrailingNL(options.disableTrailingNL());\n    generator->setPluginReadFile(options.getPluginReadFilePath());\n\n\n    bool styleFileWanted = !options.fragmentOutput() || options.styleOutPathDefined();\n\n    const  vector <string> pluginFileList=collectPluginPaths( options.getPluginPaths());\n    for (unsigned int i=0; i<pluginFileList.size(); i++) {\n        if ( !generator->initPluginScript(pluginFileList[i]) )\n        {\n            cerr << \"highlight: \"\n                 << generator->getPluginScriptError()\n                 << \" in \"\n                 << pluginFileList[i]\n                 <<\"\\n\";\n            return EXIT_FAILURE;\n        }\n    }\n\n    if ( !generator->initTheme ( themePath ) )\n    {\n        cerr << \"highlight: \"\n             << generator->getThemeInitError()\n             << \"\\n\";\n        return EXIT_FAILURE;\n    }\n\n    if ( options.printOnlyStyle() )\n    {\n        if (!options.formatSupportsExtStyle()) {\n            cerr << \"highlight: output format supports no external styles.\\n\";\n            return EXIT_FAILURE;\n        }\n        bool useStdout =  options.getStyleOutFilename() ==\"stdout\";\n        string cssOutFile=options.getOutDirectory()  + options.getStyleOutFilename();\n        bool success=generator->printExternalStyle ( useStdout?\"\":cssOutFile );\n        if ( !success )\n        {\n            cerr << \"highlight: Could not write \" << cssOutFile <<\".\\n\";\n            return EXIT_FAILURE;\n        }\n        return EXIT_SUCCESS;\n    }\n\n    bool formattingEnabled = generator->initIndentationScheme ( options.getIndentScheme() );\n\n    if ( !formattingEnabled && !options.getIndentScheme().empty() )\n    {\n        cerr << \"highlight: Undefined indentation scheme \"\n             << options.getIndentScheme()\n             << \".\\n\";\n        return EXIT_FAILURE;\n    }\n\n    string outDirectory = options.getOutDirectory();\n#ifndef WIN32\n    ifstream dirTest ( outDirectory.c_str() );\n    if ( !outDirectory.empty() && !options.quietMode() && !dirTest )\n    {\n        cerr << \"highlight: Output directory \\\"\"\n             << outDirectory\n             << \"\\\" does not exist.\\n\";\n        return EXIT_FAILURE;\n    }\n    dirTest.close();\n#endif\n\n    bool initError=false, IOError=false;\n    unsigned int fileCount=inFileList.size(),\n                 fileCountWidth=getNumDigits ( fileCount ),\n                 i=0,\n                 numBadFormatting=0,\n                 numBadInput=0,\n                 numBadOutput=0;\n\n    vector<string> badFormattedFiles, badInputFiles, badOutputFiles;\n    std::set<string> usedFileNames;\n    string inFileName, outFilePath;\n    string suffix, lastSuffix;\n\n    if ( options.syntaxGiven() )  // user defined language definition, valid for all files\n    {\n        suffix = guessFileType ( options.getSyntax(), \"\", true );\n    }\n\n    while ( i < fileCount && !initError )\n    {\n        if ( !options.syntaxGiven() )  // determine file type for each file\n        {\n            suffix = guessFileType ( getFileSuffix ( inFileList[i] ), inFileList[i] );\n        }\n        if ( suffix.empty()  && options.forceOutput()) suffix=\"txt\"; //avoid segfault\n        if ( suffix.empty() )\n        {\n            if ( !options.enableBatchMode() )\n                cerr << \"highlight: Undefined language definition. Use --\"\n                     << OPT_SYNTAX << \" option.\\n\";\n            if ( !options.forceOutput() )\n            {\n                initError = true;\n                break;\n            }\n        }\n\n        if ( suffix != lastSuffix )\n        {\n            string langDefPath=options.getAbsLangPath().empty() ? dataDir.getLangPath ( suffix+\".lang\" ) : options.getAbsLangPath();\n\n            highlight::LoadResult loadRes= generator-> loadLanguage( langDefPath );\n\n            if ( loadRes==highlight::LOAD_FAILED_REGEX )\n            {\n                cerr << \"highlight: Regex error ( \"\n                     << generator->getSyntaxRegexError()\n                     << \" ) in \"<<suffix<<\".lang\\n\";\n                initError = true;\n                break;\n            }\n            else if ( loadRes==highlight::LOAD_FAILED_LUA )\n            {\n                cerr << \"highlight: Lua error ( \"\n                     << generator->getSyntaxLuaError()\n                     << \" ) in \"<<suffix<<\".lang\\n\";\n                initError = true;\n                break;\n            }\n            else if ( loadRes==highlight::LOAD_FAILED )\n            {\n                // do also ignore error msg if --syntax parameter should be skipped\n                if ( ! (options.quietMode() || options.isSkippedExt ( suffix )) )\n                {\n                    cerr << \"highlight: Unknown source file extension \\\"\"\n                         << suffix\n                         << \"\\\".\\n\";\n                }\n                if ( !options.forceOutput() )\n                {\n                    initError = true;\n                    break;\n                }\n            }\n            if ( options.printDebugInfo() && loadRes==highlight::LOAD_OK )\n            {\n                printDebugInfo ( generator->getSyntaxReader(), langDefPath );\n            }\n            lastSuffix = suffix;\n        }\n\n        string::size_type pos= ( inFileList[i] ).find_last_of ( Platform::pathSeparator );\n        inFileName = inFileList[i].substr ( pos+1 );\n\n        if ( options.enableBatchMode() )\n        {\n            if (usedFileNames.count(inFileName)) {\n                string prefix=inFileList[i].substr (0, pos+1 );\n                replace (prefix.begin(), prefix.end(), Platform::pathSeparator, '_');\n                inFileName.insert(0, prefix);\n            } else {\n                usedFileNames.insert(inFileName);\n            }\n            outFilePath = outDirectory;\n            outFilePath += inFileName;\n            outFilePath += options.getOutFileSuffix();\n\n            if ( !options.quietMode() )\n            {\n                if ( options.printProgress() )\n                {\n                    printProgressBar ( fileCount, i+1 );\n                }\n                else\n                {\n                    printCurrentAction ( outFilePath, fileCount, i+1, fileCountWidth );\n                }\n            }\n        }\n        else\n        {\n            outFilePath = options.getSingleOutFilename();\n            if ( outFilePath.size() && outFilePath==options.getSingleInFilename() )\n            {\n                cerr \t<< \"highlight: Output path equals input path: \\\"\"\n                        << outFilePath << \"\\\".\\n\";\n                initError = true;\n                break;\n            }\n\n        }\n\n        if ( options.useFNamesAsAnchors() )\n        {\n            generator->setHTMLAnchorPrefix ( inFileName );\n        }\n\n        generator->setTitle ( options.getDocumentTitle().empty() ?\n                              inFileList[i]:options.getDocumentTitle() );\n\n        generator->setKeyWordCase ( options.getKeywordCase() );\n\n        highlight::ParseError error = generator->generateFile ( inFileList[i], outFilePath );\n\n        if ( error==highlight::BAD_INPUT )\n        {\n            if ( numBadInput++ < IO_ERROR_REPORT_LENGTH || options.printDebugInfo() )\n            {\n                badInputFiles.push_back ( inFileList[i] );\n            }\n        }\n        else if ( error==highlight::BAD_OUTPUT )\n        {\n            if ( numBadOutput++ < IO_ERROR_REPORT_LENGTH || options.printDebugInfo() )\n            {\n                badOutputFiles.push_back ( outFilePath );\n            }\n        }\n        if ( formattingEnabled && !generator->formattingIsPossible() )\n        {\n            if ( numBadFormatting++ < IO_ERROR_REPORT_LENGTH || options.printDebugInfo() )\n            {\n                badFormattedFiles.push_back ( outFilePath );\n            }\n        }\n        ++i;\n    }\n\n\n    if ( i &&   !options.includeStyleDef()\n            && styleFileWanted\n            && options.formatSupportsExtStyle() )\n    {\n        string cssOutFile=outDirectory  + options.getStyleOutFilename();\n        bool success=generator->printExternalStyle ( cssOutFile );\n        if ( !success )\n        {\n            cerr << \"highlight: Could not write \" << cssOutFile <<\".\\n\";\n            IOError = true;\n        }\n    }\n\n    if ( i && options.printIndexFile() )\n    {\n        bool success=generator -> printIndexFile ( inFileList, outDirectory );\n        if ( !success )\n        {\n            cerr << \"highlight: Could not write index file.\\n\";\n            IOError = true;\n        }\n    }\n\n    if ( numBadInput )\n    {\n        printIOErrorReport ( numBadInput, badInputFiles, \"read input\" );\n        IOError = true;\n    }\n    if ( numBadOutput )\n    {\n        printIOErrorReport ( numBadOutput, badOutputFiles, \"write output\" );\n        IOError = true;\n    }\n    if ( numBadFormatting )\n    {\n        printIOErrorReport ( numBadFormatting, badFormattedFiles, \"reformat\" );\n    }\n    return ( initError || IOError ) ? EXIT_FAILURE : EXIT_SUCCESS;\n}\n\nint main ( const int argc, const char *argv[] )\n{\n    HLCmdLineApp app;\n    return app.run ( argc, argv );\n}\n"
  },
  {
    "path": "jni/highlight/cli/main.h",
    "content": "\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef HIGHLIGHT_APP\n#define HIGHLIGHT_APP\n\n\n#include <iostream>\n#include <fstream>\n#include <string>\n#include <vector>\n#include <map>\n#include <iomanip>\n#include <cassert>\n\n#include \"cmdlineoptions.h\"\n#include \"codegenerator.h\"\n#include \"help.h\"\n#include \"datadir.h\"\n#include \"version.h\"\n#include \"platform_fs.h\"\n\n#define IO_ERROR_REPORT_LENGTH 5\n#define SHEBANG_CNT 12\n\ntypedef map<string, string> StringMap;\n\n/// Main application class of the command line interface\n\nclass HLCmdLineApp\n{\n\n\tpublic:\n\n\t\tHLCmdLineApp() {};\n\t\t~HLCmdLineApp() {};\n\n\t\t/** Start application\n\t\t  \\param argc Number of command line arguments\n\t\t  \\param argv values of command line arguments\n\t\t  \\return EXIT_SUCCESS or EXIT_FAILURE\n\t\t*/\n\t\tint run ( const int argc, const char *argv[] );\n\n\tprivate:\n\n\t\tDataDir dataDir;\n\t\tStringMap extensions;\n\t\tStringMap scriptShebangs;\n\t\tstringstream cin_bufcopy;\n\n\t\t/** print version info*/\n\t\tvoid printVersionInfo();\n\n\t\t/** print configuration info*/\n\t\tvoid printConfigInfo ();\n\n\t\t/** print error message*/\n\t\tvoid printBadInstallationInfo();\n\n\t\t/** print input and output errors */\n\t\tvoid printIOErrorReport ( unsigned int numberErrorFiles, vector<string> & fileList, const string &action );\n\n\t\t/** list installed  files\n\t\t    \\return true if files were found\n\t\t*/\n\t\tint printInstalledFiles(const string& where, const string& wildcard, const string& what, const string&option);\n\n\t\t/** list installed language definition files\n\t\t    \\return true if lang files were found\n\t\t*/\n\t\tint printInstalledLanguages();\n\n\t\t/** print debug information\n\t\t    \\param  lang language definition\n\t\t    \\param langDefPath path to language definition\n\t\t*/\n\t\tvoid printDebugInfo ( const highlight::SyntaxReader *lang,\n\t\t                      const string &langDefPath );\n\n\t\tstring getFileSuffix ( const string &fileName );\n\n\t\tstring guessFileType ( const string &suffix, const string &inputFile=\"\", bool useUserSuffix=false );\n\n\t\tint getNumDigits ( int i );\n\n\t\tvoid printProgressBar ( int total, int count );\n\t\tvoid printCurrentAction ( const string&outfilePath,\n\t\t                          int total, int count, int countWidth );\n\n\t\tbool readInputFilePaths ( vector<string> &fileList, string wildcard,\n\t\t                          bool recursiveSearch );\n\n\t\tstring analyzeFile ( const string& file );\n\t\tbool loadFileTypeConfig ( const string& name, StringMap* map, StringMap* shebangMap );\n\t\tvoid printInstalledFiles();\n\t\t\n\t\tvector <string> collectPluginPaths(const vector<string>& plugins);\n\n};\n\n#endif\n"
  },
  {
    "path": "jni/highlight/core/Diluculum/InternalUtils.cpp",
    "content": "/******************************************************************************\\\n* InternalUtils.cpp                                                            *\n* Miscellaneous utilities used internally by Diluculum.                        *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n\n#include \"InternalUtils.hpp\"\n#include <Diluculum/LuaUtils.hpp>\n#include <cstring>\n#include <boost/lexical_cast.hpp>\n\nnamespace Diluculum\n{\n   namespace Impl\n   {\n      // - CallFunctionOnTop ---------------------------------------------------\n      LuaValueList CallFunctionOnTop (lua_State* ls, const LuaValueList& params)\n      {\n         int topBefore = lua_gettop (ls);\n\n         if (lua_type (ls, -1) != LUA_TFUNCTION)\n            throw TypeMismatchError (\"function\", luaL_typename (ls, -1));\n\n         typedef LuaValueList::const_iterator iter_t;\n         for (iter_t p = params.begin(); p != params.end(); ++p)\n            PushLuaValue (ls, *p);\n\n         int status = lua_pcall (ls, params.size(), LUA_MULTRET, 0);\n\n         ThrowOnLuaError (ls, status);\n\n         int numResults = lua_gettop (ls) - topBefore + 1;\n\n         LuaValueList results;\n\n         for (int i = numResults; i > 0; --i)\n            results.push_back (ToLuaValue (ls, -i));\n\n         lua_pop (ls, numResults);\n\n         return results;\n      }\n\n\n\n      // - ThrowOnLuaError -----------------------------------------------------\n      void ThrowOnLuaError (lua_State* ls, int statusCode)\n      {\n         if (statusCode != 0)\n         {\n            std::string errorMessage;\n            if (lua_isstring (ls, -1))\n            {\n               errorMessage = lua_tostring (ls, -1);\n               lua_pop (ls, 1);\n            }\n            else\n            {\n               errorMessage =\n                  \"Sorry, there is no additional information about this error.\";\n            }\n\n            switch (statusCode)\n            {\n               case LUA_ERRRUN:\n                  throw LuaRunTimeError (errorMessage.c_str());\n               case LUA_ERRFILE:\n                  throw LuaFileError (errorMessage.c_str());\n               case LUA_ERRSYNTAX:\n                  throw LuaSyntaxError (errorMessage.c_str());\n               case LUA_ERRMEM:\n                  throw LuaMemoryError (errorMessage.c_str());\n               case LUA_ERRERR:\n                  throw LuaErrorError (errorMessage.c_str());\n               default:\n                  throw LuaError (\"Unknown Lua return code passed \"\n                                  \"to 'Diluculum::Impl::ThrowOnLuaError()'.\");\n            }\n         }\n      }\n\n\n\n      // - LuaFunctionWriter ---------------------------------------------------\n      int LuaFunctionWriter(lua_State* luaState, const void* data, size_t size,\n                            void* func)\n      {\n         Diluculum::LuaFunction* f =\n            reinterpret_cast<Diluculum::LuaFunction*>(func);\n\n         size_t newSize = f->getSize() + size;\n\n         boost::scoped_array<char> buff (new char[newSize]);\n\n         memcpy (buff.get(), f->getData(), f->getSize());\n         memcpy (buff.get() + f->getSize(), data, size);\n\n         f->setData (buff.get(), newSize);\n\n         return 0;\n      }\n\n\n\n      // - LuaFunctionReader ---------------------------------------------------\n      const char* LuaFunctionReader(lua_State* luaState, void* func,\n                                    size_t* size)\n      {\n         Diluculum::LuaFunction* f =\n            reinterpret_cast<Diluculum::LuaFunction*>(func);\n\n         if (f->getReaderFlag())\n            return 0;\n\n         f->setReaderFlag (true); // return 0 on the next call\n\n         *size = f->getSize();\n         return reinterpret_cast<const char*>(f->getData());\n      }\n\n   } // namespace Impl\n\n} // namespace Diluculum\n"
  },
  {
    "path": "jni/highlight/core/Diluculum/InternalUtils.hpp",
    "content": "/******************************************************************************\\\n* InternalUtils.hpp                                                            *\n* Miscellaneous utilities used internally by Diluculum.                        *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#ifndef _DILUCULUM_INTERNAL_UTILS_HPP_\n#define _DILUCULUM_INTERNAL_UTILS_HPP_\n\n#include <Diluculum/LuaState.hpp>\n\n\nnamespace Diluculum\n{\n   namespace Impl\n   {\n      /** Calls the function on the top of the stack, passing the given\n       *  parameters. Returns the values returned by the called function.\n       *  @param ls The Lua state from where the Lua function will be taken, and\n       *         where the function will be executed.\n       *  @param params The parameters to be passed to the function.\n       */\n      LuaValueList CallFunctionOnTop (lua_State* ls, const LuaValueList& params);\n\n      /** Throws an exception if the status code passed as parameter corresponds\n       *  to an error code from a function from the Lua API.  The exception\n       *  thrown is of the proper type, that is, of the subclass of \\c LuaError\n       *  that best describes the error. Furthermore, the string associated with\n       *  the exception (the \\c what parameter) is set to whatever Lua returned\n       *  as the error message.\n       *  <p>If the number passed as parameter is 0 (which is the code for \"no\n       *  error\"), the function does nothing.\n       *  @param statusCode The return code for some Lua API function; that's\n       *         the value we want to check for \"errorness\".\n       *  @param ls The Lua state on which the function that generated the\n       *         status code being tested was called. This is used just to get a\n       *         nice error message, if an error did actually happen.\n       *  @throw LuaRunTimeError If <tt>retCode == LUA_ERRRUN</tt>.\n       *  @throw LuaFileError If <tt>retCode == LUA_ERRFILE</tt>.\n       *  @throw LuaRunTimeError If <tt>retCode == LUA_ERRRUN</tt>.\n       *  @throw LuaSyntaxError If <tt>retCode == LUA_ERRSYNTAX</tt>.\n       *  @throw LuaMemoryError If <tt>retCode == LUA_ERRMEM</tt>.\n       *  @throw LuaError If \\c retCode is not a recognized Lua error code.\n       */\n      void ThrowOnLuaError (lua_State* ls, int statusCode);\n\n      /** The \\c lua_Writer used in the calls to \\c lua_dump() when converting a\n       * function implemented in Lua to a \\c LuaFunction.\n       */\n      int LuaFunctionWriter(lua_State* luaState, const void* data, size_t size,\n                            void* func);\n\n      /** The \\c lua_Reader used to get Lua bytecode from a \\c LuaFunction. This\n       *  is used by \\c LuaState::call();\n       */\n      const char* LuaFunctionReader(lua_State* luaState, void* func,\n                                    size_t* size);\n   }\n\n} // namespace Diluculum\n\n\n#endif // _DILUCULUM_INTERNAL_UTILS_HPP_\n"
  },
  {
    "path": "jni/highlight/core/Diluculum/LuaExceptions.cpp",
    "content": "/******************************************************************************\\\n* LuaExceptions.hpp                                                            *\n* Exceptions related to Lua errors.                                            *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#include <Diluculum/LuaExceptions.hpp>\n\nnamespace Diluculum\n{\n   // - TypeMismatchError::TypeMismatchError -----------------------------------\n   TypeMismatchError::TypeMismatchError (const std::string& expectedType,\n                                         const std::string& foundType)\n      : LuaError ((\"Type mismatch: '\" + expectedType\n                   + \"' was expected but '\" + foundType\n                   + \"' was found.\").c_str()),\n        expectedType_ (expectedType), foundType_(foundType)\n   { }\n\n} // namespace Diluculum\n"
  },
  {
    "path": "jni/highlight/core/Diluculum/LuaFunction.cpp",
    "content": "/******************************************************************************\\\n* LuaFunction.cpp                                                              *\n* A C++ equivalent of a Lua function.                                          *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#include <Diluculum/LuaFunction.hpp>\n#include <cstring>\n\n\nnamespace Diluculum\n{\n   // - LuaFunction::LuaFunction -----------------------------------------------\n   LuaFunction::LuaFunction (const std::string& luaChunk)\n      : functionType_(LUA_LUA_FUNCTION), size_(luaChunk.size()),\n        data_(new char[size_])\n   {\n      memcpy(data_.get(), luaChunk.c_str(), size_);\n   }\n\n   LuaFunction::LuaFunction (const void* data, size_t size)\n      : functionType_(LUA_LUA_FUNCTION), size_(size), data_(new char[size_])\n   {\n      memcpy(data_.get(), data, size);\n   }\n\n   LuaFunction::LuaFunction (lua_CFunction func)\n      : functionType_(LUA_C_FUNCTION), size_(sizeof(lua_CFunction)),\n        data_(new char[sizeof(lua_CFunction)])\n   {\n      memcpy(data_.get(), reinterpret_cast<lua_CFunction*>(&func),\n             sizeof(lua_CFunction));\n   }\n\n   LuaFunction::LuaFunction (const LuaFunction& other)\n      : functionType_(other.functionType_),\n        size_(other.getSize()), data_(new char[size_])\n   {\n      memcpy (data_.get(), other.getData(), getSize());\n   }\n\n\n\n   // - LuaFunction::getCFunction ----------------------------------------------\n   lua_CFunction LuaFunction::getCFunction() const\n   {\n      assert(functionType_ == LUA_C_FUNCTION\n             && \"Called LuaFunction::getCFunction() for a non-C function.\");\n\n      return *reinterpret_cast<lua_CFunction*>(data_.get());\n   }\n\n\n\n   // - LuaFunction::setData ---------------------------------------------------\n   void LuaFunction::setData (void* data, size_t size)\n   {\n      size_ = size;\n      data_.reset (new char[size]);\n      memcpy(data_.get(), data, size);\n   }\n\n\n\n   // - LuaFunction::operator= -------------------------------------------------\n   const LuaFunction& LuaFunction::operator= (const LuaFunction& rhs)\n   {\n      size_ = rhs.getSize();\n      functionType_ = rhs.functionType_;\n      data_.reset (new char[getSize()]);\n      memcpy (getData(), rhs.getData(), getSize());\n      return *this;\n   }\n\n\n\n   // - LuaFunction::operator> -------------------------------------------------\n   bool LuaFunction::operator> (const LuaFunction& rhs) const\n   {\n      if (functionType_ > rhs.functionType_)\n         return true;\n      else if (getSize() > rhs.getSize())\n         return true;\n      else if (getSize() < rhs.getSize())\n         return false;\n      else // getSize() == rhs.getSize()\n         return memcmp (getData(), rhs.getData(), getSize()) > 0;\n   }\n\n\n\n   // - LuaFunction::operator< -------------------------------------------------\n   bool LuaFunction::operator< (const LuaFunction& rhs) const\n   {\n      if (functionType_ < rhs.functionType_)\n         return true;\n      else if (getSize() < rhs.getSize())\n         return true;\n      else if (getSize() > rhs.getSize())\n         return false;\n      else // getSize() == rhs.getSize()\n         return memcmp (getData(), rhs.getData(), getSize()) < 0;\n   }\n\n\n\n   // - LuaFunction::operator== ------------------------------------------------\n   bool LuaFunction::operator== (const LuaFunction& rhs) const\n   {\n      return functionType_ == rhs.functionType_\n         && getSize() == rhs.getSize()\n         && memcmp (getData(), rhs.getData(), getSize()) == 0;\n   }\n\n\n\n   // - LuaFunction::operator!= ------------------------------------------------\n   bool LuaFunction::operator!= (const LuaFunction& rhs) const\n   {\n      return functionType_ != rhs.functionType_\n         || getSize() != rhs.getSize()\n         || memcmp (getData(), rhs.getData(), getSize()) != 0;\n   }\n\n} // namespace Diluculum\n"
  },
  {
    "path": "jni/highlight/core/Diluculum/LuaState.cpp",
    "content": "/******************************************************************************\\\n* LuaState                                                                     *\n* A pleasant way to use a Lua state in C++.                                    *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#include <cassert>\n#include <cstring>\n#include <typeinfo>\n#include <boost/lexical_cast.hpp>\n#include <Diluculum/LuaState.hpp>\n#include <Diluculum/LuaUtils.hpp>\n#include \"InternalUtils.hpp\"\n\n\nnamespace Diluculum\n{\n   // - LuaState::LuaState -----------------------------------------------------\n   LuaState::LuaState (bool loadStdLib)\n      : state_(0), ownsState_(true)\n   {\n      state_ = luaL_newstate();\n      if (state_ == 0)\n         throw LuaError (\"Error opening Lua state.\");\n\n      if (loadStdLib)\n         luaL_openlibs (state_);\n   }\n\n\n   LuaState::LuaState (lua_State* state, bool loadStdLib)\n      : state_(state), ownsState_(false)\n   {\n      if (state_ == 0)\n         throw LuaError (\"Constructor of 'LuaState' got a NULL pointer.\");\n\n      if (loadStdLib)\n         luaL_openlibs (state_);\n   }\n\n\n\n   // - LuaState::~LuaState ----------------------------------------------------\n   LuaState::~LuaState()\n   {\n      if (ownsState_ && state_ != 0)\n         lua_close (state_);\n   }\n\n\n\n   // - LuaState::doStringOrFile -----------------------------------------------\n   LuaValueList LuaState::doStringOrFile (bool isString, const std::string& str)\n   {\n      const int stackSizeAtBeginning = lua_gettop (state_);\n\n      if (isString)\n      {\n         Impl::ThrowOnLuaError (state_, luaL_loadbuffer (state_, str.c_str(),\n                                                         str.length(), \"line\"));\n      }\n      else\n      {\n         Impl::ThrowOnLuaError (state_, luaL_loadfile (state_, str.c_str()));\n      }\n\n      Impl::ThrowOnLuaError (state_, lua_pcall (state_, 0, LUA_MULTRET, 0));\n\n      const int numResults = lua_gettop (state_) - stackSizeAtBeginning;\n\n      LuaValueList results;\n\n      for (int i = numResults; i > 0; --i)\n         results.push_back (ToLuaValue (state_, -i));\n\n      lua_pop (state_, numResults);\n\n      return results;\n   }\n\n\n\n   // - LuaState::call ---------------------------------------------------------\n   LuaValueList LuaState::call (LuaFunction& func,\n                                const LuaValueList& params,\n                                const std::string& chunkName)\n   {\n      func.setReaderFlag (false);\n      PushLuaValue (state_, LuaValue (func));\n      return Impl::CallFunctionOnTop (state_, params);\n   }\n\n\n   // - LuaState::operator[] ---------------------------------------------------\n   LuaVariable LuaState::operator[] (const std::string& variable)\n   {\n      assert(variable != \"_G\" && \"Can't access '_G'; use LuaState::globals().\");\n\n      return LuaVariable (state_, variable);\n   }\n\n\n   // - LuaState::globals ------------------------------------------------------\n   LuaValueMap LuaState::globals()\n   {\n      // Traverse the globals table adding the key/value pairs to 'ret'\n      LuaValueMap ret;\n\n#if LUA_VERSION_NUM >= 502\n      // Obtain global table\n      lua_rawgeti (state_, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);\n#endif\n      \n      lua_pushnil (state_);\n      \n#if LUA_VERSION_NUM >= 502\n      while (lua_next (state_, -2) != 0)\n#else\n      while (lua_next (state_, LUA_GLOBALSINDEX) != 0)\n#endif\n      {\n         // Exclude from the results the tables that would result in infinite\n         // recursion\n         if (lua_type (state_, -2) == LUA_TSTRING)\n         {\n            const char* key = lua_tostring(state_, -2);\n            if (strcmp(key, \"_G\") == 0\n                || strcmp(key, \"package\") == 0)\n            {\n               lua_pop (state_, 1);\n               continue;\n            }\n         }\n\n         ret[ToLuaValue (state_, -2)] = ToLuaValue (state_, -1);\n\n         lua_pop (state_, 1);\n      }\n      \n#if LUA_VERSION_NUM >= 502\n      // Remove global table\n      lua_remove (state_, -2);\n#endif\n      // Alright, return the result\n      return ret;\n   }\n\n} // namespace Diluculum\n"
  },
  {
    "path": "jni/highlight/core/Diluculum/LuaUserData.cpp",
    "content": "/******************************************************************************\\\n* LuaUserData.cpp                                                              *\n* A C++ equivalent of a Lua userdata.                                          *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#include <Diluculum/LuaUserData.hpp>\n#include <cstring>\n\n\nnamespace Diluculum\n{\n   // - LuaUserData::LuaUserData -----------------------------------------------\n   LuaUserData::LuaUserData (size_t size)\n      : size_(size), data_ (new char[size_])\n   { }\n\n\n   LuaUserData::LuaUserData (const LuaUserData& other)\n      : size_(other.getSize()), data_ (new char[size_])\n   {\n      memcpy (data_.get(), other.getData(), getSize());\n   }\n\n\n\n   // - LuaUserData::operator= -------------------------------------------------\n   const LuaUserData& LuaUserData::operator= (const LuaUserData& rhs)\n   {\n      size_ = rhs.getSize();\n      data_.reset (new char[getSize()]);\n      memcpy (getData(), rhs.getData(), getSize());\n      return *this;\n   }\n\n\n\n   // - LuaUserData::operator> -------------------------------------------------\n   bool LuaUserData::operator> (const LuaUserData& rhs) const\n   {\n      if (getSize() > rhs.getSize())\n         return true;\n      else if (getSize() < rhs.getSize())\n         return false;\n      else // getSize() == rhs.getSize()\n         return memcmp (getData(), rhs.getData(), getSize()) > 0;\n   }\n\n\n\n   // - LuaUserData::operator< -------------------------------------------------\n   bool LuaUserData::operator< (const LuaUserData& rhs) const\n   {\n      if (getSize() < rhs.getSize())\n         return true;\n      else if (getSize() > rhs.getSize())\n         return false;\n      else // getSize() == rhs.getSize()\n         return memcmp (getData(), rhs.getData(), getSize()) < 0;\n   }\n\n\n\n   // - LuaUserData::operator== ------------------------------------------------\n   bool LuaUserData::operator== (const LuaUserData& rhs) const\n   {\n      return getSize() == rhs.getSize()\n         && memcmp (getData(), rhs.getData(), getSize()) == 0;\n   }\n\n\n\n   // - LuaUserData::operator!= ------------------------------------------------\n   bool LuaUserData::operator!= (const LuaUserData& rhs) const\n   {\n      return getSize() != rhs.getSize()\n         || memcmp (getData(), rhs.getData(), getSize()) != 0;\n   }\n\n} // namespace Diluculum\n"
  },
  {
    "path": "jni/highlight/core/Diluculum/LuaUtils.cpp",
    "content": "/******************************************************************************\\\n* LuaUtils.cpp                                                                 *\n* Some utilities related to Lua.                                               *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#include <cstring>\n#include <Diluculum/LuaUtils.hpp>\n#include <Diluculum/LuaExceptions.hpp>\n#include <boost/lexical_cast.hpp>\n#include \"InternalUtils.hpp\"\n\n\nnamespace Diluculum\n{\n   // - ToLuaValue -------------------------------------------------------------\n   LuaValue ToLuaValue (lua_State* state, int index)\n   {\n      switch (lua_type (state, index))\n      {\n         case LUA_TNIL:\n            return Nil;\n\n         case LUA_TNUMBER:\n            return lua_tonumber (state, index);\n\n         case LUA_TBOOLEAN:\n            // this (instead of a cast) avoids a warning on Visual C++\n            return lua_toboolean (state, index) != 0;\n\n         case LUA_TSTRING:\n            return std::string(lua_tostring (state, index),\n#if LUA_VERSION_NUM >= 502\n                lua_rawlen(state, index));\n#else\n                lua_objlen(state, index));\n#endif\n         case LUA_TUSERDATA:\n         {\n            void* addr = lua_touserdata (state, index);\n#if LUA_VERSION_NUM >= 502\n\t    size_t size = lua_rawlen(state, index);\n#else\n            size_t size = lua_objlen (state, index);\n#endif\n            LuaUserData ud (size);\n            memcpy (ud.getData(), addr, size);\n            return ud;\n         }\n\n         case LUA_TTABLE:\n         {\n            // Make the index positive if necessary (using a negative index here\n            // will be *bad*, because the stack will be changed in the\n            // 'lua_next()' and a negative index will mess everything).\n            if (index < 0)\n               index = lua_gettop(state) + index + 1;\n\n            // Traverse the table adding the key/value pairs to 'ret'\n            LuaValueMap ret;\n\n            lua_pushnil (state);\n            while (lua_next (state, index) != 0)\n            {\n               ret[ToLuaValue (state, -2)] = ToLuaValue (state, -1);\n               lua_pop (state, 1);\n            }\n\n            // Alright, return the result\n            return ret;\n         }\n\n         case LUA_TFUNCTION:\n         {\n            if (lua_iscfunction (state, index))\n            {\n               return lua_tocfunction (state, index);\n            }\n            else\n            {\n               LuaFunction func(\"\", 0);\n               lua_pushvalue (state, index);\n\n#if LUA_VERSION_NUM >= 503\n               lua_dump(state, Impl::LuaFunctionWriter, &func, 0);\n#else\n               lua_dump(state, Impl::LuaFunctionWriter, &func);\n#endif\n               lua_pop(state, 1);\n               return func;\n            }\n         }\n\n         default:\n         {\n            throw LuaTypeError(\n               (\"Unsupported type found in call to 'ToLuaValue()': \"\n                + boost::lexical_cast<std::string>(lua_type (state, index))\n                + \" (typename: \\'\" + luaL_typename (state, index)\n                + \"')\").c_str());\n         }\n      }\n   }\n\n\n\n   // - PushLuaValue -----------------------------------------------------------\n   void PushLuaValue (lua_State* state, const LuaValue& value)\n   {\n      switch (value.type())\n      {\n         case LUA_TNIL:\n            lua_pushnil (state);\n            break;\n\n         case LUA_TNUMBER:\n            lua_pushnumber (state, value.asNumber());\n            break;\n\n         case LUA_TSTRING:\n         {\n            const std::string& tmp = value.asString();\n            lua_pushlstring (state, tmp.c_str(), tmp.length());\n            break;\n         }\n\n         case LUA_TBOOLEAN:\n            lua_pushboolean (state, value.asBoolean());\n            break;\n\n         case LUA_TUSERDATA:\n         {\n            size_t size = value.asUserData().getSize();\n            void* addr = lua_newuserdata (state, size);\n            memcpy (addr, value.asUserData().getData(), size);\n            break;\n         }\n\n         case LUA_TTABLE:\n         {\n            lua_newtable (state);\n\n            typedef LuaValueMap::const_iterator iter_t;\n            const LuaValueMap table = value.asTable();\n            for (iter_t p = table.begin(); p != table.end(); ++p)\n            {\n               if (p->first != Nil) // Ignore 'Nil'-indexed entries\n               {\n                  PushLuaValue (state, p->first);\n                  PushLuaValue (state, p->second);\n                  lua_settable (state, -3);\n               }\n            }\n\n            break;\n         }\n\n         case LUA_TFUNCTION:\n         {\n            const LuaFunction& f = value.asFunction();\n            if (f.isCFunction())\n            {\n               lua_pushcfunction (state, f.getCFunction());\n            }\n            else\n            {\n               LuaFunction* pf = const_cast<LuaFunction*>(&f); // yikes!\n               pf->setReaderFlag (false);\n               int status = lua_load (state, Impl::LuaFunctionReader, pf,\n#if LUA_VERSION_NUM >= 502\n                                      \"Diluculum Lua chunk\", NULL);\n#else\n                                      \"Diluculum Lua chunk\");\n#endif\n               Impl::ThrowOnLuaError (state, status);\n            }\n            break;\n         }\n\n         default:\n         {\n            throw LuaTypeError(\n               (\"Unsupported type found in call to 'PushLuaValue()': \"\n                + boost::lexical_cast<std::string>(value.type())\n                + \" (typename: \\'\" + value.typeName() + \"')\").c_str());\n         }\n      }\n   }\n\n} // namespace Diluculum\n"
  },
  {
    "path": "jni/highlight/core/Diluculum/LuaValue.cpp",
    "content": "/******************************************************************************\\\n* LuaValue.cpp                                                                 *\n* A class that somewhat mimics a Lua value.                                    *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#include <cstring>\n#include <Diluculum/LuaValue.hpp>\n#include <Diluculum/LuaExceptions.hpp>\n\n\nnamespace Diluculum\n{\n   // - LuaValue::LuaValue -----------------------------------------------------\n   LuaValue::LuaValue()\n      : dataType_(LUA_TNIL)\n   { }\n\n\n   LuaValue::LuaValue (bool b)\n      : dataType_(LUA_TBOOLEAN)\n   {\n      memcpy (data_, &b, sizeof(bool));\n   }\n\n\n   LuaValue::LuaValue (float n)\n      : dataType_(LUA_TNUMBER)\n   {\n      lua_Number num = static_cast<lua_Number>(n);\n      memcpy (data_, &num, sizeof(lua_Number));\n   }\n\n\n   LuaValue::LuaValue (double n)\n      : dataType_(LUA_TNUMBER)\n   {\n      lua_Number num = static_cast<lua_Number>(n);\n      memcpy (data_, &num, sizeof(lua_Number));\n   }\n\n\n   LuaValue::LuaValue (long double n)\n      : dataType_(LUA_TNUMBER)\n   {\n      lua_Number num = static_cast<lua_Number>(n);\n      memcpy (data_, &num, sizeof(lua_Number));\n   }\n\n\n   LuaValue::LuaValue (short n)\n      : dataType_(LUA_TNUMBER)\n   {\n      lua_Number num = static_cast<lua_Number>(n);\n      memcpy (data_, &num, sizeof(lua_Number));\n   }\n\n\n   LuaValue::LuaValue (unsigned short n)\n      : dataType_(LUA_TNUMBER)\n   {\n      lua_Number num = static_cast<lua_Number>(n);\n      memcpy (data_, &num, sizeof(lua_Number));\n   }\n\n\n   LuaValue::LuaValue (int n)\n      : dataType_(LUA_TNUMBER)\n   {\n      lua_Number num = static_cast<lua_Number>(n);\n      memcpy (data_, &num, sizeof(lua_Number));\n   }\n\n\n   LuaValue::LuaValue (unsigned n)\n      : dataType_(LUA_TNUMBER)\n   {\n      lua_Number num = static_cast<lua_Number>(n);\n      memcpy (data_, &num, sizeof(lua_Number));\n   }\n\n\n   LuaValue::LuaValue (long n)\n      : dataType_(LUA_TNUMBER)\n   {\n      lua_Number num = static_cast<lua_Number>(n);\n      memcpy (data_, &num, sizeof(lua_Number));\n   }\n\n\n   LuaValue::LuaValue (unsigned long n)\n      : dataType_(LUA_TNUMBER)\n   {\n      lua_Number num = static_cast<lua_Number>(n);\n      memcpy (data_, &num, sizeof(lua_Number));\n   }\n\n\n   LuaValue::LuaValue (const std::string& s)\n      : dataType_(LUA_TSTRING)\n   {\n      new(data_) std::string(s);\n   }\n\n\n   LuaValue::LuaValue (const char* s)\n      : dataType_(LUA_TSTRING)\n   {\n      new(data_) std::string(s);\n   }\n\n\n   LuaValue::LuaValue (const LuaValueMap& t)\n      : dataType_(LUA_TTABLE)\n   {\n      new(data_) LuaValueMap(t);\n   }\n\n\n   LuaValue::LuaValue (lua_CFunction f)\n      : dataType_(LUA_TFUNCTION)\n   {\n      new(data_) LuaFunction(f);\n   }\n\n\n   LuaValue::LuaValue (const LuaFunction& f)\n      : dataType_(LUA_TFUNCTION)\n   {\n      new(data_) LuaFunction(f);\n   }\n\n\n   LuaValue::LuaValue (const LuaUserData& ud)\n      : dataType_(LUA_TUSERDATA)\n   {\n      new(data_) LuaUserData(ud);\n   }\n\n\n   LuaValue::LuaValue (const LuaValueList& v)\n      // Avoids possible memory corruption during destroyObjectAtData\n      : dataType_(LUA_TNIL)\n   {\n      if (v.size() >= 1)\n         *this = v[0];\n      else\n         *this = Nil;\n   }\n\n\n   LuaValue::LuaValue (const LuaValue& other)\n      : dataType_ (other.dataType_)\n   {\n      switch (dataType_)\n      {\n         case LUA_TSTRING:\n            new(data_) std::string(other.asString());\n            break;\n\n         case LUA_TTABLE:\n            new(data_) LuaValueMap (other.asTable());\n            break;\n\n         case LUA_TUSERDATA:\n            new(data_) LuaUserData (other.asUserData());\n            break;\n\n         case LUA_TFUNCTION:\n            new(data_) LuaFunction (other.asFunction());\n            break;\n\n         default:\n            // no constructor needed.\n            memcpy (data_, other.data_, sizeof(PossibleTypes));\n            break;\n      }\n   }\n\n\n\n   // - LuaValue::operator= ----------------------------------------------------\n   LuaValue& LuaValue::operator= (const LuaValue& rhs)\n   {\n      destroyObjectAtData();\n\n      dataType_ = rhs.dataType_;\n\n      switch (dataType_)\n      {\n         case LUA_TSTRING:\n            new(data_) std::string (rhs.asString());\n            break;\n\n         case LUA_TTABLE:\n            new(data_) LuaValueMap (rhs.asTable());\n            break;\n\n         case LUA_TUSERDATA:\n            new(data_) LuaUserData (rhs.asUserData());\n            break;\n\n         case LUA_TFUNCTION:\n            new(data_) LuaFunction (rhs.asFunction());\n            break;\n\n         default:\n            // no constructor needed.\n            memcpy (data_, rhs.data_, sizeof(PossibleTypes));\n            break;\n      }\n\n      return *this;\n   }\n\n\n   const LuaValueList& LuaValue::operator= (const LuaValueList& rhs)\n   {\n      if (rhs.size() >= 1)\n         *this = rhs[0];\n      else\n         *this = Nil;\n\n      return rhs;\n   }\n\n\n\n   // - LuaValue::typeName -----------------------------------------------------\n   std::string LuaValue::typeName() const\n   {\n      switch (dataType_)\n      {\n         case LUA_TNIL:\n            return \"nil\";\n\n         case LUA_TBOOLEAN:\n            return \"boolean\";\n\n         case LUA_TNUMBER:\n            return \"number\";\n\n         case LUA_TSTRING:\n            return \"string\";\n\n         case LUA_TTABLE:\n            return \"table\";\n\n         case LUA_TFUNCTION:\n            return \"function\";\n\n         case LUA_TUSERDATA:\n            return \"userdata\";\n\n         default: // can't happen\n            assert (false\n                    && \"Invalid type found in a call to 'LuaValue::typeName()'.\");\n            return \"\"; // return something to make compilers happy.\n      }\n   }\n\n\n\n   // - LuaValue::asNumber() ---------------------------------------------------\n   lua_Number LuaValue::asNumber() const\n   {\n      if (dataType_ == LUA_TNUMBER)\n      {\n         const lua_Number* pn = reinterpret_cast<const lua_Number*>(&data_);\n         return *pn;\n      }\n      else\n      {\n         throw TypeMismatchError (\"number\", typeName());\n      }\n   }\n\n\n\n   // - LuaValue::asInteger() --------------------------------------------------\n   lua_Integer LuaValue::asInteger() const\n   {\n      if (dataType_ == LUA_TNUMBER)\n      {\n         const lua_Number* num = reinterpret_cast<const lua_Number*>(&data_);\n         lua_Integer res = static_cast<lua_Integer>(*num);\n         return res;\n      }\n      else\n      {\n         throw TypeMismatchError (\"number\", typeName());\n      }\n   }\n\n\n\n   // - LuaValue::asString -----------------------------------------------------\n   const std::string& LuaValue::asString() const\n   {\n      if (dataType_ == LUA_TSTRING)\n      {\n         const std::string* ps = reinterpret_cast<const std::string*>(&data_);\n         return *ps;\n      }\n      else\n      {\n         throw TypeMismatchError (\"string\", typeName());\n      }\n   }\n\n\n\n   // - LuaValue::asBoolean ----------------------------------------------------\n   bool LuaValue::asBoolean() const\n   {\n      if (dataType_ == LUA_TBOOLEAN)\n      {\n         const bool* pb = reinterpret_cast<const bool*>(&data_);\n         return *pb;\n      }\n      else\n      {\n         throw TypeMismatchError (\"boolean\", typeName());\n      }\n   }\n\n\n\n   // - LuaValue::asTable ------------------------------------------------------\n   LuaValueMap LuaValue::asTable() const\n   {\n      if (dataType_ == LUA_TTABLE)\n      {\n         const LuaValueMap* pm = reinterpret_cast<const LuaValueMap*>(&data_);\n         return *pm;\n      }\n      else\n      {\n         throw TypeMismatchError (\"table\", typeName());\n      }\n   }\n\n\n\n   // - LuaValue::asFunction ---------------------------------------------------\n   const LuaFunction& LuaValue::asFunction() const\n   {\n      if (dataType_ == LUA_TFUNCTION)\n      {\n         const LuaFunction* pf = reinterpret_cast<const LuaFunction*>(&data_);\n         return *pf;\n      }\n      else\n      {\n         throw TypeMismatchError (\"function\", typeName());\n      }\n   }\n\n\n\n   // - LuaValue::asUserData ---------------------------------------------------\n   const LuaUserData& LuaValue::asUserData() const\n   {\n      if (dataType_ == LUA_TUSERDATA)\n      {\n         const LuaUserData* pd = reinterpret_cast<const LuaUserData*>(&data_);\n         return *pd;\n      }\n      else\n      {\n         throw TypeMismatchError (\"userdata\", typeName());\n      }\n   }\n\n   LuaUserData& LuaValue::asUserData()\n   {\n      if (dataType_ == LUA_TUSERDATA)\n      {\n         LuaUserData* pd = reinterpret_cast<LuaUserData*>(&data_);\n         return *pd;\n      }\n      else\n      {\n         throw TypeMismatchError (\"userdata\", typeName());\n      }\n   }\n\n\n\n   // - LuaValue::operator< ----------------------------------------------------\n   bool LuaValue::operator< (const LuaValue& rhs) const\n   {\n      std::string lhsTypeName = typeName();\n      std::string rhsTypeName = rhs.typeName();\n\n      if (lhsTypeName < rhsTypeName)\n         return true;\n      else if (lhsTypeName > rhsTypeName)\n         return false;\n      else // lhsTypeName == rhsTypeName\n      {\n         if (lhsTypeName == \"nil\")\n            return false;\n         else if (lhsTypeName == \"boolean\")\n            return asBoolean() < rhs.asBoolean();\n         else if (lhsTypeName == \"number\")\n            return asNumber() < rhs.asNumber();\n         else if (lhsTypeName == \"string\")\n            return asString() < rhs.asString();\n         else if (lhsTypeName == \"function\")\n            return asFunction() < rhs.asFunction();\n         else if (lhsTypeName == \"userdata\")\n            return asUserData() < rhs.asUserData();\n         else if (lhsTypeName == \"table\")\n         {\n            const LuaValueMap lhsMap = asTable();\n            const LuaValueMap rhsMap = rhs.asTable();\n\n            if (lhsMap.size() < rhsMap.size())\n               return true;\n            else if (lhsMap.size() > rhsMap.size())\n               return false;\n            else // lhsMap.size() == rhsMap.size()\n            {\n               typedef LuaValueMap::const_iterator iter_t;\n\n               iter_t pLHS = lhsMap.begin();\n               iter_t pRHS = rhsMap.begin();\n               const iter_t end = lhsMap.end();\n\n               while (pLHS != end)\n               {\n                  // check the key first\n                  if (pLHS->first < pRHS->first)\n                     return true;\n                  else if (pLHS->first > pRHS->first)\n                     return false;\n\n                  // then check the value\n                  if (pLHS->second < pRHS->second)\n                     return true;\n                  else if (pLHS->second > pRHS->second)\n                     return false;\n\n                  // make the iterators iterate\n                  ++pRHS;\n                  ++pLHS;\n               }\n               return false;\n            }\n         }\n         else\n         {\n            assert (false && \"Unsupported type found at a call \"\n                    \"to 'LuaValue::operator<()'\");\n            return false; // make the compiler happy.\n         }\n      }\n   }\n\n\n\n   // - LuaValue::operator> ----------------------------------------------------\n   bool LuaValue::operator> (const LuaValue& rhs) const\n   {\n      std::string lhsTypeName = typeName();\n      std::string rhsTypeName = rhs.typeName();\n\n      if (lhsTypeName > rhsTypeName)\n         return true;\n      else if (lhsTypeName < rhsTypeName)\n         return false;\n      else // lhsTypeName == rhsTypeName\n      {\n         if (lhsTypeName == \"nil\")\n            return false;\n         else if (lhsTypeName == \"boolean\")\n            return asBoolean() > rhs.asBoolean();\n         else if (lhsTypeName == \"number\")\n            return asNumber() > rhs.asNumber();\n         else if (lhsTypeName == \"string\")\n            return asString() > rhs.asString();\n         else if (lhsTypeName == \"function\")\n            return asFunction() > rhs.asFunction();\n         else if (lhsTypeName == \"userdata\")\n            return asUserData() > rhs.asUserData();\n         else if (lhsTypeName == \"table\")\n         {\n            const LuaValueMap lhsMap = asTable();\n            const LuaValueMap rhsMap = rhs.asTable();\n\n            if (lhsMap.size() > rhsMap.size())\n               return true;\n            else if (lhsMap.size() < rhsMap.size())\n               return false;\n            else // lhsMap.size() == rhsMap.size()\n            {\n               typedef LuaValueMap::const_iterator iter_t;\n\n               iter_t pLHS = lhsMap.begin();\n               iter_t pRHS = rhsMap.begin();\n               const iter_t end = lhsMap.end();\n\n               while (pLHS != end)\n               {\n                  // check the key first\n                  if (pLHS->first > pRHS->first)\n                     return true;\n                  else if (pLHS->first < pRHS->first)\n                     return false;\n\n                  // then check the value\n                  if (pLHS->second > pRHS->second)\n                     return true;\n                  else if (pLHS->second < pRHS->second)\n                     return false;\n\n                  // make the iterators iterate\n                  ++pRHS;\n                  ++pLHS;\n               }\n               return false;\n            }\n         }\n         else\n         {\n            assert (false && \"Unsupported type found at a call \"\n                    \"to 'LuaValue::operator>()'\");\n            return false; // make the compiler happy.\n         }\n      }\n   }\n\n\n\n   // - LuaValue::operator== ---------------------------------------------------\n   bool LuaValue::operator== (const LuaValue& rhs) const\n   {\n      std::string lhsTypeName = typeName();\n      std::string rhsTypeName = rhs.typeName();\n\n      if (typeName() != rhs.typeName())\n         return false;\n      else switch (type())\n      {\n         case LUA_TNIL:\n            return true;\n\n         case LUA_TBOOLEAN:\n            return asBoolean() == rhs.asBoolean();\n\n         case LUA_TNUMBER:\n            return asNumber() == rhs.asNumber();\n\n         case LUA_TSTRING:\n            return asString() == rhs.asString();\n\n         case LUA_TTABLE:\n            return asTable() == rhs.asTable();\n\n         case LUA_TFUNCTION:\n            return asFunction() == rhs.asFunction();\n\n         case LUA_TUSERDATA:\n            return asUserData() == rhs.asUserData();\n\n         default:\n         {\n            assert(\n               false\n               && \"Invalid type found in a call to 'LuaValue::operator==()'.\");\n            return 0; // make compilers happy\n         }\n      }\n   }\n\n\n\n   // - LuaValue::operator[] ---------------------------------------------------\n   LuaValue& LuaValue::operator[] (const LuaValue& key)\n   {\n      if (type() != LUA_TTABLE)\n         throw TypeMismatchError (\"table\", typeName());\n\n      LuaValueMap* pTable = reinterpret_cast<LuaValueMap*>(data_);\n\n      return (*pTable)[key];\n   }\n\n\n\n   const LuaValue& LuaValue::operator[] (const LuaValue& key) const\n   {\n      if (type() != LUA_TTABLE)\n         throw TypeMismatchError (\"table\", typeName());\n\n      const LuaValueMap* pTable = reinterpret_cast<const LuaValueMap*>(data_);\n\n      LuaValueMap::const_iterator it = (*pTable).find(key);\n\n      if (it == (*pTable).end())\n         return Nil;\n\n      return it->second;\n   }\n\n\n\n   // - LuaValue::destroyObjectAtData ------------------------------------------\n   void LuaValue::destroyObjectAtData()\n   {\n      switch (dataType_)\n      {\n         case LUA_TSTRING:\n         {\n            std::string* ps = reinterpret_cast<std::string*>(data_);\n            ps->~basic_string();\n            break;\n         }\n\n         case LUA_TTABLE:\n         {\n            LuaValueMap* pm = reinterpret_cast<LuaValueMap*>(data_);\n            pm->~LuaValueMap();\n            break;\n         }\n\n         case LUA_TUSERDATA:\n         {\n            LuaUserData* pd = reinterpret_cast<LuaUserData*>(data_);\n            pd->~LuaUserData();\n            break;\n         }\n\n         case LUA_TFUNCTION:\n         {\n            LuaFunction* pf = reinterpret_cast<LuaFunction*>(data_);\n            pf->~LuaFunction();\n            break;\n         }\n\n         default:\n            // no destructor needed.\n            break;\n      }\n   }\n\n} // namespace Diluculum\n"
  },
  {
    "path": "jni/highlight/core/Diluculum/LuaVariable.cpp",
    "content": "/******************************************************************************\\\n* LuaVariable.cpp                                                              *\n* A variable living in a Lua interpreter.                                      *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2010 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#include <cassert>\n#include <boost/lexical_cast.hpp>\n#include <Diluculum/LuaState.hpp>\n#include <Diluculum/LuaUserData.hpp>\n#include <Diluculum/LuaUtils.hpp>\n#include <Diluculum/LuaVariable.hpp>\n#include \"InternalUtils.hpp\"\n\n\nnamespace Diluculum\n{\n   // - LuaVariable::LuaVariable -----------------------------------------------\n   LuaVariable::LuaVariable (lua_State* state, const LuaValue& key,\n                             const KeyList& predKeys)\n      : state_(state), keys_(predKeys)\n   {\n      keys_.push_back (key);\n   }\n\n\n\n   // - LuaVariable::operator= -------------------------------------------------\n   const LuaValue& LuaVariable::operator= (const LuaValue& rhs)\n   {\n      pushLastTable();\n      PushLuaValue (state_, keys_.back());\n      PushLuaValue (state_, rhs);\n      lua_settable (state_, -3);\n      lua_pop (state_, 1);\n\n      return rhs;\n   }\n\n\n\n   // - LuaVariable::value -----------------------------------------------------\n   LuaValue LuaVariable::value() const\n   {\n      pushTheReferencedValue();\n      LuaValue ret = ToLuaValue (state_, -1);\n      lua_pop (state_, 1);\n      return ret;\n   }\n\n\n\n   // - LuaVariable::operator[] ------------------------------------------------\n   LuaVariable LuaVariable::operator[] (const LuaValue& key) const\n   {\n      return LuaVariable (state_, key, keys_);\n   }\n\n\n\n   // - LuaVariable::operator() ------------------------------------------------\n   LuaValueList LuaVariable::operator() (const LuaValueList& params)\n   {\n      pushTheReferencedValue();\n      return Impl::CallFunctionOnTop (state_, params);\n   }\n\n   LuaValueList LuaVariable::operator()()\n   {\n      return (*this)(LuaValueList());\n   }\n\n   LuaValueList LuaVariable::operator() (const LuaValue& param)\n   {\n      LuaValueList params;\n      params.push_back (param);\n      return (*this)(params);\n   }\n\n   LuaValueList LuaVariable::operator() (const LuaValue& param1,\n                                         const LuaValue& param2)\n   {\n      LuaValueList params;\n      params.push_back (param1);\n      params.push_back (param2);\n      return (*this)(params);\n   }\n\n   LuaValueList LuaVariable::operator() (const LuaValue& param1,\n                                         const LuaValue& param2,\n                                         const LuaValue& param3)\n   {\n      LuaValueList params;\n      params.push_back (param1);\n      params.push_back (param2);\n      params.push_back (param3);\n      return (*this)(params);\n   }\n\n   LuaValueList LuaVariable::operator() (const LuaValue& param1,\n                                         const LuaValue& param2,\n                                         const LuaValue& param3,\n                                         const LuaValue& param4)\n   {\n      LuaValueList params;\n      params.push_back (param1);\n      params.push_back (param2);\n      params.push_back (param3);\n      params.push_back (param4);\n      return (*this)(params);\n   }\n\n   LuaValueList LuaVariable::operator() (const LuaValue& param1,\n                                         const LuaValue& param2,\n                                         const LuaValue& param3,\n                                         const LuaValue& param4,\n                                         const LuaValue& param5)\n   {\n      LuaValueList params;\n      params.push_back (param1);\n      params.push_back (param2);\n      params.push_back (param3);\n      params.push_back (param4);\n      params.push_back (param5);\n      return (*this)(params);\n   }\n\n\n\n   // - LuaVariable::pushLastTable ---------------------------------------------\n   void LuaVariable::pushLastTable()\n   {\n      // Push the globals table onto the stack\n#if LUA_VERSION_NUM >= 502\n      lua_pushglobaltable (state_);\n#else\n      lua_pushstring (state_, \"_G\");\n      lua_gettable (state_, LUA_GLOBALSINDEX);\n#endif\n      // Reach the \"final\" table (and leave it at the stack top)\n      typedef KeyList::const_iterator iter_t;\n\n      assert (keys_.size() > 0 && \"At least one key should be present here.\");\n\n      iter_t end = keys_.end();\n      --end;\n\n      for (iter_t p = keys_.begin(); p != end; ++p)\n      {\n         PushLuaValue (state_, *p);\n         lua_gettable (state_, -2);\n         if (!lua_istable (state_, -1))\n            throw TypeMismatchError (\"table\", luaL_typename (state_, -1));\n         lua_remove (state_, -2);\n      }\n   }\n\n\n\n   // - LuaVariable::pushTheReferencedValue ------------------------------------\n   void LuaVariable::pushTheReferencedValue() const\n   {\n      assert (keys_.size() > 0 && \"There should be at least one key here.\");\n\n#if LUA_VERSION_NUM >= 502\n      lua_rawgeti (state_, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);\n#else\n      int index = LUA_GLOBALSINDEX;\n#endif\n      typedef std::vector<LuaValue>::const_iterator iter_t;\n      for (iter_t p = keys_.begin(); p != keys_.end(); ++p)\n      {\n         PushLuaValue (state_, *p);\n#if LUA_VERSION_NUM >= 502\n\t  lua_gettable (state_, -2);\n#else\n         lua_gettable (state_, index);\n#endif\n         if (keys_.size() > 1 && p != keys_.end()-1 && !lua_istable(state_, -1))\n            throw TypeMismatchError (\"table\", p->typeName());\n#if LUA_VERSION_NUM >= 502\n\t  lua_remove (state_, -2);\n#else\n         if (index != LUA_GLOBALSINDEX)\n            lua_remove (state_, -2);\n         else\n            index = -2;\n#endif\n      }\n   }\n\n} // namespace Diluculum\n"
  },
  {
    "path": "jni/highlight/core/Diluculum/LuaWrappers.cpp",
    "content": "/******************************************************************************\\\n* LuaWrappers.cpp                                                              *\n* Making C++ stuff accessible from Lua.                                        *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#include <Diluculum/LuaWrappers.hpp>\n#include <cassert>\n\n\nnamespace Diluculum\n{\n   namespace Impl\n   {\n      // - ReportErrorFromCFunction --------------------------------------------\n      void ReportErrorFromCFunction (lua_State* ls, const::std::string& what)\n      {\n         lua_Debug ar;\n         int ret = lua_getstack (ls, 0, &ar);\n\n         assert (ret != 0 && \"'lua_getstack()' wasn't supposed to return '0' \"\n                 \"here. Possible error cause: 'ReportErrorFromCFunction()' \"\n                 \"wasn't called from a Lua function implemented in C.\");\n\n         ret = lua_getinfo (ls, \"n\", &ar);\n\n         assert (ret != 0 && \"'lua_getinfo()' wasn't supposed to return '1' \"\n                 \"here. *Nothing* could go wrong at this point! Oh, well...\");\n\n         const std::string msg = std::string(\"Error found when calling '\")\n            + ar.name + \"': \" + what;\n\n         lua_pushstring (ls, msg.c_str());\n         lua_error (ls);\n      }\n   }\n}\n"
  },
  {
    "path": "jni/highlight/core/ansigenerator.cpp",
    "content": "/***************************************************************************\n                    ansigenerator.cpp  -  description\n                             -------------------\n    begin                : Jul 5 2004\n    copyright            : (C) 2004-2007 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include <sstream>\n\n#include \"ansigenerator.h\"\n\nusing namespace std;\n\nnamespace highlight\n{\n\n\tstring  AnsiGenerator::getOpenTag ( const string&font,\n\t                                    const string&fgCol, const string&bgCol )\n\t{\n\t\tostringstream s;\n\t\ts  << \"\\033[\"<<font;\n\t\tif ( !fgCol.empty() )\n\t\t\ts<<\";\"<<fgCol;\n\t\tif ( !bgCol.empty() )\n\t\t\ts<<\";\"<<bgCol;\n\t\ts << \"m\";\n\t\treturn  s.str();\n\t}\n\n\n\tAnsiGenerator::AnsiGenerator() : CodeGenerator ( ANSI )\n\t{\n\n\t\tnewLineTag = \"\\n\";\n\t\tspacer = \" \";\n\t}\n\n\tAnsiGenerator::~AnsiGenerator() {}\n\n\tvoid AnsiGenerator::initOutputTags(){\n\t\topenTags.push_back ( \"\" );\n\t\topenTags.push_back ( getOpenTag ( \"00\", \"31\" ) ); //str\n\t\topenTags.push_back ( getOpenTag ( \"00\", \"34\" ) );//number\n\t\topenTags.push_back ( getOpenTag ( \"00\", \"34\" ) );//sl comment\n\t\topenTags.push_back ( getOpenTag ( \"00\", \"34\" ) );//ml comment\n\t\topenTags.push_back ( getOpenTag ( \"00\", \"35\" ) );//escapeChar\n\t\topenTags.push_back ( getOpenTag ( \"00\", \"35\" ) );//directive\n\t\topenTags.push_back ( getOpenTag ( \"00\", \"31\" ) );//directive string\n\t\topenTags.push_back ( getOpenTag ( \"00\", \"30\" ) );//linenum\n\t\topenTags.push_back ( getOpenTag ( \"00\", \"00\" ) );//symbol\n\t\topenTags.push_back ( getOpenTag ( \"00\", \"35\" ) );//interpolation\n\n\t\tcloseTags.push_back ( \"\" );\n\t\tfor (unsigned int i=1;i<NUMBER_BUILTIN_STATES; i++ )\n\t\t{\n\t\t\tcloseTags.push_back ( \"\\033[m\" );\n\t\t}\n\t}\n\n\tstring AnsiGenerator::getHeader()\n\t{\n\t\treturn string();\n\t}\n\n\tvoid AnsiGenerator::printBody()\n\t{\n\t\tprocessRootState();\n\t}\n\n\tstring AnsiGenerator::getFooter()\n\t{\n\t\treturn string();\n\t}\n\n\tstring AnsiGenerator::maskCharacter ( unsigned char c )\n\t{\n\t\treturn string ( 1, c );\n\t}\n\n\tstring AnsiGenerator::getKeywordOpenTag ( unsigned int styleID )\n\t{\n\t\treturn ( styleID ) ?getOpenTag ( \"00\", \"32\", \"\" ) :getOpenTag ( \"00\", \"33\" );\n\t}\n\n\tstring AnsiGenerator::getKeywordCloseTag ( unsigned int styleID )\n\t{\n\t\treturn \"\\033[m\";\n\t}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/astyle/ASBeautifier.cpp",
    "content": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *   ASBeautifier.cpp\n *\n *   Copyright (C) 2014 by Jim Pattee\n *   <http://www.gnu.org/licenses/lgpl-3.0.html>\n *\n *   This file is a part of Artistic Style - an indentation and\n *   reformatting tool for C, C++, C# and Java source files.\n *   <http://astyle.sourceforge.net>\n *\n *   Artistic Style is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU Lesser General Public License as published\n *   by the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   Artistic Style is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU Lesser General Public License for more details.\n *\n *   You should have received a copy of the GNU Lesser General Public License\n *   along with Artistic Style.  If not, see <http://www.gnu.org/licenses/>.\n *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n */\n\n#include \"astyle/astyle.h\"\n\n#include <algorithm>\n\n\nnamespace astyle {\n\n// this must be global\nstatic int g_preprocessorCppExternCBracket;\n\n/**\n * ASBeautifier's constructor\n * This constructor is called only once for each source file.\n * The cloned ASBeautifier objects are created with the copy constructor.\n */\nASBeautifier::ASBeautifier()\n{\n\tg_preprocessorCppExternCBracket = 0;\n\n\twaitingBeautifierStack = NULL;\n\tactiveBeautifierStack = NULL;\n\twaitingBeautifierStackLengthStack = NULL;\n\tactiveBeautifierStackLengthStack = NULL;\n\n\theaderStack = NULL;\n\ttempStacks = NULL;\n\tblockParenDepthStack = NULL;\n\tblockStatementStack = NULL;\n\tparenStatementStack = NULL;\n\tbracketBlockStateStack = NULL;\n\tinStatementIndentStack = NULL;\n\tinStatementIndentStackSizeStack = NULL;\n\tparenIndentStack = NULL;\n\tpreprocIndentStack = NULL;\n\tsourceIterator = NULL;\n\tisModeManuallySet = false;\n\tshouldForceTabIndentation = false;\n\tsetSpaceIndentation(4);\n\tsetMinConditionalIndentOption(MINCOND_TWO);\n\tsetMaxInStatementIndentLength(40);\n\tclassInitializerIndents = 1;\n\ttabLength = 0;\n\tsetClassIndent(false);\n\tsetModifierIndent(false);\n\tsetSwitchIndent(false);\n\tsetCaseIndent(false);\n\tsetBlockIndent(false);\n\tsetBracketIndent(false);\n\tsetBracketIndentVtk(false);\n\tsetNamespaceIndent(false);\n\tsetLabelIndent(false);\n\tsetEmptyLineFill(false);\n\tsetCStyle();\n\tsetPreprocDefineIndent(false);\n\tsetPreprocConditionalIndent(false);\n\tsetAlignMethodColon(false);\n\n\t// initialize ASBeautifier member vectors\n\tbeautifierFileType = 9;\t\t// reset to an invalid type\n\theaders = new vector<const string*>;\n\tnonParenHeaders = new vector<const string*>;\n\tassignmentOperators = new vector<const string*>;\n\tnonAssignmentOperators = new vector<const string*>;\n\tpreBlockStatements = new vector<const string*>;\n\tpreCommandHeaders = new vector<const string*>;\n\tindentableHeaders = new vector<const string*>;\n}\n\n/**\n * ASBeautifier's copy constructor\n * Copy the vector objects to vectors in the new ASBeautifier\n * object so the new object can be destroyed without deleting\n * the vector objects in the copied vector.\n * This is the reason a copy constructor is needed.\n *\n * Must explicitly call the base class copy constructor.\n */\nASBeautifier::ASBeautifier(const ASBeautifier &other) : ASBase(other)\n{\n\t// these don't need to copy the stack\n\twaitingBeautifierStack = NULL;\n\tactiveBeautifierStack = NULL;\n\twaitingBeautifierStackLengthStack = NULL;\n\tactiveBeautifierStackLengthStack = NULL;\n\n\t// vector '=' operator performs a DEEP copy of all elements in the vector\n\n\theaderStack = new vector<const string*>;\n\t*headerStack = *other.headerStack;\n\n\ttempStacks = copyTempStacks(other);\n\n\tblockParenDepthStack = new vector<int>;\n\t*blockParenDepthStack = *other.blockParenDepthStack;\n\n\tblockStatementStack = new vector<bool>;\n\t*blockStatementStack = *other.blockStatementStack;\n\n\tparenStatementStack = new vector<bool>;\n\t*parenStatementStack = *other.parenStatementStack;\n\n\tbracketBlockStateStack = new vector<bool>;\n\t*bracketBlockStateStack = *other.bracketBlockStateStack;\n\n\tinStatementIndentStack = new vector<int>;\n\t*inStatementIndentStack = *other.inStatementIndentStack;\n\n\tinStatementIndentStackSizeStack = new vector<int>;\n\t*inStatementIndentStackSizeStack = *other.inStatementIndentStackSizeStack;\n\n\tparenIndentStack = new vector<int>;\n\t*parenIndentStack = *other.parenIndentStack;\n\n\tpreprocIndentStack = new vector<pair<int, int> >;\n\t*preprocIndentStack = *other.preprocIndentStack;\n\n\t// Copy the pointers to vectors.\n\t// This is ok because the original ASBeautifier object\n\t// is not deleted until end of job.\n\tbeautifierFileType = other.beautifierFileType;\n\theaders = other.headers;\n\tnonParenHeaders = other.nonParenHeaders;\n\tassignmentOperators = other.assignmentOperators;\n\tnonAssignmentOperators = other.nonAssignmentOperators;\n\tpreBlockStatements = other.preBlockStatements;\n\tpreCommandHeaders = other.preCommandHeaders;\n\tindentableHeaders = other.indentableHeaders;\n\n\t// protected variables\n\t// variables set by ASFormatter\n\t// must also be updated in activeBeautifierStack\n\tinLineNumber = other.inLineNumber;\n\thorstmannIndentInStatement = other.horstmannIndentInStatement;\n\tnonInStatementBracket = other.nonInStatementBracket;\n\tlineCommentNoBeautify = other.lineCommentNoBeautify;\n\tisElseHeaderIndent = other.isElseHeaderIndent;\n\tisCaseHeaderCommentIndent = other.isCaseHeaderCommentIndent;\n\tisNonInStatementArray = other.isNonInStatementArray;\n\tisSharpAccessor = other.isSharpAccessor;\n\tisSharpDelegate = other.isSharpDelegate;\n\tisInExternC = other.isInExternC;\n\tisInBeautifySQL = other.isInBeautifySQL;\n\tisInIndentableStruct = other.isInIndentableStruct;\n\tisInIndentablePreproc = other.isInIndentablePreproc;\n\n\t// private variables\n\tsourceIterator = other.sourceIterator;\n\tcurrentHeader = other.currentHeader;\n\tpreviousLastLineHeader = other.previousLastLineHeader;\n\tprobationHeader = other.probationHeader;\n\tlastLineHeader = other.lastLineHeader;\n\tindentString = other.indentString;\n\tverbatimDelimiter = other.verbatimDelimiter;\n\tisInQuote = other.isInQuote;\n\tisInVerbatimQuote = other.isInVerbatimQuote;\n\thaveLineContinuationChar = other.haveLineContinuationChar;\n\tisInAsm = other.isInAsm;\n\tisInAsmOneLine = other.isInAsmOneLine;\n\tisInAsmBlock = other.isInAsmBlock;\n\tisInComment = other.isInComment;\n\tisInPreprocessorComment = other.isInPreprocessorComment;\n\tisInHorstmannComment = other.isInHorstmannComment;\n\tisInCase = other.isInCase;\n\tisInQuestion = other.isInQuestion;\n\tisInStatement = other.isInStatement;\n\tisInHeader = other.isInHeader;\n\tisInTemplate = other.isInTemplate;\n\tisInDefine = other.isInDefine;\n\tisInDefineDefinition = other.isInDefineDefinition;\n\tclassIndent = other.classIndent;\n\tisIndentModeOff = other.isIndentModeOff;\n\tisInClassHeader = other.isInClassHeader;\n\tisInClassHeaderTab = other.isInClassHeaderTab;\n\tisInClassInitializer = other.isInClassInitializer;\n\tisInClass = other.isInClass;\n\tisInObjCMethodDefinition = other.isInObjCMethodDefinition;\n\tisImmediatelyPostObjCMethodDefinition = other.isImmediatelyPostObjCMethodDefinition;\n\tisInIndentablePreprocBlock = other.isInIndentablePreprocBlock;\n\tisInObjCInterface = other.isInObjCInterface;\n\tisInEnum = other.isInEnum;\n\tisInEnumTypeID = other.isInEnumTypeID;\n\tisInLet = other.isInLet;\n\tmodifierIndent = other.modifierIndent;\n\tswitchIndent = other.switchIndent;\n\tcaseIndent = other.caseIndent;\n\tnamespaceIndent = other.namespaceIndent;\n\tbracketIndent = other.bracketIndent;\n\tbracketIndentVtk = other.bracketIndentVtk;\n\tblockIndent = other.blockIndent;\n\tlabelIndent = other.labelIndent;\n\tisInConditional = other.isInConditional;\n\tisModeManuallySet = other.isModeManuallySet;\n\tshouldForceTabIndentation = other.shouldForceTabIndentation;\n\temptyLineFill = other.emptyLineFill;\n\tlineOpensWithLineComment = other.lineOpensWithLineComment;\n\tlineOpensWithComment = other.lineOpensWithComment;\n\tlineStartsInComment = other.lineStartsInComment;\n\tbackslashEndsPrevLine = other.backslashEndsPrevLine;\n\tblockCommentNoIndent = other.blockCommentNoIndent;\n\tblockCommentNoBeautify = other.blockCommentNoBeautify;\n\tpreviousLineProbationTab = other.previousLineProbationTab;\n\tlineBeginsWithOpenBracket = other.lineBeginsWithOpenBracket;\n\tlineBeginsWithCloseBracket = other.lineBeginsWithCloseBracket;\n\tlineBeginsWithComma = other.lineBeginsWithComma;\n\tlineIsCommentOnly = other.lineIsCommentOnly;\n\tlineIsLineCommentOnly = other.lineIsLineCommentOnly;\n\tshouldIndentBrackettedLine = other.shouldIndentBrackettedLine;\n\tisInSwitch = other.isInSwitch;\n\tfoundPreCommandHeader = other.foundPreCommandHeader;\n\tfoundPreCommandMacro = other.foundPreCommandMacro;\n\tshouldAlignMethodColon = other.shouldAlignMethodColon;\n\tshouldIndentPreprocDefine = other.shouldIndentPreprocDefine;\n\tshouldIndentPreprocConditional = other.shouldIndentPreprocConditional;\n\tindentCount = other.indentCount;\n\tspaceIndentCount = other.spaceIndentCount;\n\tspaceIndentObjCMethodDefinition = other.spaceIndentObjCMethodDefinition;\n\tcolonIndentObjCMethodDefinition = other.colonIndentObjCMethodDefinition;\n\tlineOpeningBlocksNum = other.lineOpeningBlocksNum;\n\tlineClosingBlocksNum = other.lineClosingBlocksNum;\n\tfileType = other.fileType;\n\tminConditionalOption = other.minConditionalOption;\n\tminConditionalIndent = other.minConditionalIndent;\n\tparenDepth = other.parenDepth;\n\tindentLength = other.indentLength;\n\ttabLength = other.tabLength;\n\tblockTabCount = other.blockTabCount;\n\tmaxInStatementIndent = other.maxInStatementIndent;\n\tclassInitializerIndents = other.classInitializerIndents;\n\ttemplateDepth = other.templateDepth;\n\tsquareBracketCount = other.squareBracketCount;\n\tprevFinalLineSpaceIndentCount = other.prevFinalLineSpaceIndentCount;\n\tprevFinalLineIndentCount = other.prevFinalLineIndentCount;\n\tdefineIndentCount = other.defineIndentCount;\n\tpreprocBlockIndent = other.preprocBlockIndent;\n\tquoteChar = other.quoteChar;\n\tprevNonSpaceCh = other.prevNonSpaceCh;\n\tcurrentNonSpaceCh = other.currentNonSpaceCh;\n\tcurrentNonLegalCh = other.currentNonLegalCh;\n\tprevNonLegalCh = other.prevNonLegalCh;\n}\n\n/**\n * ASBeautifier's destructor\n */\nASBeautifier::~ASBeautifier()\n{\n\tdeleteBeautifierContainer(waitingBeautifierStack);\n\tdeleteBeautifierContainer(activeBeautifierStack);\n\tdeleteContainer(waitingBeautifierStackLengthStack);\n\tdeleteContainer(activeBeautifierStackLengthStack);\n\tdeleteContainer(headerStack);\n\tdeleteTempStacksContainer(tempStacks);\n\tdeleteContainer(blockParenDepthStack);\n\tdeleteContainer(blockStatementStack);\n\tdeleteContainer(parenStatementStack);\n\tdeleteContainer(bracketBlockStateStack);\n\tdeleteContainer(inStatementIndentStack);\n\tdeleteContainer(inStatementIndentStackSizeStack);\n\tdeleteContainer(parenIndentStack);\n\tdeleteContainer(preprocIndentStack);\n}\n\n/**\n * initialize the ASBeautifier.\n *\n * This init() should be called every time a ABeautifier object is to start\n * beautifying a NEW source file.\n * It is called only when a new ASFormatter object is created.\n * init() receives a pointer to a ASSourceIterator object that will be\n * used to iterate through the source code.\n *\n * @param iter     a pointer to the ASSourceIterator or ASStreamIterator object.\n */\nvoid ASBeautifier::init(ASSourceIterator* iter)\n{\n\tsourceIterator = iter;\n\tinitVectors();\n\tASBase::init(getFileType());\n\n\tinitContainer(waitingBeautifierStack, new vector<ASBeautifier*>);\n\tinitContainer(activeBeautifierStack, new vector<ASBeautifier*>);\n\n\tinitContainer(waitingBeautifierStackLengthStack, new vector<int>);\n\tinitContainer(activeBeautifierStackLengthStack, new vector<int>);\n\n\tinitContainer(headerStack, new vector<const string*>);\n\n\tinitTempStacksContainer(tempStacks, new vector<vector<const string*>*>);\n\ttempStacks->push_back(new vector<const string*>);\n\n\tinitContainer(blockParenDepthStack, new vector<int>);\n\tinitContainer(blockStatementStack, new vector<bool>);\n\tinitContainer(parenStatementStack, new vector<bool>);\n\tinitContainer(bracketBlockStateStack, new vector<bool>);\n\tbracketBlockStateStack->push_back(true);\n\tinitContainer(inStatementIndentStack, new vector<int>);\n\tinitContainer(inStatementIndentStackSizeStack, new vector<int>);\n\tinStatementIndentStackSizeStack->push_back(0);\n\tinitContainer(parenIndentStack, new vector<int>);\n\tinitContainer(preprocIndentStack, new vector<pair<int, int> >);\n\n\tpreviousLastLineHeader = NULL;\n\tcurrentHeader = NULL;\n\n\tisInQuote = false;\n\tisInVerbatimQuote = false;\n\thaveLineContinuationChar = false;\n\tisInAsm = false;\n\tisInAsmOneLine = false;\n\tisInAsmBlock = false;\n\tisInComment = false;\n\tisInPreprocessorComment = false;\n\tisInHorstmannComment = false;\n\tisInStatement = false;\n\tisInCase = false;\n\tisInQuestion = false;\n\tisIndentModeOff = false;\n\tisInClassHeader = false;\n\tisInClassHeaderTab = false;\n\tisInClassInitializer = false;\n\tisInClass = false;\n\tisInObjCMethodDefinition = false;\n\tisImmediatelyPostObjCMethodDefinition = false;\n\tisInIndentablePreprocBlock = false;\n\tisInObjCInterface = false;\n\tisInEnum = false;\n\tisInEnumTypeID = false;\n\tisInLet = false;\n\tisInHeader = false;\n\tisInTemplate = false;\n\tisInConditional = false;\n\n\tindentCount = 0;\n\tspaceIndentCount = 0;\n\tspaceIndentObjCMethodDefinition = 0;\n\tcolonIndentObjCMethodDefinition = 0;\n\tlineOpeningBlocksNum = 0;\n\tlineClosingBlocksNum = 0;\n\ttemplateDepth = 0;\n\tsquareBracketCount = 0;\n\tparenDepth = 0;\n\tblockTabCount = 0;\n\tprevFinalLineSpaceIndentCount = 0;\n\tprevFinalLineIndentCount = 0;\n\tdefineIndentCount = 0;\n\tpreprocBlockIndent = 0;\n\tprevNonSpaceCh = '{';\n\tcurrentNonSpaceCh = '{';\n\tprevNonLegalCh = '{';\n\tcurrentNonLegalCh = '{';\n\tquoteChar = ' ';\n\tprobationHeader = NULL;\n\tlastLineHeader = NULL;\n\tbackslashEndsPrevLine = false;\n\tlineOpensWithLineComment = false;\n\tlineOpensWithComment = false;\n\tlineStartsInComment = false;\n\tisInDefine = false;\n\tisInDefineDefinition = false;\n\tlineCommentNoBeautify = false;\n\tisElseHeaderIndent = false;\n\tisCaseHeaderCommentIndent = false;\n\tblockCommentNoIndent = false;\n\tblockCommentNoBeautify = false;\n\tpreviousLineProbationTab = false;\n\tlineBeginsWithOpenBracket = false;\n\tlineBeginsWithCloseBracket = false;\n\tlineBeginsWithComma = false;\n\tlineIsCommentOnly = false;\n\tlineIsLineCommentOnly = false;\n\tshouldIndentBrackettedLine = true;\n\tisInSwitch = false;\n\tfoundPreCommandHeader = false;\n\tfoundPreCommandMacro = false;\n\n\tisNonInStatementArray = false;\n\tisSharpAccessor = false;\n\tisSharpDelegate = false;\n\tisInExternC = false;\n\tisInBeautifySQL = false;\n\tisInIndentableStruct = false;\n\tisInIndentablePreproc = false;\n\tinLineNumber = 0;\n\thorstmannIndentInStatement = 0;\n\tnonInStatementBracket = 0;\n}\n\n/*\n * initialize the vectors\n */\nvoid ASBeautifier::initVectors()\n{\n\tif (fileType == beautifierFileType)    // don't build unless necessary\n\t\treturn;\n\n\tbeautifierFileType = fileType;\n\n\theaders->clear();\n\tnonParenHeaders->clear();\n\tassignmentOperators->clear();\n\tnonAssignmentOperators->clear();\n\tpreBlockStatements->clear();\n\tpreCommandHeaders->clear();\n\tindentableHeaders->clear();\n\n\tASResource::buildHeaders(headers, fileType, true);\n\tASResource::buildNonParenHeaders(nonParenHeaders, fileType, true);\n\tASResource::buildAssignmentOperators(assignmentOperators);\n\tASResource::buildNonAssignmentOperators(nonAssignmentOperators);\n\tASResource::buildPreBlockStatements(preBlockStatements, fileType);\n\tASResource::buildPreCommandHeaders(preCommandHeaders, fileType);\n\tASResource::buildIndentableHeaders(indentableHeaders);\n}\n\n/**\n * set indentation style to C/C++.\n */\nvoid ASBeautifier::setCStyle()\n{\n\tfileType = C_TYPE;\n}\n\n/**\n * set indentation style to Java.\n */\nvoid ASBeautifier::setJavaStyle()\n{\n\tfileType = JAVA_TYPE;\n}\n\n/**\n * set indentation style to C#.\n */\nvoid ASBeautifier::setSharpStyle()\n{\n\tfileType = SHARP_TYPE;\n}\n\n/**\n * set mode manually set flag\n */\nvoid ASBeautifier::setModeManuallySet(bool state)\n{\n\tisModeManuallySet = state;\n}\n\n/**\n * set tabLength equal to indentLength.\n * This is done when tabLength is not explicitly set by\n * \"indent=force-tab-x\"\n *\n */\nvoid ASBeautifier::setDefaultTabLength()\n{\n\ttabLength = indentLength;\n}\n\n/**\n * indent using a different tab setting for indent=force-tab\n *\n * @param   length     number of spaces per tab.\n */\nvoid ASBeautifier::setForceTabXIndentation(int length)\n{\n\t// set tabLength instead of indentLength\n\tindentString = \"\\t\";\n\ttabLength = length;\n\tshouldForceTabIndentation = true;\n}\n\n/**\n * indent using one tab per indentation\n */\nvoid ASBeautifier::setTabIndentation(int length, bool forceTabs)\n{\n\tindentString = \"\\t\";\n\tindentLength = length;\n\tshouldForceTabIndentation = forceTabs;\n}\n\n/**\n * indent using a number of spaces per indentation.\n *\n * @param   length     number of spaces per indent.\n */\nvoid ASBeautifier::setSpaceIndentation(int length)\n{\n\tindentString = string(length, ' ');\n\tindentLength = length;\n}\n\n/**\n * set the maximum indentation between two lines in a multi-line statement.\n *\n * @param   max     maximum indentation length.\n */\nvoid ASBeautifier::setMaxInStatementIndentLength(int max)\n{\n\tmaxInStatementIndent = max;\n}\n\n/**\n * set the minimum conditional indentation option.\n *\n * @param   min     minimal indentation option.\n */\nvoid ASBeautifier::setMinConditionalIndentOption(int min)\n{\n\tminConditionalOption = min;\n}\n\n/**\n * set minConditionalIndent from the minConditionalOption.\n */\nvoid ASBeautifier::setMinConditionalIndentLength()\n{\n\tif (minConditionalOption == MINCOND_ZERO)\n\t\tminConditionalIndent = 0;\n\telse if (minConditionalOption == MINCOND_ONE)\n\t\tminConditionalIndent = indentLength;\n\telse if (minConditionalOption == MINCOND_ONEHALF)\n\t\tminConditionalIndent = indentLength / 2;\n\t// minConditionalOption = INDENT_TWO\n\telse\n\t\tminConditionalIndent = indentLength * 2;\n}\n\n/**\n * set the state of the bracket indent option. If true, brackets will\n * be indented one additional indent.\n *\n * @param   state             state of option.\n */\nvoid ASBeautifier::setBracketIndent(bool state)\n{\n\tbracketIndent = state;\n}\n\n/**\n* set the state of the bracket indent VTK option. If true, brackets will\n* be indented one additional indent, except for the opening bracket.\n*\n* @param   state             state of option.\n*/\nvoid ASBeautifier::setBracketIndentVtk(bool state)\n{\n\t// need to set both of these\n\tsetBracketIndent(state);\n\tbracketIndentVtk = state;\n}\n\n/**\n * set the state of the block indentation option. If true, entire blocks\n * will be indented one additional indent, similar to the GNU indent style.\n *\n * @param   state             state of option.\n */\nvoid ASBeautifier::setBlockIndent(bool state)\n{\n\tblockIndent = state;\n}\n\n/**\n * set the state of the class indentation option. If true, C++ class\n * definitions will be indented one additional indent.\n *\n * @param   state             state of option.\n */\nvoid ASBeautifier::setClassIndent(bool state)\n{\n\tclassIndent = state;\n}\n\n/**\n * set the state of the modifier indentation option. If true, C++ class\n * access modifiers will be indented one-half an indent.\n *\n * @param   state             state of option.\n */\nvoid ASBeautifier::setModifierIndent(bool state)\n{\n\tmodifierIndent = state;\n}\n\n/**\n * set the state of the switch indentation option. If true, blocks of 'switch'\n * statements will be indented one additional indent.\n *\n * @param   state             state of option.\n */\nvoid ASBeautifier::setSwitchIndent(bool state)\n{\n\tswitchIndent = state;\n}\n\n/**\n * set the state of the case indentation option. If true, lines of 'case'\n * statements will be indented one additional indent.\n *\n * @param   state             state of option.\n */\nvoid ASBeautifier::setCaseIndent(bool state)\n{\n\tcaseIndent = state;\n}\n\n/**\n * set the state of the namespace indentation option.\n * If true, blocks of 'namespace' statements will be indented one\n * additional indent. Otherwise, NO indentation will be added.\n *\n * @param   state             state of option.\n */\nvoid ASBeautifier::setNamespaceIndent(bool state)\n{\n\tnamespaceIndent = state;\n}\n\n/**\n * set the state of the label indentation option.\n * If true, labels will be indented one indent LESS than the\n * current indentation level.\n * If false, labels will be flushed to the left with NO\n * indent at all.\n *\n * @param   state             state of option.\n */\nvoid ASBeautifier::setLabelIndent(bool state)\n{\n\tlabelIndent = state;\n}\n\n/**\n * set the state of the preprocessor indentation option.\n * If true, multi-line #define statements will be indented.\n *\n * @param   state             state of option.\n */\nvoid ASBeautifier::setPreprocDefineIndent(bool state)\n{\n\tshouldIndentPreprocDefine = state;\n}\n\nvoid ASBeautifier::setPreprocConditionalIndent(bool state)\n{\n\tshouldIndentPreprocConditional = state;\n}\n\n/**\n * set the state of the empty line fill option.\n * If true, empty lines will be filled with the whitespace.\n * of their previous lines.\n * If false, these lines will remain empty.\n *\n * @param   state             state of option.\n */\nvoid ASBeautifier::setEmptyLineFill(bool state)\n{\n\temptyLineFill = state;\n}\n\nvoid ASBeautifier::setAlignMethodColon(bool state)\n{\n\tshouldAlignMethodColon = state;\n}\n\n/**\n * get the file type.\n */\nint ASBeautifier::getFileType() const\n{\n\treturn fileType;\n}\n\n/**\n * get the number of spaces per indent\n *\n * @return   value of indentLength option.\n */\nint ASBeautifier::getIndentLength(void) const\n{\n\treturn indentLength;\n}\n\n/**\n * get the char used for indentation, space or tab\n *\n * @return   the char used for indentation.\n */\nstring ASBeautifier::getIndentString(void) const\n{\n\treturn indentString;\n}\n\n/**\n * get mode manually set flag\n */\nbool ASBeautifier::getModeManuallySet() const\n{\n\treturn isModeManuallySet;\n}\n\n/**\n * get the state of the force tab indentation option.\n *\n * @return   state of force tab indentation.\n */\nbool ASBeautifier::getForceTabIndentation(void) const\n{\n\treturn shouldForceTabIndentation;\n}\n\n/**\n * get the state of the block indentation option.\n *\n * @return   state of blockIndent option.\n */\nbool ASBeautifier::getBlockIndent(void) const\n{\n\treturn blockIndent;\n}\n\n/**\n * get the state of the bracket indentation option.\n *\n * @return   state of bracketIndent option.\n */\nbool ASBeautifier::getBracketIndent(void) const\n{\n\treturn bracketIndent;\n}\n\n/**\n* Get the state of the namespace indentation option. If true, blocks\n* of the 'namespace' statement will be indented one additional indent.\n*\n* @return   state of namespaceIndent option.\n*/\nbool ASBeautifier::getNamespaceIndent(void) const\n{\n\treturn namespaceIndent;\n}\n\n/**\n * Get the state of the class indentation option. If true, blocks of\n * the 'class' statement will be indented one additional indent.\n *\n * @return   state of classIndent option.\n */\nbool ASBeautifier::getClassIndent(void) const\n{\n\treturn classIndent;\n}\n\n/**\n * Get the state of the class access modifier indentation option.\n * If true, the class access modifiers will be indented one-half indent.\n *\n * @return   state of modifierIndent option.\n */\nbool ASBeautifier::getModifierIndent(void) const\n{\n\treturn modifierIndent;\n}\n\n/**\n * get the state of the switch indentation option. If true, blocks of\n * the 'switch' statement will be indented one additional indent.\n *\n * @return   state of switchIndent option.\n */\nbool ASBeautifier::getSwitchIndent(void) const\n{\n\treturn switchIndent;\n}\n\n/**\n * get the state of the case indentation option. If true, lines of 'case'\n * statements will be indented one additional indent.\n *\n * @return   state of caseIndent option.\n */\nbool ASBeautifier::getCaseIndent(void) const\n{\n\treturn caseIndent;\n}\n\n/**\n * get the state of the empty line fill option.\n * If true, empty lines will be filled with the whitespace.\n * of their previous lines.\n * If false, these lines will remain empty.\n *\n * @return   state of emptyLineFill option.\n */\nbool ASBeautifier::getEmptyLineFill(void) const\n{\n\treturn emptyLineFill;\n}\n\n/**\n * get the state of the preprocessor indentation option.\n * If true, preprocessor \"define\" lines will be indented.\n * If false, preprocessor \"define\" lines will be unchanged.\n *\n * @return   state of shouldIndentPreprocDefine option.\n */\nbool ASBeautifier::getPreprocDefineIndent(void) const\n{\n\treturn shouldIndentPreprocDefine;\n}\n\n/**\n * get the length of the tab indentation option.\n *\n * @return   length of tab indent option.\n */\nint ASBeautifier::getTabLength(void) const\n{\n\treturn tabLength;\n}\n\n/**\n * beautify a line of source code.\n * every line of source code in a source code file should be sent\n * one after the other to the beautify method.\n *\n * @return      the indented line.\n * @param originalLine       the original unindented line.\n */\nstring ASBeautifier::beautify(const string &originalLine)\n{\n\tstring line;\n\tbool isInQuoteContinuation = isInVerbatimQuote | haveLineContinuationChar;\n\n\tcurrentHeader = NULL;\n\tlastLineHeader = NULL;\n\tblockCommentNoBeautify = blockCommentNoIndent;\n\tisInClass = false;\n\tisInSwitch = false;\n\tlineBeginsWithOpenBracket = false;\n\tlineBeginsWithCloseBracket = false;\n\tlineBeginsWithComma = false;\n\tlineIsCommentOnly = false;\n\tlineIsLineCommentOnly = false;\n\tshouldIndentBrackettedLine = true;\n\tisInAsmOneLine = false;\n\tlineOpensWithLineComment = false;\n\tlineOpensWithComment = false;\n\tlineStartsInComment = isInComment;\n\tpreviousLineProbationTab = false;\n\thaveLineContinuationChar = false;\n\tlineOpeningBlocksNum = 0;\n\tlineClosingBlocksNum = 0;\n\tif (isImmediatelyPostObjCMethodDefinition)\n\t\tclearObjCMethodDefinitionAlignment();\n\n\t// handle and remove white spaces around the line:\n\t// If not in comment, first find out size of white space before line,\n\t// so that possible comments starting in the line continue in\n\t// relation to the preliminary white-space.\n\tif (isInQuoteContinuation)\n\t{\n\t\t// trim a single space added by ASFormatter, otherwise leave it alone\n\t\tif (!(originalLine.length() == 1 && originalLine[0] == ' '))\n\t\t\tline = originalLine;\n\t}\n\telse if (isInComment || isInBeautifySQL)\n\t{\n\t\t// trim the end of comment and SQL lines\n\t\tline = originalLine;\n\t\tsize_t trimEnd = line.find_last_not_of(\" \\t\");\n\t\tif (trimEnd == string::npos)\n\t\t\ttrimEnd = 0;\n\t\telse\n\t\t\ttrimEnd++;\n\t\tif (trimEnd < line.length())\n\t\t\tline.erase(trimEnd);\n\t\t// does a bracket open the line\n\t\tsize_t firstChar = line.find_first_not_of(\" \\t\");\n\t\tif (firstChar != string::npos)\n\t\t{\n\t\t\tif (line[firstChar] == '{')\n\t\t\t\tlineBeginsWithOpenBracket = true;\n\t\t\telse if (line[firstChar] == '}')\n\t\t\t\tlineBeginsWithCloseBracket = true;\n\t\t\telse if (line[firstChar] == ',')\n\t\t\t\tlineBeginsWithComma = true;\n\t\t}\n\t}\n\telse\n\t{\n\t\tline = trim(originalLine);\n\t\tif (line.length() > 0)\n\t\t{\n\t\t\tif (line[0] == '{')\n\t\t\t\tlineBeginsWithOpenBracket = true;\n\t\t\telse if (line[0] == '}')\n\t\t\t\tlineBeginsWithCloseBracket = true;\n\t\t\telse if (line[0] == ',')\n\t\t\t\tlineBeginsWithComma = true;\n\t\t\telse if (line.compare(0, 2, \"//\") == 0)\n\t\t\t\tlineIsLineCommentOnly = true;\n\t\t\telse if (line.compare(0, 2, \"/*\") == 0)\n\t\t\t{\n\t\t\t\tif (line.find(\"*/\", 2) != string::npos)\n\t\t\t\t\tlineIsCommentOnly = true;\n\t\t\t}\n\t\t}\n\n\t\tisInHorstmannComment = false;\n\t\tsize_t j = line.find_first_not_of(\" \\t{\");\n\t\tif (j != string::npos && line.compare(j, 2, \"//\") == 0)\n\t\t\tlineOpensWithLineComment = true;\n\t\tif (j != string::npos && line.compare(j, 2, \"/*\") == 0)\n\t\t{\n\t\t\tlineOpensWithComment = true;\n\t\t\tsize_t k = line.find_first_not_of(\" \\t\");\n\t\t\tif (k != string::npos && line.compare(k, 1, \"{\") == 0)\n\t\t\t\tisInHorstmannComment = true;\n\t\t}\n\t}\n\n\t// When indent is OFF the lines must still be processed by ASBeautifier.\n\t// Otherwise the lines immediately following may not be indented correctly.\n\tif ((lineIsLineCommentOnly || lineIsCommentOnly)\n\t        && line.find(\"*INDENT-OFF*\", 0) != string::npos)\n\t\tisIndentModeOff = true;\n\n\tif (line.length() == 0)\n\t{\n\t\tif (backslashEndsPrevLine)\n\t\t{\n\t\t\tbackslashEndsPrevLine = false;\n\t\t\tisInDefine = false;\n\t\t\tisInDefineDefinition = false;\n\t\t}\n\t\tif (emptyLineFill && !isInQuoteContinuation)\n\t\t{\n\t\t\tif (isInIndentablePreprocBlock)\n\t\t\t\treturn preLineWS(preprocBlockIndent, 0);\n\t\t\telse if (!headerStack->empty() || isInEnum)\n\t\t\t\treturn preLineWS(prevFinalLineIndentCount, prevFinalLineSpaceIndentCount);\n\t\t\t// must fall thru here\n\t\t}\n\t\telse\n\t\t\treturn line;\n\t}\n\n\t// handle preprocessor commands\n\tif (isInIndentablePreprocBlock\n\t        && line.length() > 0\n\t        && line[0] != '#')\n\t{\n\t\tstring indentedLine;\n\t\tif (isInClassHeaderTab || isInClassInitializer)\n\t\t{\n\t\t\t// parsing is turned off in ASFormatter by indent-off\n\t\t\t// the originalLine will probably never be returned here\n\t\t\tindentedLine = preLineWS(prevFinalLineIndentCount, prevFinalLineSpaceIndentCount) + line;\n\t\t\treturn getIndentedLineReturn(indentedLine, originalLine);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tindentedLine = preLineWS(preprocBlockIndent, 0) + line;\n\t\t\treturn getIndentedLineReturn(indentedLine, originalLine);\n\t\t}\n\t}\n\tif (!isInComment\n\t        && !isInQuoteContinuation\n\t        && line.length() > 0\n\t        && ((line[0] == '#' && !isIndentedPreprocessor(line, 0))\n\t            || backslashEndsPrevLine))\n\t{\n\t\tif (line[0] == '#' && !isInDefine)\n\t\t{\n\t\t\tstring preproc = extractPreprocessorStatement(line);\n\t\t\tprocessPreprocessor(preproc, line);\n\t\t\tif (isInIndentablePreprocBlock || isInIndentablePreproc)\n\t\t\t{\n\t\t\t\tstring indentedLine;\n\t\t\t\tif ((preproc.length() >= 2 && preproc.substr(0, 2) == \"if\")) // #if, #ifdef, #ifndef\n\t\t\t\t{\n\t\t\t\t\tindentedLine = preLineWS(preprocBlockIndent, 0) + line;\n\t\t\t\t\tpreprocBlockIndent += 1;\n\t\t\t\t\tisInIndentablePreprocBlock = true;\n\t\t\t\t}\n\t\t\t\telse if (preproc == \"else\" || preproc == \"elif\")\n\t\t\t\t{\n\t\t\t\t\tindentedLine = preLineWS(preprocBlockIndent - 1, 0) + line;\n\t\t\t\t}\n\t\t\t\telse if (preproc == \"endif\")\n\t\t\t\t{\n\t\t\t\t\tpreprocBlockIndent -= 1;\n\t\t\t\t\tindentedLine = preLineWS(preprocBlockIndent, 0) + line;\n\t\t\t\t\tif (preprocBlockIndent == 0)\n\t\t\t\t\t\tisInIndentablePreprocBlock = false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tindentedLine = preLineWS(preprocBlockIndent, 0) + line;\n\t\t\t\treturn getIndentedLineReturn(indentedLine, originalLine);\n\t\t\t}\n\t\t\tif (shouldIndentPreprocConditional && preproc.length() > 0)\n\t\t\t{\n\t\t\t\tstring indentedLine;\n\t\t\t\tif (preproc.length() >= 2 && preproc.substr(0, 2) == \"if\") // #if, #ifdef, #ifndef\n\t\t\t\t{\n\t\t\t\t\tpair<int, int> entry;\t// indentCount, spaceIndentCount\n\t\t\t\t\tif (!isInDefine && activeBeautifierStack != NULL && !activeBeautifierStack->empty())\n\t\t\t\t\t\tentry = activeBeautifierStack->back()->computePreprocessorIndent();\n\t\t\t\t\telse\n\t\t\t\t\t\tentry = computePreprocessorIndent();\n\t\t\t\t\tpreprocIndentStack->push_back(entry);\n\t\t\t\t\tindentedLine = preLineWS(preprocIndentStack->back().first,\n\t\t\t\t\t                         preprocIndentStack->back().second) + line;\n\t\t\t\t\treturn getIndentedLineReturn(indentedLine, originalLine);\n\t\t\t\t}\n\t\t\t\telse if (preproc == \"else\" || preproc == \"elif\")\n\t\t\t\t{\n\t\t\t\t\tif (preprocIndentStack->size() > 0)\t// if no entry don't indent\n\t\t\t\t\t{\n\t\t\t\t\t\tindentedLine = preLineWS(preprocIndentStack->back().first,\n\t\t\t\t\t\t                         preprocIndentStack->back().second) + line;\n\t\t\t\t\t\treturn getIndentedLineReturn(indentedLine, originalLine);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (preproc == \"endif\")\n\t\t\t\t{\n\t\t\t\t\tif (preprocIndentStack->size() > 0)\t// if no entry don't indent\n\t\t\t\t\t{\n\t\t\t\t\t\tindentedLine = preLineWS(preprocIndentStack->back().first,\n\t\t\t\t\t\t                         preprocIndentStack->back().second) + line;\n\t\t\t\t\t\tpreprocIndentStack->pop_back();\n\t\t\t\t\t\treturn getIndentedLineReturn(indentedLine, originalLine);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// check if the last char is a backslash\n\t\tif (line.length() > 0)\n\t\t\tbackslashEndsPrevLine = (line[line.length() - 1] == '\\\\');\n\t\t// comments within the definition line can be continued without the backslash\n\t\tif (isInPreprocessorUnterminatedComment(line))\n\t\t\tbackslashEndsPrevLine = true;\n\n\t\t// check if this line ends a multi-line #define\n\t\t// if so, use the #define's cloned beautifier for the line's indentation\n\t\t// and then remove it from the active beautifier stack and delete it.\n\t\tif (!backslashEndsPrevLine && isInDefineDefinition && !isInDefine)\n\t\t{\n\t\t\tASBeautifier* defineBeautifier;\n\n\t\t\tisInDefineDefinition = false;\n\t\t\tdefineBeautifier = activeBeautifierStack->back();\n\t\t\tactiveBeautifierStack->pop_back();\n\n\t\t\tstring indentedLine = defineBeautifier->beautify(line);\n\t\t\tdelete defineBeautifier;\n\t\t\treturn getIndentedLineReturn(indentedLine, originalLine);\n\t\t}\n\n\t\t// unless this is a multi-line #define, return this precompiler line as is.\n\t\tif (!isInDefine && !isInDefineDefinition)\n\t\t\treturn originalLine;\n\t}\n\n\t// if there exists any worker beautifier in the activeBeautifierStack,\n\t// then use it instead of me to indent the current line.\n\t// variables set by ASFormatter must be updated.\n\tif (!isInDefine && activeBeautifierStack != NULL && !activeBeautifierStack->empty())\n\t{\n\t\tactiveBeautifierStack->back()->inLineNumber = inLineNumber;\n\t\tactiveBeautifierStack->back()->horstmannIndentInStatement = horstmannIndentInStatement;\n\t\tactiveBeautifierStack->back()->nonInStatementBracket = nonInStatementBracket;\n\t\tactiveBeautifierStack->back()->lineCommentNoBeautify = lineCommentNoBeautify;\n\t\tactiveBeautifierStack->back()->isElseHeaderIndent = isElseHeaderIndent;\n\t\tactiveBeautifierStack->back()->isCaseHeaderCommentIndent = isCaseHeaderCommentIndent;\n\t\tactiveBeautifierStack->back()->isNonInStatementArray = isNonInStatementArray;\n\t\tactiveBeautifierStack->back()->isSharpAccessor = isSharpAccessor;\n\t\tactiveBeautifierStack->back()->isSharpDelegate = isSharpDelegate;\n\t\tactiveBeautifierStack->back()->isInExternC = isInExternC;\n\t\tactiveBeautifierStack->back()->isInBeautifySQL = isInBeautifySQL;\n\t\tactiveBeautifierStack->back()->isInIndentableStruct = isInIndentableStruct;\n\t\tactiveBeautifierStack->back()->isInIndentablePreproc = isInIndentablePreproc;\n\t\t// must return originalLine not the trimmed line\n\t\treturn activeBeautifierStack->back()->beautify(originalLine);\n\t}\n\n\t// Flag an indented header in case this line is a one-line block.\n\t// The header in the header stack will be deleted by a one-line block.\n\tbool isInExtraHeaderIndent = false;\n\tif (!headerStack->empty()\n\t        && lineBeginsWithOpenBracket\n\t        && (headerStack->back() != &AS_OPEN_BRACKET\n\t            || probationHeader != NULL))\n\t\tisInExtraHeaderIndent = true;\n\n\tsize_t iPrelim = headerStack->size();\n\n\t// calculate preliminary indentation based on headerStack and data from past lines\n\tcomputePreliminaryIndentation();\n\n\t// parse characters in the current line.\n\tparseCurrentLine(line);\n\n\t// handle special cases of indentation\n\tadjustParsedLineIndentation(iPrelim, isInExtraHeaderIndent);\n\n\t// Objective-C continuation line\n\tif (isInObjCMethodDefinition)\n\t{\n\t\t// register indent for Objective-C continuation line\n\t\tif (line.length() > 0\n\t\t        && (line[0] == '-' || line[0] == '+'))\n\t\t{\n\t\t\tif (shouldAlignMethodColon)\n\t\t\t{\n\t\t\t\tcolonIndentObjCMethodDefinition = line.find(':');\n\t\t\t}\n\t\t\telse if (inStatementIndentStack->empty()\n\t\t\t         || inStatementIndentStack->back() == 0)\n\t\t\t{\n\t\t\t\tinStatementIndentStack->push_back(indentLength);\n\t\t\t\tisInStatement = true;\n\t\t\t}\n\t\t}\n\t\t// set indent for last definition line\n\t\telse if (!lineBeginsWithOpenBracket)\n\t\t{\n\t\t\tif (shouldAlignMethodColon)\n\t\t\t\tspaceIndentCount = computeObjCColonAlignment(line, colonIndentObjCMethodDefinition);\n\t\t\telse if (inStatementIndentStack->empty())\n\t\t\t\tspaceIndentCount = spaceIndentObjCMethodDefinition;\n\t\t}\n\t}\n\n\tif (isInDefine)\n\t{\n\t\tif (line.length() > 0 && line[0] == '#')\n\t\t{\n\t\t\t// the 'define' does not have to be attached to the '#'\n\t\t\tstring preproc = trim(line.substr(1));\n\t\t\tif (preproc.compare(0, 6, \"define\") == 0)\n\t\t\t{\n\t\t\t\tif (!inStatementIndentStack->empty()\n\t\t\t\t        && inStatementIndentStack->back() > 0)\n\t\t\t\t{\n\t\t\t\t\tdefineIndentCount = indentCount;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdefineIndentCount = indentCount - 1;\n\t\t\t\t\t--indentCount;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tindentCount -= defineIndentCount;\n\t}\n\n\tif (indentCount < 0)\n\t\tindentCount = 0;\n\n\tif (lineCommentNoBeautify || blockCommentNoBeautify || isInQuoteContinuation)\n\t\tindentCount = spaceIndentCount = 0;\n\n\t// finally, insert indentations into beginning of line\n\n\tstring indentedLine = preLineWS(indentCount, spaceIndentCount) + line;\n\tindentedLine = getIndentedLineReturn(indentedLine, originalLine);\n\n\tprevFinalLineSpaceIndentCount = spaceIndentCount;\n\tprevFinalLineIndentCount = indentCount;\n\n\tif (lastLineHeader != NULL)\n\t\tpreviousLastLineHeader = lastLineHeader;\n\n\tif ((lineIsLineCommentOnly || lineIsCommentOnly)\n\t        && line.find(\"*INDENT-ON*\", 0) != string::npos)\n\t\tisIndentModeOff = false;\n\n\treturn indentedLine;\n}\n\nstring &ASBeautifier::getIndentedLineReturn(string &newLine, const string &originalLine) const\n{\n\tif (isIndentModeOff)\n\t\treturn const_cast<string &>(originalLine);\n\treturn newLine;\n}\n\nstring ASBeautifier::preLineWS(int lineIndentCount, int lineSpaceIndentCount) const\n{\n\tif (shouldForceTabIndentation)\n\t{\n\t\tif (tabLength != indentLength)\n\t\t{\n\t\t\t// adjust for different tab length\n\t\t\tint indentCountOrig = lineIndentCount;\n\t\t\tint spaceIndentCountOrig = lineSpaceIndentCount;\n\t\t\tlineIndentCount = ((indentCountOrig * indentLength) + spaceIndentCountOrig) / tabLength;\n\t\t\tlineSpaceIndentCount = ((indentCountOrig * indentLength) + spaceIndentCountOrig) % tabLength;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlineIndentCount += lineSpaceIndentCount / indentLength;\n\t\t\tlineSpaceIndentCount = lineSpaceIndentCount % indentLength;\n\t\t}\n\t}\n\n\tstring ws;\n\tfor (int i = 0; i < lineIndentCount; i++)\n\t\tws += indentString;\n\twhile ((lineSpaceIndentCount--) > 0)\n\t\tws += string(\" \");\n\treturn ws;\n}\n\n/**\n * register an in-statement indent.\n */\nvoid ASBeautifier::registerInStatementIndent(const string &line, int i, int spaceTabCount_,\n                                             int tabIncrementIn, int minIndent, bool updateParenStack)\n{\n\tint inStatementIndent;\n\tint remainingCharNum = line.length() - i;\n\tint nextNonWSChar = getNextProgramCharDistance(line, i);\n\n\t// if indent is around the last char in the line, indent instead one indent from the previous indent\n\tif (nextNonWSChar == remainingCharNum)\n\t{\n\t\tint previousIndent = spaceTabCount_;\n\t\tif (!inStatementIndentStack->empty())\n\t\t\tpreviousIndent = inStatementIndentStack->back();\n\t\tint currIndent = /*2*/ indentLength + previousIndent;\n\t\tif (currIndent > maxInStatementIndent\n\t\t        && line[i] != '{')\n\t\t\tcurrIndent = indentLength * 2 + spaceTabCount_;\n\t\tinStatementIndentStack->push_back(currIndent);\n\t\tif (updateParenStack)\n\t\t\tparenIndentStack->push_back(previousIndent);\n\t\treturn;\n\t}\n\n\tif (updateParenStack)\n\t\tparenIndentStack->push_back(i + spaceTabCount_ - horstmannIndentInStatement);\n\n\tint tabIncrement = tabIncrementIn;\n\n\t// check for following tabs\n\tfor (int j = i + 1; j < (i + nextNonWSChar); j++)\n\t{\n\t\tif (line[j] == '\\t')\n\t\t\ttabIncrement += convertTabToSpaces(j, tabIncrement);\n\t}\n\n\tinStatementIndent = i + nextNonWSChar + spaceTabCount_ + tabIncrement;\n\n\t// check for run-in statement\n\tif (i > 0 && line[0] == '{')\n\t\tinStatementIndent -= indentLength;\n\n\tif (inStatementIndent < minIndent)\n\t\tinStatementIndent = minIndent + spaceTabCount_;\n\n\t// this is not done for an in-statement array\n\tif (inStatementIndent > maxInStatementIndent\n\t        && !(prevNonLegalCh == '=' && currentNonLegalCh == '{'))\n\t\tinStatementIndent = indentLength * 2 + spaceTabCount_;\n\n\tif (!inStatementIndentStack->empty()\n\t        && inStatementIndent < inStatementIndentStack->back())\n\t\tinStatementIndent = inStatementIndentStack->back();\n\n\t// the block opener is not indented for a NonInStatementArray\n\tif (isNonInStatementArray && !isInEnum && !bracketBlockStateStack->empty() && bracketBlockStateStack->back())\n\t\tinStatementIndent = 0;\n\n\tinStatementIndentStack->push_back(inStatementIndent);\n}\n\n/**\n* Register an in-statement indent for a class header or a class initializer colon.\n*/\nvoid ASBeautifier::registerInStatementIndentColon(const string &line, int i, int tabIncrementIn)\n{\n\tassert(line[i] == ':');\n\tassert(isInClassInitializer || isInClassHeaderTab);\n\n\t// register indent at first word after the colon\n\tsize_t firstChar = line.find_first_not_of(\" \\t\");\n\tif (firstChar == (size_t)i)\t\t// firstChar is ':'\n\t{\n\t\tsize_t firstWord = line.find_first_not_of(\" \\t\", firstChar + 1);\n\t\tif (firstChar != string::npos)\n\t\t{\n\t\t\tint inStatementIndent = firstWord + spaceIndentCount + tabIncrementIn;\n\t\t\tinStatementIndentStack->push_back(inStatementIndent);\n\t\t\tisInStatement = true;\n\t\t}\n\t}\n}\n\n/**\n * Compute indentation for a preprocessor #if statement.\n * This may be called for the activeBeautiferStack\n * instead of the active ASBeautifier object.\n */\npair<int, int> ASBeautifier::computePreprocessorIndent()\n{\n\tcomputePreliminaryIndentation();\n\tpair<int, int> entry(indentCount, spaceIndentCount);\n\tif (!headerStack->empty()\n\t        && entry.first > 0\n\t        && (headerStack->back() == &AS_IF\n\t            || headerStack->back() == &AS_ELSE\n\t            || headerStack->back() == &AS_FOR\n\t            || headerStack->back() == &AS_WHILE))\n\t\t--entry.first;\n\treturn entry;\n}\n\n/**\n * get distance to the next non-white space, non-comment character in the line.\n * if no such character exists, return the length remaining to the end of the line.\n */\nint ASBeautifier::getNextProgramCharDistance(const string &line, int i) const\n{\n\tbool inComment = false;\n\tint  remainingCharNum = line.length() - i;\n\tint  charDistance;\n\tchar ch;\n\n\tfor (charDistance = 1; charDistance < remainingCharNum; charDistance++)\n\t{\n\t\tch = line[i + charDistance];\n\t\tif (inComment)\n\t\t{\n\t\t\tif (line.compare(i + charDistance, 2, \"*/\") == 0)\n\t\t\t{\n\t\t\t\tcharDistance++;\n\t\t\t\tinComment = false;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\telse if (isWhiteSpace(ch))\n\t\t\tcontinue;\n\t\telse if (ch == '/')\n\t\t{\n\t\t\tif (line.compare(i + charDistance, 2, \"//\") == 0)\n\t\t\t\treturn remainingCharNum;\n\t\t\telse if (line.compare(i + charDistance, 2, \"/*\") == 0)\n\t\t\t{\n\t\t\t\tcharDistance++;\n\t\t\t\tinComment = true;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\treturn charDistance;\n\t}\n\n\treturn charDistance;\n}\n\n// check if a specific line position contains a header.\nconst string* ASBeautifier::findHeader(const string &line, int i,\n                                       const vector<const string*>* possibleHeaders) const\n{\n\tassert(isCharPotentialHeader(line, i));\n\t// check the word\n\tsize_t maxHeaders = possibleHeaders->size();\n\tfor (size_t p = 0; p < maxHeaders; p++)\n\t{\n\t\tconst string* header = (*possibleHeaders)[p];\n\t\tconst size_t wordEnd = i + header->length();\n\t\tif (wordEnd > line.length())\n\t\t\tcontinue;\n\t\tint result = (line.compare(i, header->length(), *header));\n\t\tif (result > 0)\n\t\t\tcontinue;\n\t\tif (result < 0)\n\t\t\tbreak;\n\t\t// check that this is not part of a longer word\n\t\tif (wordEnd == line.length())\n\t\t\treturn header;\n\t\tif (isLegalNameChar(line[wordEnd]))\n\t\t\tcontinue;\n\t\tconst char peekChar = peekNextChar(line, wordEnd - 1);\n\t\t// is not a header if part of a definition\n\t\tif (peekChar == ',' || peekChar == ')')\n\t\t\tbreak;\n\t\t// the following accessor definitions are NOT headers\n\t\t// goto default; is NOT a header\n\t\t// default(int) keyword in C# is NOT a header\n\t\telse if ((header == &AS_GET || header == &AS_SET || header == &AS_DEFAULT)\n\t\t         && (peekChar == ';' || peekChar == '(' || peekChar == '='))\n\t\t\tbreak;\n\t\treturn header;\n\t}\n\treturn NULL;\n}\n\n// check if a specific line position contains an operator.\nconst string* ASBeautifier::findOperator(const string &line, int i,\n                                         const vector<const string*>* possibleOperators) const\n{\n\tassert(isCharPotentialOperator(line[i]));\n\t// find the operator in the vector\n\t// the vector contains the LONGEST operators first\n\t// must loop thru the entire vector\n\tsize_t maxOperators = possibleOperators->size();\n\tfor (size_t p = 0; p < maxOperators; p++)\n\t{\n\t\tconst size_t wordEnd = i + (*(*possibleOperators)[p]).length();\n\t\tif (wordEnd > line.length())\n\t\t\tcontinue;\n\t\tif (line.compare(i, (*(*possibleOperators)[p]).length(), *(*possibleOperators)[p]) == 0)\n\t\t\treturn (*possibleOperators)[p];\n\t}\n\treturn NULL;\n}\n\n/**\n * find the index number of a string element in a container of strings\n *\n * @return              the index number of element in the container. -1 if element not found.\n * @param container     a vector of strings.\n * @param element       the element to find .\n */\nint ASBeautifier::indexOf(vector<const string*> &container, const string* element) const\n{\n\tvector<const string*>::const_iterator where;\n\n\twhere = find(container.begin(), container.end(), element);\n\tif (where == container.end())\n\t\treturn -1;\n\telse\n\t\treturn (int) (where - container.begin());\n}\n\n/**\n * convert tabs to spaces.\n * i is the position of the character to convert to spaces.\n * tabIncrementIn is the increment that must be added for tab indent characters\n *     to get the correct column for the current tab.\n */\nint ASBeautifier::convertTabToSpaces(int i, int tabIncrementIn) const\n{\n\tint tabToSpacesAdjustment = indentLength - 1 - ((tabIncrementIn + i) % indentLength);\n\treturn tabToSpacesAdjustment;\n}\n\n/**\n * trim removes the white space surrounding a line.\n *\n * @return          the trimmed line.\n * @param str       the line to trim.\n */\nstring ASBeautifier::trim(const string &str) const\n{\n\n\tint start = 0;\n\tint end = str.length() - 1;\n\n\twhile (start < end && isWhiteSpace(str[start]))\n\t\tstart++;\n\n\twhile (start <= end && isWhiteSpace(str[end]))\n\t\tend--;\n\n\t// don't trim if it ends in a continuation\n\tif (end > -1 && str[end] == '\\\\')\n\t\tend = str.length() - 1;\n\n\tstring returnStr(str, start, end + 1 - start);\n\treturn returnStr;\n}\n\n/**\n * rtrim removes the white space from the end of a line.\n *\n * @return          the trimmed line.\n * @param str       the line to trim.\n */\nstring ASBeautifier::rtrim(const string &str) const\n{\n\tsize_t len = str.length();\n\tsize_t end = str.find_last_not_of(\" \\t\");\n\tif (end == string::npos\n\t        || end == len - 1)\n\t\treturn str;\n\tstring returnStr(str, 0, end + 1);\n\treturn returnStr;\n}\n\n/**\n * Copy tempStacks for the copy constructor.\n * The value of the vectors must also be copied.\n */\nvector<vector<const string*>*>* ASBeautifier::copyTempStacks(const ASBeautifier &other) const\n{\n\tvector<vector<const string*>*>* tempStacksNew = new vector<vector<const string*>*>;\n\tvector<vector<const string*>*>::iterator iter;\n\tfor (iter = other.tempStacks->begin();\n\t        iter != other.tempStacks->end();\n\t        ++iter)\n\t{\n\t\tvector<const string*>* newVec = new vector<const string*>;\n\t\t*newVec = **iter;\n\t\ttempStacksNew->push_back(newVec);\n\t}\n\treturn tempStacksNew;\n}\n\n/**\n * delete a member vectors to eliminate memory leak reporting\n */\nvoid ASBeautifier::deleteBeautifierVectors()\n{\n\tbeautifierFileType = 9;\t\t// reset to an invalid type\n\tdelete headers;\n\tdelete nonParenHeaders;\n\tdelete preBlockStatements;\n\tdelete preCommandHeaders;\n\tdelete assignmentOperators;\n\tdelete nonAssignmentOperators;\n\tdelete indentableHeaders;\n}\n\n/**\n * delete a vector object\n * T is the type of vector\n * used for all vectors except tempStacks\n */\ntemplate<typename T>\nvoid ASBeautifier::deleteContainer(T &container)\n{\n\tif (container != NULL)\n\t{\n\t\tcontainer->clear();\n\t\tdelete (container);\n\t\tcontainer = NULL;\n\t}\n}\n\n/**\n * Delete the ASBeautifier vector object.\n * This is a vector of pointers to ASBeautifier objects allocated with the 'new' operator.\n * Therefore the ASBeautifier objects have to be deleted in addition to the\n * ASBeautifier pointer entries.\n */\nvoid ASBeautifier::deleteBeautifierContainer(vector<ASBeautifier*>* &container)\n{\n\tif (container != NULL)\n\t{\n\t\tvector<ASBeautifier*>::iterator iter = container->begin();\n\t\twhile (iter < container->end())\n\t\t{\n\t\t\tdelete *iter;\n\t\t\t++iter;\n\t\t}\n\t\tcontainer->clear();\n\t\tdelete (container);\n\t\tcontainer = NULL;\n\t}\n}\n\n/**\n * Delete the tempStacks vector object.\n * The tempStacks is a vector of pointers to strings allocated with the 'new' operator.\n * Therefore the strings have to be deleted in addition to the tempStacks entries.\n */\nvoid ASBeautifier::deleteTempStacksContainer(vector<vector<const string*>*>* &container)\n{\n\tif (container != NULL)\n\t{\n\t\tvector<vector<const string*>*>::iterator iter = container->begin();\n\t\twhile (iter < container->end())\n\t\t{\n\t\t\tdelete *iter;\n\t\t\t++iter;\n\t\t}\n\t\tcontainer->clear();\n\t\tdelete (container);\n\t\tcontainer = NULL;\n\t}\n}\n\n/**\n * initialize a vector object\n * T is the type of vector used for all vectors\n */\ntemplate<typename T>\nvoid ASBeautifier::initContainer(T &container, T value)\n{\n\t// since the ASFormatter object is never deleted,\n\t// the existing vectors must be deleted before creating new ones\n\tif (container != NULL)\n\t\tdeleteContainer(container);\n\tcontainer = value;\n}\n\n/**\n * Initialize the tempStacks vector object.\n * The tempStacks is a vector of pointers to strings allocated with the 'new' operator.\n * Any residual entries are deleted before the vector is initialized.\n */\nvoid ASBeautifier::initTempStacksContainer(vector<vector<const string*>*>* &container,\n                                           vector<vector<const string*>*>* value)\n{\n\tif (container != NULL)\n\t\tdeleteTempStacksContainer(container);\n\tcontainer = value;\n}\n\n/**\n * Determine if an assignment statement ends with a comma\n *     that is not in a function argument. It ends with a\n *     comma if a comma is the last char on the line.\n *\n * @return  true if line ends with a comma, otherwise false.\n */\nbool ASBeautifier::statementEndsWithComma(const string &line, int index) const\n{\n\tassert(line[index] == '=');\n\n\tbool isInComment_ = false;\n\tbool isInQuote_ = false;\n\tint parenCount = 0;\n\tsize_t lineLength = line.length();\n\tsize_t i = 0;\n\tchar quoteChar_ = ' ';\n\n\tfor (i = index + 1; i < lineLength; ++i)\n\t{\n\t\tchar ch = line[i];\n\n\t\tif (isInComment_)\n\t\t{\n\t\t\tif (line.compare(i, 2, \"*/\") == 0)\n\t\t\t{\n\t\t\t\tisInComment_ = false;\n\t\t\t\t++i;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (ch == '\\\\')\n\t\t{\n\t\t\t++i;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isInQuote_)\n\t\t{\n\t\t\tif (ch == quoteChar_)\n\t\t\t\tisInQuote_ = false;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (ch == '\"' || ch == '\\'')\n\t\t{\n\t\t\tisInQuote_ = true;\n\t\t\tquoteChar_ = ch;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (line.compare(i, 2, \"//\") == 0)\n\t\t\tbreak;\n\n\t\tif (line.compare(i, 2, \"/*\") == 0)\n\t\t{\n\t\t\tif (isLineEndComment(line, i))\n\t\t\t\tbreak;\n\t\t\telse\n\t\t\t{\n\t\t\t\tisInComment_ = true;\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (ch == '(')\n\t\t\tparenCount++;\n\t\tif (ch == ')')\n\t\t\tparenCount--;\n\t}\n\tif (isInComment_\n\t        || isInQuote_\n\t        || parenCount > 0)\n\t\treturn false;\n\n\tsize_t lastChar = line.find_last_not_of(\" \\t\", i - 1);\n\n\tif (lastChar == string::npos || line[lastChar] != ',')\n\t\treturn false;\n\n\treturn true;\n}\n\n/**\n * check if current comment is a line-end comment\n *\n * @return     is before a line-end comment.\n */\nbool ASBeautifier::isLineEndComment(const string &line, int startPos) const\n{\n\tassert(line.compare(startPos, 2, \"/*\") == 0);\n\n\t// comment must be closed on this line with nothing after it\n\tsize_t endNum = line.find(\"*/\", startPos + 2);\n\tif (endNum != string::npos)\n\t{\n\t\tsize_t nextChar = line.find_first_not_of(\" \\t\", endNum + 2);\n\t\tif (nextChar == string::npos)\n\t\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * get the previous word index for an assignment operator\n *\n * @return is the index to the previous word (the in statement indent).\n */\nint ASBeautifier::getInStatementIndentAssign(const string &line, size_t currPos) const\n{\n\tassert(line[currPos] == '=');\n\n\tif (currPos == 0)\n\t\treturn 0;\n\n\t// get the last legal word (may be a number)\n\tsize_t end = line.find_last_not_of(\" \\t\", currPos - 1);\n\tif (end == string::npos || !isLegalNameChar(line[end]))\n\t\treturn 0;\n\n\tint start;          // start of the previous word\n\tfor (start = end; start > -1; start--)\n\t{\n\t\tif (!isLegalNameChar(line[start]) || line[start] == '.')\n\t\t\tbreak;\n\t}\n\tstart++;\n\n\treturn start;\n}\n\n/**\n * get the instatement indent for a comma\n *\n * @return is the indent to the second word on the line (the in statement indent).\n */\nint ASBeautifier::getInStatementIndentComma(const string &line, size_t currPos) const\n{\n\tassert(line[currPos] == ',');\n\n\t// get first word on a line\n\tsize_t indent = line.find_first_not_of(\" \\t\");\n\tif (indent == string::npos || !isLegalNameChar(line[indent]))\n\t\treturn 0;\n\n\t// bypass first word\n\tfor (; indent < currPos; indent++)\n\t{\n\t\tif (!isLegalNameChar(line[indent]))\n\t\t\tbreak;\n\t}\n\tindent++;\n\tif (indent >= currPos || indent < 4)\n\t\treturn 0;\n\n\t// point to second word or assignment operator\n\tindent = line.find_first_not_of(\" \\t\", indent);\n\tif (indent == string::npos || indent >= currPos)\n\t\treturn 0;\n\n\treturn indent;\n}\n\n/**\n * get the next word on a line\n * the argument 'currPos' must point to the current position.\n *\n * @return is the next word or an empty string if none found.\n */\nstring ASBeautifier::getNextWord(const string &line, size_t currPos) const\n{\n\tsize_t lineLength = line.length();\n\t// get the last legal word (may be a number)\n\tif (currPos == lineLength - 1)\n\t\treturn string();\n\n\tsize_t start = line.find_first_not_of(\" \\t\", currPos + 1);\n\tif (start == string::npos || !isLegalNameChar(line[start]))\n\t\treturn string();\n\n\tsize_t end;\t\t\t// end of the current word\n\tfor (end = start + 1; end <= lineLength; end++)\n\t{\n\t\tif (!isLegalNameChar(line[end]) || line[end] == '.')\n\t\t\tbreak;\n\t}\n\n\treturn line.substr(start, end - start);\n}\n\n/**\n * Check if a preprocessor directive is always indented.\n * C# \"region\" and \"endregion\" are always indented.\n * C/C++ \"pragma omp\" is always indented.\n *\n * @return is true or false.\n */\nbool ASBeautifier::isIndentedPreprocessor(const string &line, size_t currPos) const\n{\n\tassert(line[0] == '#');\n\tstring nextWord = getNextWord(line, currPos);\n\tif (nextWord == \"region\" || nextWord == \"endregion\")\n\t\treturn true;\n\t// is it #pragma omp\n\tif (nextWord == \"pragma\")\n\t{\n\t\t// find pragma\n\t\tsize_t start = line.find(\"pragma\");\n\t\tif (start == string::npos || !isLegalNameChar(line[start]))\n\t\t\treturn false;\n\t\t// bypass pragma\n\t\tfor (; start < line.length(); start++)\n\t\t{\n\t\t\tif (!isLegalNameChar(line[start]))\n\t\t\t\tbreak;\n\t\t}\n\t\tstart++;\n\t\tif (start >= line.length())\n\t\t\treturn false;\n\t\t// point to start of second word\n\t\tstart = line.find_first_not_of(\" \\t\", start);\n\t\tif (start == string::npos)\n\t\t\treturn false;\n\t\t// point to end of second word\n\t\tsize_t end;\n\t\tfor (end = start; end < line.length(); end++)\n\t\t{\n\t\t\tif (!isLegalNameChar(line[end]))\n\t\t\t\tbreak;\n\t\t}\n\t\t// check for \"pragma omp\"\n\t\tstring word = line.substr(start, end - start);\n\t\tif (word == \"omp\" || word == \"region\" || word == \"endregion\")\n\t\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * Check if a preprocessor directive is checking for __cplusplus defined.\n *\n * @return is true or false.\n */\nbool ASBeautifier::isPreprocessorConditionalCplusplus(const string &line) const\n{\n\tstring preproc = trim(line.substr(1));\n\tif (preproc.compare(0, 5, \"ifdef\") == 0 && getNextWord(preproc, 4) == \"__cplusplus\")\n\t\treturn true;\n\tif (preproc.compare(0, 2, \"if\") == 0)\n\t{\n\t\t// check for \" #if defined(__cplusplus)\"\n\t\tsize_t charNum = 2;\n\t\tcharNum = preproc.find_first_not_of(\" \\t\", charNum);\n\t\tif (preproc.compare(charNum, 7, \"defined\") == 0)\n\t\t{\n\t\t\tcharNum += 7;\n\t\t\tcharNum = preproc.find_first_not_of(\" \\t\", charNum);\n\t\t\tif (preproc.compare(charNum, 1, \"(\") == 0)\n\t\t\t{\n\t\t\t\t++charNum;\n\t\t\t\tcharNum = preproc.find_first_not_of(\" \\t\", charNum);\n\t\t\t\tif (preproc.compare(charNum, 11, \"__cplusplus\") == 0)\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n}\n\n/**\n * Check if a preprocessor definition contains an unterminated comment.\n * Comments within a preprocessor definition can be continued without the backslash.\n *\n * @return is true or false.\n */\nbool ASBeautifier::isInPreprocessorUnterminatedComment(const string &line)\n{\n\tif (!isInPreprocessorComment)\n\t{\n\t\tsize_t startPos = line.find(\"/*\");\n\t\tif (startPos == string::npos)\n\t\t\treturn false;\n\t}\n\tsize_t endNum = line.find(\"*/\");\n\tif (endNum != string::npos)\n\t{\n\t\tisInPreprocessorComment = false;\n\t\treturn false;\n\t}\n\tisInPreprocessorComment = true;\n\treturn true;\n}\n\nvoid ASBeautifier::popLastInStatementIndent()\n{\n\tassert(!inStatementIndentStackSizeStack->empty());\n\tint previousIndentStackSize = inStatementIndentStackSizeStack->back();\n\tif (inStatementIndentStackSizeStack->size() > 1)\n\t\tinStatementIndentStackSizeStack->pop_back();\n\twhile (previousIndentStackSize < (int) inStatementIndentStack->size())\n\t\tinStatementIndentStack->pop_back();\n}\n\n// for unit testing\nint ASBeautifier::getBeautifierFileType() const\n{ return beautifierFileType; }\n\n/**\n * Process preprocessor statements and update the beautifier stacks.\n */\nvoid ASBeautifier::processPreprocessor(const string &preproc, const string &line)\n{\n\t// When finding a multi-lined #define statement, the original beautifier\n\t// 1. sets its isInDefineDefinition flag\n\t// 2. clones a new beautifier that will be used for the actual indentation\n\t//    of the #define. This clone is put into the activeBeautifierStack in order\n\t//    to be called for the actual indentation.\n\t// The original beautifier will have isInDefineDefinition = true, isInDefine = false\n\t// The cloned beautifier will have   isInDefineDefinition = true, isInDefine = true\n\tif (shouldIndentPreprocDefine && preproc == \"define\" && line[line.length() - 1] == '\\\\')\n\t{\n\t\tif (!isInDefineDefinition)\n\t\t{\n\t\t\tASBeautifier* defineBeautifier;\n\n\t\t\t// this is the original beautifier\n\t\t\tisInDefineDefinition = true;\n\n\t\t\t// push a new beautifier into the active stack\n\t\t\t// this beautifier will be used for the indentation of this define\n\t\t\tdefineBeautifier = new ASBeautifier(*this);\n\t\t\tactiveBeautifierStack->push_back(defineBeautifier);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// the is the cloned beautifier that is in charge of indenting the #define.\n\t\t\tisInDefine = true;\n\t\t}\n\t}\n\telse if (preproc.length() >= 2 && preproc.substr(0, 2) == \"if\")\n\t{\n\t\tif (isPreprocessorConditionalCplusplus(line) && !g_preprocessorCppExternCBracket)\n\t\t\tg_preprocessorCppExternCBracket = 1;\n\t\t// push a new beautifier into the stack\n\t\twaitingBeautifierStackLengthStack->push_back(waitingBeautifierStack->size());\n\t\tactiveBeautifierStackLengthStack->push_back(activeBeautifierStack->size());\n\t\tif (activeBeautifierStackLengthStack->back() == 0)\n\t\t\twaitingBeautifierStack->push_back(new ASBeautifier(*this));\n\t\telse\n\t\t\twaitingBeautifierStack->push_back(new ASBeautifier(*activeBeautifierStack->back()));\n\t}\n\telse if (preproc == \"else\")\n\t{\n\t\tif (waitingBeautifierStack && !waitingBeautifierStack->empty())\n\t\t{\n\t\t\t// MOVE current waiting beautifier to active stack.\n\t\t\tactiveBeautifierStack->push_back(waitingBeautifierStack->back());\n\t\t\twaitingBeautifierStack->pop_back();\n\t\t}\n\t}\n\telse if (preproc == \"elif\")\n\t{\n\t\tif (waitingBeautifierStack && !waitingBeautifierStack->empty())\n\t\t{\n\t\t\t// append a COPY current waiting beautifier to active stack, WITHOUT deleting the original.\n\t\t\tactiveBeautifierStack->push_back(new ASBeautifier(*(waitingBeautifierStack->back())));\n\t\t}\n\t}\n\telse if (preproc == \"endif\")\n\t{\n\t\tint stackLength;\n\t\tASBeautifier* beautifier;\n\n\t\tif (waitingBeautifierStackLengthStack != NULL && !waitingBeautifierStackLengthStack->empty())\n\t\t{\n\t\t\tstackLength = waitingBeautifierStackLengthStack->back();\n\t\t\twaitingBeautifierStackLengthStack->pop_back();\n\t\t\twhile ((int) waitingBeautifierStack->size() > stackLength)\n\t\t\t{\n\t\t\t\tbeautifier = waitingBeautifierStack->back();\n\t\t\t\twaitingBeautifierStack->pop_back();\n\t\t\t\tdelete beautifier;\n\t\t\t}\n\t\t}\n\n\t\tif (!activeBeautifierStackLengthStack->empty())\n\t\t{\n\t\t\tstackLength = activeBeautifierStackLengthStack->back();\n\t\t\tactiveBeautifierStackLengthStack->pop_back();\n\t\t\twhile ((int) activeBeautifierStack->size() > stackLength)\n\t\t\t{\n\t\t\t\tbeautifier = activeBeautifierStack->back();\n\t\t\t\tactiveBeautifierStack->pop_back();\n\t\t\t\tdelete beautifier;\n\t\t\t}\n\t\t}\n\t}\n}\n\n// Compute the preliminary indentation based on data in the headerStack\n// and data from previous lines.\n// Update the class variable indentCount.\nvoid ASBeautifier::computePreliminaryIndentation()\n{\n\tindentCount = 0;\n\tspaceIndentCount = 0;\n\tisInClassHeaderTab = false;\n\n\tif (isInObjCMethodDefinition && !inStatementIndentStack->empty())\n\t\tspaceIndentObjCMethodDefinition = inStatementIndentStack->back();\n\n\tif (!inStatementIndentStack->empty())\n\t\tspaceIndentCount = inStatementIndentStack->back();\n\n\tfor (size_t i = 0; i < headerStack->size(); i++)\n\t{\n\t\tisInClass = false;\n\n\t\tif (blockIndent)\n\t\t{\n\t\t\t// do NOT indent opening block for these headers\n\t\t\tif (!((*headerStack)[i] == &AS_NAMESPACE\n\t\t\t        || (*headerStack)[i] == &AS_CLASS\n\t\t\t        || (*headerStack)[i] == &AS_STRUCT\n\t\t\t        || (*headerStack)[i] == &AS_UNION\n\t\t\t        || (*headerStack)[i] == &AS_INTERFACE\n\t\t\t        || (*headerStack)[i] == &AS_THROWS\n\t\t\t        || (*headerStack)[i] == &AS_STATIC))\n\t\t\t\t++indentCount;\n\t\t}\n\t\telse if (!(i > 0 && (*headerStack)[i - 1] != &AS_OPEN_BRACKET\n\t\t           && (*headerStack)[i] == &AS_OPEN_BRACKET))\n\t\t\t++indentCount;\n\n\t\tif (!isJavaStyle() && !namespaceIndent && i > 0\n\t\t        && (*headerStack)[i - 1] == &AS_NAMESPACE\n\t\t        && (*headerStack)[i] == &AS_OPEN_BRACKET)\n\t\t\t--indentCount;\n\n\t\tif (isCStyle() && i >= 1\n\t\t        && (*headerStack)[i - 1] == &AS_CLASS\n\t\t        && (*headerStack)[i] == &AS_OPEN_BRACKET)\n\t\t{\n\t\t\tif (classIndent)\n\t\t\t\t++indentCount;\n\t\t\tisInClass = true;\n\t\t}\n\n\t\t// is the switchIndent option is on, indent switch statements an additional indent.\n\t\telse if (switchIndent && i > 1\n\t\t         && (*headerStack)[i - 1] == &AS_SWITCH\n\t\t         && (*headerStack)[i] == &AS_OPEN_BRACKET)\n\t\t{\n\t\t\t++indentCount;\n\t\t\tisInSwitch = true;\n\t\t}\n\n\t}\t// end of for loop\n\n\tif (isInClassHeader)\n\t{\n\t\tif (!isJavaStyle())\n\t\t\tisInClassHeaderTab = true;\n\t\tif (lineOpensWithLineComment || lineStartsInComment || lineOpensWithComment)\n\t\t{\n\t\t\tif (!lineBeginsWithOpenBracket)\n\t\t\t\t--indentCount;\n\t\t\tif (!inStatementIndentStack->empty())\n\t\t\t\tspaceIndentCount -= inStatementIndentStack->back();\n\t\t}\n\t\telse if (blockIndent)\n\t\t{\n\t\t\tif (!lineBeginsWithOpenBracket)\n\t\t\t\t++indentCount;\n\t\t}\n\t}\n\n\tif (isInClassInitializer || isInEnumTypeID)\n\t{\n\t\tindentCount += classInitializerIndents;\n\t}\n\n\tif (isInEnum && lineBeginsWithComma && !inStatementIndentStack->empty())\n\t{\n\t\t// unregister '=' indent from the previous line\n\t\tinStatementIndentStack->pop_back();\n\t\tisInStatement = false;\n\t\tspaceIndentCount = 0;\n\t}\n\n\t// Objective-C interface continuation line\n\tif (isInObjCInterface)\n\t\t++indentCount;\n\n\t// unindent a class closing bracket...\n\tif (!lineStartsInComment\n\t        && isCStyle()\n\t        && isInClass\n\t        && classIndent\n\t        && headerStack->size() >= 2\n\t        && (*headerStack)[headerStack->size() - 2] == &AS_CLASS\n\t        && (*headerStack)[headerStack->size() - 1] == &AS_OPEN_BRACKET\n\t        && lineBeginsWithCloseBracket\n\t        && bracketBlockStateStack->back() == true)\n\t\t--indentCount;\n\n\t// unindent an indented switch closing bracket...\n\telse if (!lineStartsInComment\n\t         && isInSwitch\n\t         && switchIndent\n\t         && headerStack->size() >= 2\n\t         && (*headerStack)[headerStack->size() - 2] == &AS_SWITCH\n\t         && (*headerStack)[headerStack->size() - 1] == &AS_OPEN_BRACKET\n\t         && lineBeginsWithCloseBracket)\n\t\t--indentCount;\n\n\t// handle special case of horstmann comment in an indented class statement\n\tif (isInClass\n\t        && classIndent\n\t        && isInHorstmannComment\n\t        && !lineOpensWithComment\n\t        && headerStack->size() > 1\n\t        && (*headerStack)[headerStack->size() - 2] == &AS_CLASS)\n\t\t--indentCount;\n\n\tif (isInConditional)\n\t\t--indentCount;\n\tif (g_preprocessorCppExternCBracket >= 4)\n\t\t--indentCount;\n}\n\nvoid ASBeautifier::adjustParsedLineIndentation(size_t iPrelim, bool isInExtraHeaderIndent)\n{\n\tif (lineStartsInComment)\n\t\treturn;\n\n\t// unindent a one-line statement in a header indent\n\tif (!blockIndent\n\t        && lineBeginsWithOpenBracket\n\t        && headerStack->size() < iPrelim\n\t        && isInExtraHeaderIndent\n\t        && (lineOpeningBlocksNum > 0 && lineOpeningBlocksNum <= lineClosingBlocksNum)\n\t        && shouldIndentBrackettedLine)\n\t\t--indentCount;\n\n\t/*\n\t * if '{' doesn't follow an immediately previous '{' in the headerStack\n\t * (but rather another header such as \"for\" or \"if\", then unindent it\n\t * by one indentation relative to its block.\n\t */\n\telse if (!blockIndent\n\t         && lineBeginsWithOpenBracket\n\t         && !(lineOpeningBlocksNum > 0 && lineOpeningBlocksNum <= lineClosingBlocksNum)\n\t         && (headerStack->size() > 1 && (*headerStack)[headerStack->size() - 2] != &AS_OPEN_BRACKET)\n\t         && shouldIndentBrackettedLine)\n\t\t--indentCount;\n\n\t// must check one less in headerStack if more than one header on a line (allow-addins)...\n\telse if (headerStack->size() > iPrelim + 1\n\t         && !blockIndent\n\t         && lineBeginsWithOpenBracket\n\t         && !(lineOpeningBlocksNum > 0 && lineOpeningBlocksNum <= lineClosingBlocksNum)\n\t         && (headerStack->size() > 2 && (*headerStack)[headerStack->size() - 3] != &AS_OPEN_BRACKET)\n\t         && shouldIndentBrackettedLine)\n\t\t--indentCount;\n\n\t// unindent a closing bracket...\n\telse if (lineBeginsWithCloseBracket\n\t         && shouldIndentBrackettedLine)\n\t\t--indentCount;\n\n\t// correctly indent one-line-blocks...\n\telse if (lineOpeningBlocksNum > 0\n\t         && lineOpeningBlocksNum == lineClosingBlocksNum\n\t         && previousLineProbationTab)\n\t\t--indentCount;\n\n\tif (indentCount < 0)\n\t\tindentCount = 0;\n\n\t// take care of extra bracket indentation option...\n\tif (!lineStartsInComment\n\t        && bracketIndent\n\t        && shouldIndentBrackettedLine\n\t        && (lineBeginsWithOpenBracket || lineBeginsWithCloseBracket))\n\t{\n\t\tif (!bracketIndentVtk)\n\t\t\t++indentCount;\n\t\telse\n\t\t{\n\t\t\t// determine if a style VTK bracket is indented\n\t\t\tbool haveUnindentedBracket = false;\n\t\t\tfor (size_t i = 0; i < headerStack->size(); i++)\n\t\t\t{\n\t\t\t\tif (((*headerStack)[i] == &AS_NAMESPACE\n\t\t\t\t        || (*headerStack)[i] == &AS_CLASS\n\t\t\t\t        || (*headerStack)[i] == &AS_STRUCT)\n\t\t\t\t        && i + 1 < headerStack->size()\n\t\t\t\t        && (*headerStack)[i + 1] == &AS_OPEN_BRACKET)\n\t\t\t\t\ti++;\n\t\t\t\telse if (lineBeginsWithOpenBracket)\n\t\t\t\t{\n\t\t\t\t\t// don't double count the current bracket\n\t\t\t\t\tif (i + 1 < headerStack->size()\n\t\t\t\t\t        && (*headerStack)[i] == &AS_OPEN_BRACKET)\n\t\t\t\t\t\thaveUnindentedBracket = true;\n\t\t\t\t}\n\t\t\t\telse if ((*headerStack)[i] == &AS_OPEN_BRACKET)\n\t\t\t\t\thaveUnindentedBracket = true;\n\t\t\t}\t// end of for loop\n\t\t\tif (haveUnindentedBracket)\n\t\t\t\t++indentCount;\n\t\t}\n\t}\n}\n\n/**\n * Compute indentCount adjustment when in a series of else-if statements\n * and shouldBreakElseIfs is requested.\n * It increments by one for each 'else' in the tempStack.\n */\nint ASBeautifier::adjustIndentCountForBreakElseIfComments() const\n{\n\tassert(isElseHeaderIndent && !tempStacks->empty());\n\tint indentCountIncrement = 0;\n\tvector<const string*>* lastTempStack = tempStacks->back();\n\tif (lastTempStack != NULL)\n\t{\n\t\tfor (size_t i = 0; i < lastTempStack->size(); i++)\n\t\t{\n\t\t\tif (*lastTempStack->at(i) == AS_ELSE)\n\t\t\t\tindentCountIncrement++;\n\t\t}\n\t}\n\treturn indentCountIncrement;\n}\n\n/**\n * Extract a preprocessor statement without the #.\n * If a error occurs an empty string is returned.\n */\nstring ASBeautifier::extractPreprocessorStatement(const string &line) const\n{\n\tstring preproc;\n\tsize_t start = line.find_first_not_of(\"#/ \\t\");\n\tif (start == string::npos)\n\t\treturn preproc;\n\tsize_t end = line.find_first_of(\"/ \\t\", start);\n\tif (end == string::npos)\n\t\tend = line.length();\n\tpreproc = line.substr(start, end - start);\n\treturn preproc;\n}\n\n/**\n * Clear the variables used to align the Objective-C method definitions.\n */\nvoid ASBeautifier::clearObjCMethodDefinitionAlignment()\n{\n\tassert(isImmediatelyPostObjCMethodDefinition);\n\tspaceIndentCount = 0;\n\tspaceIndentObjCMethodDefinition = 0;\n\tcolonIndentObjCMethodDefinition = 0;\n\tisInObjCMethodDefinition = false;\n\tisImmediatelyPostObjCMethodDefinition = false;\n\tif (!inStatementIndentStack->empty())\n\t\tinStatementIndentStack->pop_back();\n}\n\n/**\n * Compute the spaceIndentCount necessary to align the current line colon\n * with the colon position in the argument.\n * If it cannot be aligned indentLength is returned and a new colon\n * position is calculated.\n */\nint ASBeautifier::computeObjCColonAlignment(string &line, int colonAlignPosition) const\n{\n\tint colonPosition = line.find(':');\n\tif (colonPosition < 0 || colonPosition > colonAlignPosition)\n\t\treturn indentLength;\n\treturn (colonAlignPosition - colonPosition);\n}\n\n/**\n * Parse the current line to update indentCount and spaceIndentCount.\n */\nvoid ASBeautifier::parseCurrentLine(const string &line)\n{\n\tbool isInLineComment = false;\n\tbool isInOperator = false;\n\tbool isSpecialChar = false;\n\tbool haveCaseIndent = false;\n\tbool haveAssignmentThisLine = false;\n\tbool closingBracketReached = false;\n\tbool previousLineProbation = (probationHeader != NULL);\n\tchar ch = ' ';\n\tint tabIncrementIn = 0;\n\n\tfor (size_t i = 0; i < line.length(); i++)\n\t{\n\t\tch = line[i];\n\n\t\tif (isInBeautifySQL)\n\t\t\tcontinue;\n\n\t\tif (isWhiteSpace(ch))\n\t\t{\n\t\t\tif (ch == '\\t')\n\t\t\t\ttabIncrementIn += convertTabToSpaces(i, tabIncrementIn);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// handle special characters (i.e. backslash+character such as \\n, \\t, ...)\n\n\t\tif (isInQuote && !isInVerbatimQuote)\n\t\t{\n\t\t\tif (isSpecialChar)\n\t\t\t{\n\t\t\t\tisSpecialChar = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (line.compare(i, 2, \"\\\\\\\\\") == 0)\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (ch == '\\\\')\n\t\t\t{\n\t\t\t\tif (peekNextChar(line, i) == ' ')   // is this '\\' at end of line\n\t\t\t\t\thaveLineContinuationChar = true;\n\t\t\t\telse\n\t\t\t\t\tisSpecialChar = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\telse if (isInDefine && ch == '\\\\')\n\t\t\tcontinue;\n\n\t\t// handle quotes (such as 'x' and \"Hello Dolly\")\n\t\tif (!(isInComment || isInLineComment) && (ch == '\"' || ch == '\\''))\n\t\t{\n\t\t\tif (!isInQuote)\n\t\t\t{\n\t\t\t\tquoteChar = ch;\n\t\t\t\tisInQuote = true;\n\t\t\t\tchar prevCh = i > 0 ? line[i - 1] : ' ';\n\t\t\t\tif (isCStyle() && prevCh == 'R')\n\t\t\t\t{\n\t\t\t\t\tint parenPos = line.find('(', i);\n\t\t\t\t\tif (parenPos != -1)\n\t\t\t\t\t{\n\t\t\t\t\t\tisInVerbatimQuote = true;\n\t\t\t\t\t\tverbatimDelimiter = line.substr(i + 1, parenPos - i - 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (isSharpStyle() && prevCh == '@')\n\t\t\t\t\tisInVerbatimQuote = true;\n\t\t\t\t// check for \"C\" following \"extern\"\n\t\t\t\telse if (g_preprocessorCppExternCBracket == 2 && line.compare(i, 3, \"\\\"C\\\"\") == 0)\n\t\t\t\t\t++g_preprocessorCppExternCBracket;\n\t\t\t}\n\t\t\telse if (isInVerbatimQuote && ch == '\"')\n\t\t\t{\n\t\t\t\tif (isCStyle())\n\t\t\t\t{\n\t\t\t\t\tstring delim = ')' + verbatimDelimiter;\n\t\t\t\t\tint delimStart = i - delim.length();\n\t\t\t\t\tif (delimStart > 0 && line.substr(delimStart, delim.length()) == delim)\n\t\t\t\t\t{\n\t\t\t\t\t\tisInQuote = false;\n\t\t\t\t\t\tisInVerbatimQuote = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (isSharpStyle())\n\t\t\t\t{\n\t\t\t\t\tif (peekNextChar(line, i) == '\"')           // check consecutive quotes\n\t\t\t\t\t\ti++;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tisInQuote = false;\n\t\t\t\t\t\tisInVerbatimQuote = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (quoteChar == ch)\n\t\t\t{\n\t\t\t\tisInQuote = false;\n\t\t\t\tisInStatement = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tif (isInQuote)\n\t\t\tcontinue;\n\n\t\t// handle comments\n\n\t\tif (!(isInComment || isInLineComment) && line.compare(i, 2, \"//\") == 0)\n\t\t{\n\t\t\t// if there is a 'case' statement after these comments unindent by 1\n\t\t\tif (isCaseHeaderCommentIndent)\n\t\t\t\t--indentCount;\n\t\t\t// isElseHeaderIndent is set by ASFormatter if shouldBreakElseIfs is requested\n\t\t\t// if there is an 'else' after these comments a tempStacks indent is required\n\t\t\tif (isElseHeaderIndent && lineOpensWithLineComment && !tempStacks->empty())\n\t\t\t\tindentCount += adjustIndentCountForBreakElseIfComments();\n\t\t\tisInLineComment = true;\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\telse if (!(isInComment || isInLineComment) && line.compare(i, 2, \"/*\") == 0)\n\t\t{\n\t\t\t// if there is a 'case' statement after these comments unindent by 1\n\t\t\tif (isCaseHeaderCommentIndent && lineOpensWithComment)\n\t\t\t\t--indentCount;\n\t\t\t// isElseHeaderIndent is set by ASFormatter if shouldBreakElseIfs is requested\n\t\t\t// if there is an 'else' after these comments a tempStacks indent is required\n\t\t\tif (isElseHeaderIndent && lineOpensWithComment && !tempStacks->empty())\n\t\t\t\tindentCount += adjustIndentCountForBreakElseIfComments();\n\t\t\tisInComment = true;\n\t\t\ti++;\n\t\t\tif (!lineOpensWithComment)\t\t\t\t// does line start with comment?\n\t\t\t\tblockCommentNoIndent = true;        // if no, cannot indent continuation lines\n\t\t\tcontinue;\n\t\t}\n\t\telse if ((isInComment || isInLineComment) && line.compare(i, 2, \"*/\") == 0)\n\t\t{\n\t\t\tsize_t firstText = line.find_first_not_of(\" \\t\");\n\t\t\t// if there is a 'case' statement after these comments unindent by 1\n\t\t\t// only if the ending comment is the first entry on the line\n\t\t\tif (isCaseHeaderCommentIndent && firstText == i)\n\t\t\t\t--indentCount;\n\t\t\t// if this comment close starts the line, must check for else-if indent\n\t\t\t// isElseHeaderIndent is set by ASFormatter if shouldBreakElseIfs is requested\n\t\t\t// if there is an 'else' after these comments a tempStacks indent is required\n\t\t\tif (firstText == i)\n\t\t\t{\n\t\t\t\tif (isElseHeaderIndent && !lineOpensWithComment && !tempStacks->empty())\n\t\t\t\t\tindentCount += adjustIndentCountForBreakElseIfComments();\n\t\t\t}\n\t\t\tisInComment = false;\n\t\t\ti++;\n\t\t\tblockCommentNoIndent = false;           // ok to indent next comment\n\t\t\tcontinue;\n\t\t}\n\t\t// treat indented preprocessor lines as a line comment\n\t\telse if (line[0] == '#' && isIndentedPreprocessor(line, i))\n\t\t{\n\t\t\tisInLineComment = true;\n\t\t}\n\n\t\tif (isInLineComment)\n\t\t{\n\t\t\t// bypass rest of the comment up to the comment end\n\t\t\twhile (i + 1 < line.length())\n\t\t\t\ti++;\n\n\t\t\tcontinue;\n\t\t}\n\t\tif (isInComment)\n\t\t{\n\t\t\t// if there is a 'case' statement after these comments unindent by 1\n\t\t\tif (!lineOpensWithComment && isCaseHeaderCommentIndent)\n\t\t\t\t--indentCount;\n\t\t\t// isElseHeaderIndent is set by ASFormatter if shouldBreakElseIfs is requested\n\t\t\t// if there is an 'else' after these comments a tempStacks indent is required\n\t\t\tif (!lineOpensWithComment && isElseHeaderIndent && !tempStacks->empty())\n\t\t\t\tindentCount += adjustIndentCountForBreakElseIfComments();\n\t\t\t// bypass rest of the comment up to the comment end\n\t\t\twhile (i + 1 < line.length()\n\t\t\t        && line.compare(i + 1, 2, \"*/\") != 0)\n\t\t\t\ti++;\n\n\t\t\tcontinue;\n\t\t}\n\n\t\t// if we have reached this far then we are NOT in a comment or string of special character...\n\n\t\tif (probationHeader != NULL)\n\t\t{\n\t\t\tif ((probationHeader == &AS_STATIC && ch == '{')\n\t\t\t        || (probationHeader == &AS_SYNCHRONIZED && ch == '('))\n\t\t\t{\n\t\t\t\t// insert the probation header as a new header\n\t\t\t\tisInHeader = true;\n\t\t\t\theaderStack->push_back(probationHeader);\n\n\t\t\t\t// handle the specific probation header\n\t\t\t\tisInConditional = (probationHeader == &AS_SYNCHRONIZED);\n\n\t\t\t\tisInStatement = false;\n\t\t\t\t// if the probation comes from the previous line, then indent by 1 tab count.\n\t\t\t\tif (previousLineProbation\n\t\t\t\t        && ch == '{'\n\t\t\t\t        && !(blockIndent && probationHeader == &AS_STATIC))\n\t\t\t\t{\n\t\t\t\t\t++indentCount;\n\t\t\t\t\tpreviousLineProbationTab = true;\n\t\t\t\t}\n\t\t\t\tpreviousLineProbation = false;\n\t\t\t}\n\n\t\t\t// dismiss the probation header\n\t\t\tprobationHeader = NULL;\n\t\t}\n\n\t\tprevNonSpaceCh = currentNonSpaceCh;\n\t\tcurrentNonSpaceCh = ch;\n\t\tif (!isLegalNameChar(ch) && ch != ',' && ch != ';')\n\t\t{\n\t\t\tprevNonLegalCh = currentNonLegalCh;\n\t\t\tcurrentNonLegalCh = ch;\n\t\t}\n\n\t\tif (isInHeader)\n\t\t{\n\t\t\tisInHeader = false;\n\t\t\tcurrentHeader = headerStack->back();\n\t\t}\n\t\telse\n\t\t\tcurrentHeader = NULL;\n\n\t\tif (isCStyle() && isInTemplate\n\t\t        && (ch == '<' || ch == '>')\n\t\t        && !(line.length() > i + 1 && line.compare(i, 2, \">=\") == 0))\n\t\t{\n\t\t\tif (ch == '<')\n\t\t\t{\n\t\t\t\t++templateDepth;\n\t\t\t\tinStatementIndentStackSizeStack->push_back(inStatementIndentStack->size());\n\t\t\t\tregisterInStatementIndent(line, i, spaceIndentCount, tabIncrementIn, 0, true);\n\t\t\t}\n\t\t\telse if (ch == '>')\n\t\t\t{\n\t\t\t\tpopLastInStatementIndent();\n\t\t\t\tif (--templateDepth <= 0)\n\t\t\t\t{\n\t\t\t\t\tch = ';';\n\t\t\t\t\tisInTemplate = false;\n\t\t\t\t\ttemplateDepth = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// handle parentheses\n\t\tif (ch == '(' || ch == '[' || ch == ')' || ch == ']')\n\t\t{\n\t\t\tif (ch == '(' || ch == '[')\n\t\t\t{\n\t\t\t\tisInOperator = false;\n\t\t\t\t// if have a struct header, this is a declaration not a definition\n\t\t\t\tif (ch == '('\n\t\t\t\t        && !headerStack->empty()\n\t\t\t\t        && headerStack->back() == &AS_STRUCT)\n\t\t\t\t{\n\t\t\t\t\theaderStack->pop_back();\n\t\t\t\t\tisInClassHeader = false;\n\t\t\t\t\tif (line.find(AS_STRUCT, 0) > i)\t// if not on this line\n\t\t\t\t\t\tindentCount -= classInitializerIndents;\n\t\t\t\t\tif (indentCount < 0)\n\t\t\t\t\t\tindentCount = 0;\n\t\t\t\t}\n\n\t\t\t\tif (parenDepth == 0)\n\t\t\t\t{\n\t\t\t\t\tparenStatementStack->push_back(isInStatement);\n\t\t\t\t\tisInStatement = true;\n\t\t\t\t}\n\t\t\t\tparenDepth++;\n\t\t\t\tif (ch == '[')\n\t\t\t\t\t++squareBracketCount;\n\n\t\t\t\tinStatementIndentStackSizeStack->push_back(inStatementIndentStack->size());\n\n\t\t\t\tif (currentHeader != NULL)\n\t\t\t\t\tregisterInStatementIndent(line, i, spaceIndentCount, tabIncrementIn, minConditionalIndent/*indentLength*2*/, true);\n\t\t\t\telse\n\t\t\t\t\tregisterInStatementIndent(line, i, spaceIndentCount, tabIncrementIn, 0, true);\n\t\t\t}\n\t\t\telse if (ch == ')' || ch == ']')\n\t\t\t{\n\t\t\t\tif (ch == ']')\n\t\t\t\t\t--squareBracketCount;\n\t\t\t\tif (squareBracketCount < 0)\n\t\t\t\t\tsquareBracketCount = 0;\n\t\t\t\tfoundPreCommandHeader = false;\n\t\t\t\tparenDepth--;\n\t\t\t\tif (parenDepth == 0)\n\t\t\t\t{\n\t\t\t\t\tif (!parenStatementStack->empty())      // in case of unmatched closing parens\n\t\t\t\t\t{\n\t\t\t\t\t\tisInStatement = parenStatementStack->back();\n\t\t\t\t\t\tparenStatementStack->pop_back();\n\t\t\t\t\t}\n\t\t\t\t\tisInAsm = false;\n\t\t\t\t\tisInConditional = false;\n\t\t\t\t}\n\n\t\t\t\tif (!inStatementIndentStackSizeStack->empty())\n\t\t\t\t{\n\t\t\t\t\tpopLastInStatementIndent();\n\n\t\t\t\t\tif (!parenIndentStack->empty())\n\t\t\t\t\t{\n\t\t\t\t\t\tint poppedIndent = parenIndentStack->back();\n\t\t\t\t\t\tparenIndentStack->pop_back();\n\n\t\t\t\t\t\tif (i == 0)\n\t\t\t\t\t\t\tspaceIndentCount = poppedIndent;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (ch == '{')\n\t\t{\n\t\t\t// first, check if '{' is a block-opener or a static-array opener\n\t\t\tbool isBlockOpener = ((prevNonSpaceCh == '{' && bracketBlockStateStack->back())\n\t\t\t                      || prevNonSpaceCh == '}'\n\t\t\t                      || prevNonSpaceCh == ')'\n\t\t\t                      || prevNonSpaceCh == ';'\n\t\t\t                      || peekNextChar(line, i) == '{'\n\t\t\t                      || foundPreCommandHeader\n\t\t\t                      || foundPreCommandMacro\n\t\t\t                      || isInClassHeader\n\t\t\t                      || (isInClassInitializer && !isLegalNameChar(prevNonSpaceCh))\n\t\t\t                      || isNonInStatementArray\n\t\t\t                      || isInObjCMethodDefinition\n\t\t\t                      || isInObjCInterface\n\t\t\t                      || isSharpAccessor\n\t\t\t                      || isSharpDelegate\n\t\t\t                      || isInExternC\n\t\t\t                      || isInAsmBlock\n\t\t\t                      || getNextWord(line, i) == AS_NEW\n\t\t\t                      || (isInDefine\n\t\t\t                          && (prevNonSpaceCh == '('\n\t\t\t                              || isLegalNameChar(prevNonSpaceCh))));\n\n\t\t\tif (isInObjCMethodDefinition)\n\t\t\t\tisImmediatelyPostObjCMethodDefinition = true;\n\n\t\t\tif (!isBlockOpener && !isInStatement && !isInClassInitializer && !isInEnum)\n\t\t\t{\n\t\t\t\tif (headerStack->empty())\n\t\t\t\t\tisBlockOpener = true;\n\t\t\t\telse if (headerStack->back() == &AS_NAMESPACE\n\t\t\t\t         || headerStack->back() == &AS_CLASS\n\t\t\t\t         || headerStack->back() == &AS_INTERFACE\n\t\t\t\t         || headerStack->back() == &AS_STRUCT\n\t\t\t\t         || headerStack->back() == &AS_UNION)\n\t\t\t\t\tisBlockOpener = true;\n\t\t\t}\n\n\t\t\tif (!isBlockOpener && currentHeader != NULL)\n\t\t\t{\n\t\t\t\tfor (size_t n = 0; n < nonParenHeaders->size(); n++)\n\t\t\t\t\tif (currentHeader == (*nonParenHeaders)[n])\n\t\t\t\t\t{\n\t\t\t\t\t\tisBlockOpener = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t}\n\n\t\t\tbracketBlockStateStack->push_back(isBlockOpener);\n\n\t\t\tif (!isBlockOpener)\n\t\t\t{\n\t\t\t\tinStatementIndentStackSizeStack->push_back(inStatementIndentStack->size());\n\t\t\t\tregisterInStatementIndent(line, i, spaceIndentCount, tabIncrementIn, 0, true);\n\t\t\t\tparenDepth++;\n\t\t\t\tif (i == 0)\n\t\t\t\t\tshouldIndentBrackettedLine = false;\n\t\t\t\tisInEnumTypeID = false;\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// this bracket is a block opener...\n\n\t\t\t++lineOpeningBlocksNum;\n\n\t\t\tif (isInClassInitializer || isInEnumTypeID)\n\t\t\t{\n\t\t\t\t// decrease tab count if bracket is broken\n\t\t\t\tif (lineBeginsWithOpenBracket)\n\t\t\t\t{\n\t\t\t\t\tindentCount -= classInitializerIndents;\n\t\t\t\t\t// decrease one more if an empty class\n\t\t\t\t\tif (!headerStack->empty()\n\t\t\t\t\t        && (*headerStack).back() == &AS_CLASS)\n\t\t\t\t\t{\n\t\t\t\t\t\tint nextChar = getNextProgramCharDistance(line, i);\n\t\t\t\t\t\tif ((int) line.length() > nextChar && line[nextChar] == '}')\n\t\t\t\t\t\t\t--indentCount;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isInObjCInterface)\n\t\t\t{\n\t\t\t\tisInObjCInterface = false;\n\t\t\t\tif (lineBeginsWithOpenBracket)\n\t\t\t\t\t--indentCount;\n\t\t\t}\n\n\t\t\tif (bracketIndent && !namespaceIndent && !headerStack->empty()\n\t\t\t        && (*headerStack).back() == &AS_NAMESPACE)\n\t\t\t{\n\t\t\t\tshouldIndentBrackettedLine = false;\n\t\t\t\t--indentCount;\n\t\t\t}\n\n\t\t\t// an indentable struct is treated like a class in the header stack\n\t\t\tif (!headerStack->empty()\n\t\t\t        && (*headerStack).back() == &AS_STRUCT\n\t\t\t        && isInIndentableStruct)\n\t\t\t\t(*headerStack).back() = &AS_CLASS;\n\n\t\t\tblockParenDepthStack->push_back(parenDepth);\n\t\t\tblockStatementStack->push_back(isInStatement);\n\n\t\t\tif (!inStatementIndentStack->empty())\n\t\t\t{\n\t\t\t\t// completely purge the inStatementIndentStack\n\t\t\t\twhile (!inStatementIndentStack->empty())\n\t\t\t\t\tpopLastInStatementIndent();\n\t\t\t\tif (isInClassInitializer || isInClassHeaderTab)\n\t\t\t\t{\n\t\t\t\t\tif (lineBeginsWithOpenBracket || lineBeginsWithComma)\n\t\t\t\t\t\tspaceIndentCount = 0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tspaceIndentCount = 0;\n\t\t\t}\n\n\t\t\tblockTabCount += (isInStatement ? 1 : 0);\n\t\t\tif (g_preprocessorCppExternCBracket == 3)\n\t\t\t\t++g_preprocessorCppExternCBracket;\n\t\t\tparenDepth = 0;\n\t\t\tisInClassHeader = false;\n\t\t\tisInClassHeaderTab = false;\n\t\t\tisInClassInitializer = false;\n\t\t\tisInEnumTypeID = false;\n\t\t\tisInStatement = false;\n\t\t\tisInQuestion = false;\n\t\t\tisInLet = false;\n\t\t\tfoundPreCommandHeader = false;\n\t\t\tfoundPreCommandMacro = false;\n\t\t\tisInExternC = false;\n\n\t\t\ttempStacks->push_back(new vector<const string*>);\n\t\t\theaderStack->push_back(&AS_OPEN_BRACKET);\n\t\t\tlastLineHeader = &AS_OPEN_BRACKET;\n\n\t\t\tcontinue;\n\t\t}\t// end '{'\n\n\t\t//check if a header has been reached\n\t\tbool isPotentialHeader = isCharPotentialHeader(line, i);\n\n\t\tif (isPotentialHeader && !squareBracketCount)\n\t\t{\n\t\t\tconst string* newHeader = findHeader(line, i, headers);\n\n\t\t\t// Qt headers may be variables in C++\n\t\t\tif (newHeader == &AS_FOREVER || newHeader == &AS_FOREACH)\n\t\t\t{\n\t\t\t\tif (line.find_first_of(\"=;\", i) != string::npos)\n\t\t\t\t\tnewHeader = NULL;\n\t\t\t}\n\n\t\t\tif (newHeader != NULL)\n\t\t\t{\n\t\t\t\t// if we reached here, then this is a header...\n\t\t\t\tbool isIndentableHeader = true;\n\n\t\t\t\tisInHeader = true;\n\n\t\t\t\tvector<const string*>* lastTempStack;\n\t\t\t\tif (tempStacks->empty())\n\t\t\t\t\tlastTempStack = NULL;\n\t\t\t\telse\n\t\t\t\t\tlastTempStack = tempStacks->back();\n\n\t\t\t\t// if a new block is opened, push a new stack into tempStacks to hold the\n\t\t\t\t// future list of headers in the new block.\n\n\t\t\t\t// take care of the special case: 'else if (...)'\n\t\t\t\tif (newHeader == &AS_IF && lastLineHeader == &AS_ELSE)\n\t\t\t\t{\n\t\t\t\t\theaderStack->pop_back();\n\t\t\t\t}\n\n\t\t\t\t// take care of 'else'\n\t\t\t\telse if (newHeader == &AS_ELSE)\n\t\t\t\t{\n\t\t\t\t\tif (lastTempStack != NULL)\n\t\t\t\t\t{\n\t\t\t\t\t\tint indexOfIf = indexOf(*lastTempStack, &AS_IF);\n\t\t\t\t\t\tif (indexOfIf != -1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// recreate the header list in headerStack up to the previous 'if'\n\t\t\t\t\t\t\t// from the temporary snapshot stored in lastTempStack.\n\t\t\t\t\t\t\tint restackSize = lastTempStack->size() - indexOfIf - 1;\n\t\t\t\t\t\t\tfor (int r = 0; r < restackSize; r++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\theaderStack->push_back(lastTempStack->back());\n\t\t\t\t\t\t\t\tlastTempStack->pop_back();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!closingBracketReached)\n\t\t\t\t\t\t\t\tindentCount += restackSize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * If the above if is not true, i.e. no 'if' before the 'else',\n\t\t\t\t\t\t * then nothing beautiful will come out of this...\n\t\t\t\t\t\t * I should think about inserting an Exception here to notify the caller of this...\n\t\t\t\t\t\t */\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// check if 'while' closes a previous 'do'\n\t\t\t\telse if (newHeader == &AS_WHILE)\n\t\t\t\t{\n\t\t\t\t\tif (lastTempStack != NULL)\n\t\t\t\t\t{\n\t\t\t\t\t\tint indexOfDo = indexOf(*lastTempStack, &AS_DO);\n\t\t\t\t\t\tif (indexOfDo != -1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// recreate the header list in headerStack up to the previous 'do'\n\t\t\t\t\t\t\t// from the temporary snapshot stored in lastTempStack.\n\t\t\t\t\t\t\tint restackSize = lastTempStack->size() - indexOfDo - 1;\n\t\t\t\t\t\t\tfor (int r = 0; r < restackSize; r++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\theaderStack->push_back(lastTempStack->back());\n\t\t\t\t\t\t\t\tlastTempStack->pop_back();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!closingBracketReached)\n\t\t\t\t\t\t\t\tindentCount += restackSize;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// check if 'catch' closes a previous 'try' or 'catch'\n\t\t\t\telse if (newHeader == &AS_CATCH || newHeader == &AS_FINALLY)\n\t\t\t\t{\n\t\t\t\t\tif (lastTempStack != NULL)\n\t\t\t\t\t{\n\t\t\t\t\t\tint indexOfTry = indexOf(*lastTempStack, &AS_TRY);\n\t\t\t\t\t\tif (indexOfTry == -1)\n\t\t\t\t\t\t\tindexOfTry = indexOf(*lastTempStack, &AS_CATCH);\n\t\t\t\t\t\tif (indexOfTry != -1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// recreate the header list in headerStack up to the previous 'try'\n\t\t\t\t\t\t\t// from the temporary snapshot stored in lastTempStack.\n\t\t\t\t\t\t\tint restackSize = lastTempStack->size() - indexOfTry - 1;\n\t\t\t\t\t\t\tfor (int r = 0; r < restackSize; r++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\theaderStack->push_back(lastTempStack->back());\n\t\t\t\t\t\t\t\tlastTempStack->pop_back();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (!closingBracketReached)\n\t\t\t\t\t\t\t\tindentCount += restackSize;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (newHeader == &AS_CASE)\n\t\t\t\t{\n\t\t\t\t\tisInCase = true;\n\t\t\t\t\tif (!haveCaseIndent)\n\t\t\t\t\t{\n\t\t\t\t\t\thaveCaseIndent = true;\n\t\t\t\t\t\tif (!lineBeginsWithOpenBracket)\n\t\t\t\t\t\t\t--indentCount;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (newHeader == &AS_DEFAULT)\n\t\t\t\t{\n\t\t\t\t\tisInCase = true;\n\t\t\t\t\t--indentCount;\n\t\t\t\t}\n\t\t\t\telse if (newHeader == &AS_STATIC\n\t\t\t\t         || newHeader == &AS_SYNCHRONIZED)\n\t\t\t\t{\n\t\t\t\t\tif (!headerStack->empty()\n\t\t\t\t\t        && (headerStack->back() == &AS_STATIC\n\t\t\t\t\t            || headerStack->back() == &AS_SYNCHRONIZED))\n\t\t\t\t\t{\n\t\t\t\t\t\tisIndentableHeader = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tisIndentableHeader = false;\n\t\t\t\t\t\tprobationHeader = newHeader;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (newHeader == &AS_TEMPLATE)\n\t\t\t\t{\n\t\t\t\t\tisInTemplate = true;\n\t\t\t\t\tisIndentableHeader = false;\n\t\t\t\t}\n\n\t\t\t\tif (isIndentableHeader)\n\t\t\t\t{\n\t\t\t\t\theaderStack->push_back(newHeader);\n\t\t\t\t\tisInStatement = false;\n\t\t\t\t\tif (indexOf(*nonParenHeaders, newHeader) == -1)\n\t\t\t\t\t{\n\t\t\t\t\t\tisInConditional = true;\n\t\t\t\t\t}\n\t\t\t\t\tlastLineHeader = newHeader;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tisInHeader = false;\n\n\t\t\t\ti += newHeader->length() - 1;\n\n\t\t\t\tcontinue;\n\t\t\t}  // newHeader != NULL\n\n\t\t\tif (findHeader(line, i, preCommandHeaders))\n\t\t\t\tfoundPreCommandHeader = true;\n\n\t\t\t// Objective-C NSException macros are preCommandHeaders\n\t\t\tif (isCStyle() && findKeyword(line, i, AS_NS_DURING))\n\t\t\t\tfoundPreCommandMacro = true;\n\t\t\tif (isCStyle() && findKeyword(line, i, AS_NS_HANDLER))\n\t\t\t\tfoundPreCommandMacro = true;\n\n\t\t\tif (parenDepth == 0 && findKeyword(line, i, AS_ENUM))\n\t\t\t\tisInEnum = true;\n\n\t\t\tif (isSharpStyle() && findKeyword(line, i, AS_LET))\n\t\t\t\tisInLet = true;\n\n\t\t}   // isPotentialHeader\n\n\t\tif (ch == '?')\n\t\t\tisInQuestion = true;\n\n\t\t// special handling of colons\n\t\tif (ch == ':')\n\t\t{\n\t\t\tif (line.length() > i + 1 && line[i + 1] == ':') // look for ::\n\t\t\t{\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if (isInQuestion)\n\t\t\t{\n\t\t\t\t// do nothing special\n\t\t\t}\n\t\t\telse if (parenDepth > 0)\n\t\t\t{\n\t\t\t\t// found a 'for' loop or an objective-C statement\n\t\t\t\t// so do nothing special\n\t\t\t}\n\t\t\telse if (isInEnum)\n\t\t\t{\n\t\t\t\t// found an enum with a base-type\n\t\t\t\tisInEnumTypeID = true;\n\t\t\t\tif (i == 0)\n\t\t\t\t\tindentCount += classInitializerIndents;\n\t\t\t}\n\t\t\telse if (isCStyle()\n\t\t\t         && !isInCase\n\t\t\t         && (prevNonSpaceCh == ')' || foundPreCommandHeader))\n\t\t\t{\n\t\t\t\t// found a 'class' c'tor initializer\n\t\t\t\tisInClassInitializer = true;\n\t\t\t\tregisterInStatementIndentColon(line, i, tabIncrementIn);\n\t\t\t\tif (i == 0)\n\t\t\t\t\tindentCount += classInitializerIndents;\n\t\t\t}\n\t\t\telse if (isInClassHeader || isInObjCInterface)\n\t\t\t{\n\t\t\t\t// is in a 'class A : public B' definition\n\t\t\t\tisInClassHeaderTab = true;\n\t\t\t\tregisterInStatementIndentColon(line, i, tabIncrementIn);\n\t\t\t}\n\t\t\telse if (isInAsm || isInAsmOneLine || isInAsmBlock)\n\t\t\t{\n\t\t\t\t// do nothing special\n\t\t\t}\n\t\t\telse if (isDigit(peekNextChar(line, i)))\n\t\t\t{\n\t\t\t\t// found a bit field\n\t\t\t\t// so do nothing special\n\t\t\t}\n\t\t\telse if (isCStyle() && isInClass && prevNonSpaceCh != ')')\n\t\t\t{\n\t\t\t\t// found a 'private:' or 'public:' inside a class definition\n\t\t\t\t--indentCount;\n\t\t\t\tif (modifierIndent)\n\t\t\t\t\tspaceIndentCount += (indentLength / 2);\n\t\t\t}\n\t\t\telse if (isCStyle() && !isInClass\n\t\t\t         && headerStack->size() >= 2\n\t\t\t         && (*headerStack)[headerStack->size() - 2] == &AS_CLASS\n\t\t\t         && (*headerStack)[headerStack->size() - 1] == &AS_OPEN_BRACKET)\n\t\t\t{\n\t\t\t\t// found a 'private:' or 'public:' inside a class definition\n\t\t\t\t// and on the same line as the class opening bracket\n\t\t\t\t// do nothing\n\t\t\t}\n\t\t\telse if (isJavaStyle() && lastLineHeader == &AS_FOR)\n\t\t\t{\n\t\t\t\t// found a java for-each statement\n\t\t\t\t// so do nothing special\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcurrentNonSpaceCh = ';'; // so that brackets after the ':' will appear as block-openers\n\t\t\t\tchar peekedChar = peekNextChar(line, i);\n\t\t\t\tif (isInCase)\n\t\t\t\t{\n\t\t\t\t\tisInCase = false;\n\t\t\t\t\tch = ';'; // from here on, treat char as ';'\n\t\t\t\t}\n\t\t\t\telse if (isCStyle() || (isSharpStyle() && peekedChar == ';'))\n\t\t\t\t{\n\t\t\t\t\t// is in a label (e.g. 'label1:')\n\t\t\t\t\tif (labelIndent)\n\t\t\t\t\t\t--indentCount; // unindent label by one indent\n\t\t\t\t\telse if (!lineBeginsWithOpenBracket)\n\t\t\t\t\t\tindentCount = 0; // completely flush indent to left\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ((ch == ';' || (parenDepth > 0 && ch == ',')) && !inStatementIndentStackSizeStack->empty())\n\t\t\twhile ((int) inStatementIndentStackSizeStack->back() + (parenDepth > 0 ? 1 : 0)\n\t\t\t        < (int) inStatementIndentStack->size())\n\t\t\t\tinStatementIndentStack->pop_back();\n\n\t\telse if (ch == ',' && isInEnum && isNonInStatementArray && !inStatementIndentStack->empty())\n\t\t\tinStatementIndentStack->pop_back();\n\n\t\t// handle commas\n\t\t// previous \"isInStatement\" will be from an assignment operator or class initializer\n\t\tif (ch == ',' && parenDepth == 0 && !isInStatement && !isNonInStatementArray)\n\t\t{\n\t\t\t// is comma at end of line\n\t\t\tsize_t nextChar = line.find_first_not_of(\" \\t\", i + 1);\n\t\t\tif (nextChar != string::npos)\n\t\t\t{\n\t\t\t\tif (line.compare(nextChar, 2, \"//\") == 0\n\t\t\t\t        || line.compare(nextChar, 2, \"/*\") == 0)\n\t\t\t\t\tnextChar = string::npos;\n\t\t\t}\n\t\t\t// register indent\n\t\t\tif (nextChar == string::npos)\n\t\t\t{\n\t\t\t\t// register indent at previous word\n\t\t\t\tif (isJavaStyle() && isInClassHeader)\n\t\t\t\t{\n\t\t\t\t\t// do nothing for now\n\t\t\t\t}\n\t\t\t\t// register indent at second word on the line\n\t\t\t\telse if (!isInTemplate && !isInClassHeaderTab && !isInClassInitializer)\n\t\t\t\t{\n\t\t\t\t\tint prevWord = getInStatementIndentComma(line, i);\n\t\t\t\t\tint inStatementIndent = prevWord + spaceIndentCount + tabIncrementIn;\n\t\t\t\t\tinStatementIndentStack->push_back(inStatementIndent);\n\t\t\t\t\tisInStatement = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// handle comma first initializers\n\t\tif (ch == ',' && parenDepth == 0 && lineBeginsWithComma\n\t\t        && (isInClassInitializer || isInClassHeaderTab))\n\t\t\tspaceIndentCount = 0;\n\n\t\t// handle ends of statements\n\t\tif ((ch == ';' && parenDepth == 0) || ch == '}')\n\t\t{\n\t\t\tif (ch == '}')\n\t\t\t{\n\t\t\t\t// first check if this '}' closes a previous block, or a static array...\n\t\t\t\tif (bracketBlockStateStack->size() > 1)\n\t\t\t\t{\n\t\t\t\t\tbool bracketBlockState = bracketBlockStateStack->back();\n\t\t\t\t\tbracketBlockStateStack->pop_back();\n\t\t\t\t\tif (!bracketBlockState)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!inStatementIndentStackSizeStack->empty())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// this bracket is a static array\n\t\t\t\t\t\t\tpopLastInStatementIndent();\n\t\t\t\t\t\t\tparenDepth--;\n\t\t\t\t\t\t\tif (i == 0)\n\t\t\t\t\t\t\t\tshouldIndentBrackettedLine = false;\n\n\t\t\t\t\t\t\tif (!parenIndentStack->empty())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tint poppedIndent = parenIndentStack->back();\n\t\t\t\t\t\t\t\tparenIndentStack->pop_back();\n\t\t\t\t\t\t\t\tif (i == 0)\n\t\t\t\t\t\t\t\t\tspaceIndentCount = poppedIndent;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// this bracket is block closer...\n\n\t\t\t\t++lineClosingBlocksNum;\n\n\t\t\t\tif (!inStatementIndentStackSizeStack->empty())\n\t\t\t\t\tpopLastInStatementIndent();\n\n\t\t\t\tif (!blockParenDepthStack->empty())\n\t\t\t\t{\n\t\t\t\t\tparenDepth = blockParenDepthStack->back();\n\t\t\t\t\tblockParenDepthStack->pop_back();\n\t\t\t\t\tisInStatement = blockStatementStack->back();\n\t\t\t\t\tblockStatementStack->pop_back();\n\n\t\t\t\t\tif (isInStatement)\n\t\t\t\t\t\tblockTabCount--;\n\t\t\t\t}\n\n\t\t\t\tclosingBracketReached = true;\n\t\t\t\tif (i == 0)\n\t\t\t\t\tspaceIndentCount = 0;\n\t\t\t\tisInAsmBlock = false;\n\t\t\t\tisInAsm = isInAsmOneLine = isInQuote = false;\t// close these just in case\n\n\t\t\t\tint headerPlace = indexOf(*headerStack, &AS_OPEN_BRACKET);\n\t\t\t\tif (headerPlace != -1)\n\t\t\t\t{\n\t\t\t\t\tconst string* popped = headerStack->back();\n\t\t\t\t\twhile (popped != &AS_OPEN_BRACKET)\n\t\t\t\t\t{\n\t\t\t\t\t\theaderStack->pop_back();\n\t\t\t\t\t\tpopped = headerStack->back();\n\t\t\t\t\t}\n\t\t\t\t\theaderStack->pop_back();\n\n\t\t\t\t\tif (headerStack->empty())\n\t\t\t\t\t\tg_preprocessorCppExternCBracket = 0;\n\n\t\t\t\t\t// do not indent namespace bracket unless namespaces are indented\n\t\t\t\t\tif (!namespaceIndent && !headerStack->empty()\n\t\t\t\t\t        && (*headerStack).back() == &AS_NAMESPACE\n\t\t\t\t\t        && i == 0)\t\t// must be the first bracket on the line\n\t\t\t\t\t\tshouldIndentBrackettedLine = false;\n\n\t\t\t\t\tif (!tempStacks->empty())\n\t\t\t\t\t{\n\t\t\t\t\t\tvector<const string*>* temp = tempStacks->back();\n\t\t\t\t\t\ttempStacks->pop_back();\n\t\t\t\t\t\tdelete temp;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tch = ' '; // needed due to cases such as '}else{', so that headers ('else' in this case) will be identified...\n\t\t\t}\t// ch == '}'\n\n\t\t\t/*\n\t\t\t * Create a temporary snapshot of the current block's header-list in the\n\t\t\t * uppermost inner stack in tempStacks, and clear the headerStack up to\n\t\t\t * the beginning of the block.\n\t\t\t * Thus, the next future statement will think it comes one indent past\n\t\t\t * the block's '{' unless it specifically checks for a companion-header\n\t\t\t * (such as a previous 'if' for an 'else' header) within the tempStacks,\n\t\t\t * and recreates the temporary snapshot by manipulating the tempStacks.\n\t\t\t */\n\t\t\tif (!tempStacks->back()->empty())\n\t\t\t\twhile (!tempStacks->back()->empty())\n\t\t\t\t\ttempStacks->back()->pop_back();\n\t\t\twhile (!headerStack->empty() && headerStack->back() != &AS_OPEN_BRACKET)\n\t\t\t{\n\t\t\t\ttempStacks->back()->push_back(headerStack->back());\n\t\t\t\theaderStack->pop_back();\n\t\t\t}\n\n\t\t\tif (parenDepth == 0 && ch == ';')\n\t\t\t\tisInStatement = false;\n\t\t\tif (isInObjCMethodDefinition)\n\t\t\t\tisImmediatelyPostObjCMethodDefinition = true;\n\n\t\t\tpreviousLastLineHeader = NULL;\n\t\t\tisInClassHeader = false;\t\t// for 'friend' class\n\t\t\tisInEnum = false;\n\t\t\tisInQuestion = false;\n\t\t\tisInObjCInterface = false;\n\t\t\tfoundPreCommandHeader = false;\n\t\t\tfoundPreCommandMacro = false;\n\t\t\tsquareBracketCount = 0;\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isPotentialHeader)\n\t\t{\n\t\t\t// check for preBlockStatements in C/C++ ONLY if not within parentheses\n\t\t\t// (otherwise 'struct XXX' statements would be wrongly interpreted...)\n\t\t\tif (!isInTemplate && !(isCStyle() && parenDepth > 0))\n\t\t\t{\n\t\t\t\tconst string* newHeader = findHeader(line, i, preBlockStatements);\n\t\t\t\tif (newHeader != NULL\n\t\t\t\t        && !(isCStyle() && newHeader == &AS_CLASS && isInEnum))\t// is not 'enum class'\n\t\t\t\t{\n\t\t\t\t\tif (!isSharpStyle())\n\t\t\t\t\t\theaderStack->push_back(newHeader);\n\t\t\t\t\t// do not need 'where' in the headerStack\n\t\t\t\t\t// do not need second 'class' statement in a row\n\t\t\t\t\telse if (!(newHeader == &AS_WHERE\n\t\t\t\t\t           || (newHeader == &AS_CLASS\n\t\t\t\t\t               && !headerStack->empty()\n\t\t\t\t\t               && headerStack->back() == &AS_CLASS)))\n\t\t\t\t\t\theaderStack->push_back(newHeader);\n\n\t\t\t\t\tif (!headerStack->empty())\n\t\t\t\t\t{\n\t\t\t\t\t\tif ((*headerStack).back() == &AS_CLASS\n\t\t\t\t\t\t        || (*headerStack).back() == &AS_STRUCT\n\t\t\t\t\t\t        || (*headerStack).back() == &AS_INTERFACE)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tisInClassHeader = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if ((*headerStack).back() == &AS_NAMESPACE)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// remove inStatementIndent from namespace\n\t\t\t\t\t\t\tif (!inStatementIndentStack->empty())\n\t\t\t\t\t\t\t\tinStatementIndentStack->pop_back();\n\t\t\t\t\t\t\tisInStatement = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ti += newHeader->length() - 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst string* foundIndentableHeader = findHeader(line, i, indentableHeaders);\n\n\t\t\tif (foundIndentableHeader != NULL)\n\t\t\t{\n\t\t\t\t// must bypass the header before registering the in statement\n\t\t\t\ti += foundIndentableHeader->length() - 1;\n\t\t\t\tif (!isInOperator && !isInTemplate && !isNonInStatementArray)\n\t\t\t\t{\n\t\t\t\t\tregisterInStatementIndent(line, i, spaceIndentCount, tabIncrementIn, 0, false);\n\t\t\t\t\tisInStatement = true;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isCStyle() && findKeyword(line, i, AS_OPERATOR))\n\t\t\t\tisInOperator = true;\n\n\t\t\tif (g_preprocessorCppExternCBracket == 1 && findKeyword(line, i, AS_EXTERN))\n\t\t\t\t++g_preprocessorCppExternCBracket;\n\n\t\t\tif (g_preprocessorCppExternCBracket == 3)\t// extern \"C\" is not followed by a '{'\n\t\t\t\tg_preprocessorCppExternCBracket = 0;\n\n\t\t\t// \"new\" operator is a pointer, not a calculation\n\t\t\tif (findKeyword(line, i, AS_NEW))\n\t\t\t{\n\t\t\t\tif (isInStatement && !inStatementIndentStack->empty() && prevNonSpaceCh == '=' )\n\t\t\t\t\tinStatementIndentStack->back() = 0;\n\t\t\t}\n\n\t\t\tif (isCStyle())\n\t\t\t{\n\t\t\t\tif (findKeyword(line, i, AS_ASM)\n\t\t\t\t        || findKeyword(line, i, AS__ASM__))\n\t\t\t\t{\n\t\t\t\t\tisInAsm = true;\n\t\t\t\t}\n\t\t\t\telse if (findKeyword(line, i, AS_MS_ASM)\t\t// microsoft specific\n\t\t\t\t         || findKeyword(line, i, AS_MS__ASM))\n\t\t\t\t{\n\t\t\t\t\tint index = 4;\n\t\t\t\t\tif (peekNextChar(line, i) == '_')\t\t// check for __asm\n\t\t\t\t\t\tindex = 5;\n\n\t\t\t\t\tchar peekedChar = ASBase::peekNextChar(line, i + index);\n\t\t\t\t\tif (peekedChar == '{' || peekedChar == ' ')\n\t\t\t\t\t\tisInAsmBlock = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tisInAsmOneLine = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// bypass the entire name for all others\n\t\t\tstring name = getCurrentWord(line, i);\n\t\t\ti += name.length() - 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Handle Objective-C statements\n\n\t\tif (ch == '@'\n\t\t        && isCharPotentialHeader(line, i + 1))\n\t\t{\n\t\t\tstring curWord = getCurrentWord(line, i + 1);\n\t\t\tif (curWord == AS_INTERFACE\t&& headerStack->empty())\n\t\t\t{\n\t\t\t\tisInObjCInterface = true;\n\t\t\t\tstring name = '@' + curWord;\n\t\t\t\ti += name.length() - 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if (curWord == AS_PUBLIC\n\t\t\t         || curWord == AS_PRIVATE\n\t\t\t         || curWord == AS_PROTECTED)\n\t\t\t{\n\t\t\t\t--indentCount;\n\t\t\t\tif (modifierIndent)\n\t\t\t\t\tspaceIndentCount += (indentLength / 2);\n\t\t\t\tstring name = '@' + curWord;\n\t\t\t\ti += name.length() - 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if (curWord == AS_END)\n\t\t\t{\n\t\t\t\tpopLastInStatementIndent();\n\t\t\t\tspaceIndentCount = 0;\n\t\t\t\tif (isInObjCInterface)\n\t\t\t\t\t--indentCount;\n\t\t\t\tisInObjCInterface = false;\n\t\t\t\tisInObjCMethodDefinition = false;\n\t\t\t\tstring name = '@' + curWord;\n\t\t\t\ti += name.length() - 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\telse if ((ch == '-' || ch == '+')\n\t\t         && peekNextChar(line, i) == '('\n\t\t         && headerStack->empty()\n\t\t         && line.find_first_not_of(\" \\t\") == i)\n\t\t{\n\t\t\tif (isInObjCInterface)\n\t\t\t\t--indentCount;\n\t\t\tisInObjCInterface = false;\n\t\t\tisInObjCMethodDefinition = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Handle operators\n\n\t\tbool isPotentialOperator = isCharPotentialOperator(ch);\n\n\t\tif (isPotentialOperator)\n\t\t{\n\t\t\t// Check if an operator has been reached.\n\t\t\tconst string* foundAssignmentOp = findOperator(line, i, assignmentOperators);\n\t\t\tconst string* foundNonAssignmentOp = findOperator(line, i, nonAssignmentOperators);\n\n\t\t\tif (foundNonAssignmentOp == &AS_LAMBDA)\n\t\t\t\tfoundPreCommandHeader = true;\n\n\t\t\tif (isInTemplate && foundNonAssignmentOp == &AS_GR_GR)\n\t\t\t\tfoundNonAssignmentOp = NULL;\n\n\t\t\t// Since findHeader's boundary checking was not used above, it is possible\n\t\t\t// that both an assignment op and a non-assignment op where found,\n\t\t\t// e.g. '>>' and '>>='. If this is the case, treat the LONGER one as the\n\t\t\t// found operator.\n\t\t\tif (foundAssignmentOp != NULL && foundNonAssignmentOp != NULL)\n\t\t\t{\n\t\t\t\tif (foundAssignmentOp->length() < foundNonAssignmentOp->length())\n\t\t\t\t\tfoundAssignmentOp = NULL;\n\t\t\t\telse\n\t\t\t\t\tfoundNonAssignmentOp = NULL;\n\t\t\t}\n\n\t\t\tif (foundNonAssignmentOp != NULL)\n\t\t\t{\n\t\t\t\tif (foundNonAssignmentOp->length() > 1)\n\t\t\t\t\ti += foundNonAssignmentOp->length() - 1;\n\n\t\t\t\t// For C++ input/output, operator<< and >> should be\n\t\t\t\t// aligned, if we are not in a statement already and\n\t\t\t\t// also not in the \"operator<<(...)\" header line\n\t\t\t\tif (!isInOperator\n\t\t\t\t        && inStatementIndentStack->empty()\n\t\t\t\t        && isCStyle()\n\t\t\t\t        && (foundNonAssignmentOp == &AS_GR_GR\n\t\t\t\t            || foundNonAssignmentOp == &AS_LS_LS))\n\t\t\t\t{\n\t\t\t\t\t// this will be true if the line begins with the operator\n\t\t\t\t\tif (i < 2 && spaceIndentCount == 0)\n\t\t\t\t\t\tspaceIndentCount += 2 * indentLength;\n\t\t\t\t\t// align to the beginning column of the operator\n\t\t\t\t\tregisterInStatementIndent(line, i - foundNonAssignmentOp->length(), spaceIndentCount, tabIncrementIn, 0, false);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\telse if (foundAssignmentOp != NULL)\n\t\t\t{\n\t\t\t\tfoundPreCommandHeader = false;\t\t// clears this for array assignments\n\t\t\t\tfoundPreCommandMacro = false;\n\n\t\t\t\tif (foundAssignmentOp->length() > 1)\n\t\t\t\t\ti += foundAssignmentOp->length() - 1;\n\n\t\t\t\tif (!isInOperator && !isInTemplate && (!isNonInStatementArray || isInEnum))\n\t\t\t\t{\n\t\t\t\t\t// if multiple assignments, align on the previous word\n\t\t\t\t\tif (foundAssignmentOp == &AS_ASSIGN\n\t\t\t\t\t        && prevNonSpaceCh != ']'\t\t// an array\n\t\t\t\t\t        && statementEndsWithComma(line, i))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (!haveAssignmentThisLine)\t\t// only one assignment indent per line\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// register indent at previous word\n\t\t\t\t\t\t\thaveAssignmentThisLine = true;\n\t\t\t\t\t\t\tint prevWordIndex = getInStatementIndentAssign(line, i);\n\t\t\t\t\t\t\tint inStatementIndent = prevWordIndex + spaceIndentCount + tabIncrementIn;\n\t\t\t\t\t\t\tinStatementIndentStack->push_back(inStatementIndent);\n\t\t\t\t\t\t\tisInStatement = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// don't indent an assignment if 'let'\n\t\t\t\t\telse if (isInLet)\n\t\t\t\t\t{\n\t\t\t\t\t\tisInLet = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif (i == 0 && spaceIndentCount == 0)\n\t\t\t\t\t\t\tspaceIndentCount += indentLength;\n\t\t\t\t\t\tregisterInStatementIndent(line, i, spaceIndentCount, tabIncrementIn, 0, false);\n\t\t\t\t\t\tisInStatement = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\t// end of for loop * end of for loop * end of for loop * end of for loop * end of for loop *\n}\n\n\n}   // end namespace astyle\n"
  },
  {
    "path": "jni/highlight/core/astyle/ASEnhancer.cpp",
    "content": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *   ASEnhancer.cpp\n *\n *   Copyright (C) 2014 by Jim Pattee\n *   <http://www.gnu.org/licenses/lgpl-3.0.html>\n *\n *   This file is a part of Artistic Style - an indentation and\n *   reformatting tool for C, C++, C# and Java source files.\n *   <http://astyle.sourceforge.net>\n *\n *   Artistic Style is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU Lesser General Public License as published\n *   by the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   Artistic Style is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU Lesser General Public License for more details.\n *\n *   You should have received a copy of the GNU Lesser General Public License\n *   along with Artistic Style.  If not, see <http://www.gnu.org/licenses/>.\n *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n */\n\n#include \"astyle/astyle.h\"\n\n\nnamespace astyle {\n\n/**\n * ASEnhancer constructor\n */\nASEnhancer::ASEnhancer()\n{\n}\n\n/**\n * Destructor of ASEnhancer\n */\nASEnhancer::~ASEnhancer()\n{\n}\n\n/**\n * initialize the ASEnhancer.\n *\n * init() is called each time an ASFormatter object is initialized.\n */\nvoid ASEnhancer::init(int  _fileType,\n                      int  _indentLength,\n                      int  _tabLength,\n                      bool _useTabs,\n                      bool _forceTab,\n                      bool _namespaceIndent,\n                      bool _caseIndent,\n                      bool _preprocBlockIndent,\n                      bool _preprocDefineIndent,\n                      bool _emptyLineFill,\n                      vector<const pair<const string, const string>* >* _indentableMacros)\n{\n\t// formatting variables from ASFormatter and ASBeautifier\n\tASBase::init(_fileType);\n\tindentLength = _indentLength;\n\ttabLength = _tabLength;\n\tuseTabs = _useTabs;\n\tforceTab = _forceTab;\n\tnamespaceIndent = _namespaceIndent;\n\tcaseIndent = _caseIndent;\n\tpreprocBlockIndent = _preprocBlockIndent;\n\tpreprocDefineIndent = _preprocDefineIndent;\n\temptyLineFill = _emptyLineFill;\n\tindentableMacros = _indentableMacros;\n\tquoteChar = '\\'';\n\n\t// unindent variables\n\tlineNumber = 0;\n\tbracketCount = 0;\n\tisInComment = false;\n\tisInQuote = false;\n\tswitchDepth = 0;\n\teventPreprocDepth = 0;\n\tlookingForCaseBracket = false;\n\tunindentNextLine = false;\n\tshouldUnindentLine = false;\n\tshouldUnindentComment = false;\n\n\t// switch struct and vector\n\tsw.switchBracketCount = 0;\n\tsw.unindentDepth = 0;\n\tsw.unindentCase = false;\n\tswitchStack.clear();\n\n\t// other variables\n\tnextLineIsEventIndent = false;\n\tisInEventTable = false;\n\tnextLineIsDeclareIndent = false;\n\tisInDeclareSection = false;\n}\n\n/**\n * additional formatting for line of source code.\n * every line of source code in a source code file should be sent\n *     one after the other to this function.\n * indents event tables\n * unindents the case blocks\n *\n * @param line       the original formatted line will be updated if necessary.\n */\nvoid ASEnhancer::enhance(string &line, bool isInNamespace, bool isInPreprocessor, bool isInSQL)\n{\n\tshouldUnindentLine = true;\n\tshouldUnindentComment = false;\n\tlineNumber++;\n\n\t// check for beginning of event table\n\tif (nextLineIsEventIndent)\n\t{\n\t\tisInEventTable = true;\n\t\tnextLineIsEventIndent = false;\n\t}\n\n\t// check for beginning of SQL declare section\n\tif (nextLineIsDeclareIndent)\n\t{\n\t\tisInDeclareSection = true;\n\t\tnextLineIsDeclareIndent = false;\n\t}\n\n\tif (line.length() == 0\n\t        && !isInEventTable\n\t        && !isInDeclareSection\n\t        && !emptyLineFill)\n\t\treturn;\n\n\t// test for unindent on attached brackets\n\tif (unindentNextLine)\n\t{\n\t\tsw.unindentDepth++;\n\t\tsw.unindentCase = true;\n\t\tunindentNextLine = false;\n\t}\n\n\t// parse characters in the current line\n\tparseCurrentLine(line, isInPreprocessor, isInSQL);\n\n\t// check for SQL indentable lines\n\tif (isInDeclareSection)\n\t{\n\t\tsize_t firstText = line.find_first_not_of(\" \\t\");\n\t\tif (firstText == string::npos || line[firstText] != '#')\n\t\t\tindentLine(line, 1);\n\t}\n\n\t// check for event table indentable lines\n\tif (isInEventTable\n\t        && (eventPreprocDepth == 0\n\t            || (namespaceIndent && isInNamespace)))\n\t{\n\t\tsize_t firstText = line.find_first_not_of(\" \\t\");\n\t\tif (firstText == string::npos || line[firstText] != '#')\n\t\t\tindentLine(line, 1);\n\t}\n\n\tif (shouldUnindentComment && sw.unindentDepth > 0)\n\t\tunindentLine(line, sw.unindentDepth - 1);\n\telse if (shouldUnindentLine && sw.unindentDepth > 0)\n\t\tunindentLine(line, sw.unindentDepth);\n}\n\n/**\n * convert a force-tab indent to spaces\n *\n * @param line          a reference to the line that will be converted.\n */\nvoid ASEnhancer::convertForceTabIndentToSpaces(string &line) const\n{\n\t// replace tab indents with spaces\n\tfor (size_t i = 0; i < line.length(); i++)\n\t{\n\t\tif (!isWhiteSpace(line[i]))\n\t\t\tbreak;\n\t\tif (line[i] == '\\t')\n\t\t{\n\t\t\tline.erase(i, 1);\n\t\t\tline.insert(i, tabLength, ' ');\n\t\t\ti += tabLength - 1;\n\t\t}\n\t}\n}\n\n/**\n * convert a space indent to force-tab\n *\n * @param line          a reference to the line that will be converted.\n */\nvoid ASEnhancer::convertSpaceIndentToForceTab(string &line) const\n{\n\tassert(tabLength > 0);\n\n\t// replace leading spaces with tab indents\n\tsize_t newSpaceIndentLength = line.find_first_not_of(\" \\t\");\n\tsize_t tabCount = newSpaceIndentLength / tabLength;\t\t// truncate extra spaces\n\tline.erase(0U, tabCount * tabLength);\n\tline.insert(0U, tabCount, '\\t');\n}\n\n/**\n * find the colon following a 'case' statement\n *\n * @param line          a reference to the line.\n * @param caseIndex     the line index of the case statement.\n * @return              the line index of the colon.\n */\nsize_t ASEnhancer::findCaseColon(string &line, size_t caseIndex) const\n{\n\tsize_t i = caseIndex;\n\tbool isInQuote_ = false;\n\tchar quoteChar_ = ' ';\n\tfor (; i < line.length(); i++)\n\t{\n\t\tif (isInQuote_)\n\t\t{\n\t\t\tif (line[i] == '\\\\')\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if (line[i] == quoteChar_)          // check ending quote\n\t\t\t{\n\t\t\t\tisInQuote_ = false;\n\t\t\t\tquoteChar_ = ' ';\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcontinue;                           // must close quote before continuing\n\t\t\t}\n\t\t}\n\t\tif (line[i] == '\\'' || line[i] == '\\\"')\t\t// check opening quote\n\t\t{\n\t\t\tisInQuote_ = true;\n\t\t\tquoteChar_ = line[i];\n\t\t\tcontinue;\n\t\t}\n\t\tif (line[i] == ':')\n\t\t{\n\t\t\tif ((i + 1 < line.length()) && (line[i + 1] == ':'))\n\t\t\t\ti++;                                // bypass scope resolution operator\n\t\t\telse\n\t\t\t\tbreak;                              // found it\n\t\t}\n\t}\n\treturn i;\n}\n\n/**\n* indent a line by a given number of tabsets\n *    by inserting leading whitespace to the line argument.\n *\n * @param line          a reference to the line to indent.\n * @param indent        the number of tabsets to insert.\n * @return              the number of characters inserted.\n */\nint ASEnhancer::indentLine(string &line, int indent) const\n{\n\tif (line.length() == 0\n\t        && !emptyLineFill)\n\t\treturn 0;\n\n\tsize_t charsToInsert;\n\n\tif (forceTab && indentLength != tabLength)\n\t{\n\t\t// replace tab indents with spaces\n\t\tconvertForceTabIndentToSpaces(line);\n\t\t// insert the space indents\n\t\tcharsToInsert = indent * indentLength;\n\t\tline.insert(0U, charsToInsert, ' ');\n\t\t// replace leading spaces with tab indents\n\t\tconvertSpaceIndentToForceTab(line);\n\t}\n\telse if (useTabs)\n\t{\n\t\tcharsToInsert = indent;\n\t\tline.insert(0U, charsToInsert, '\\t');\n\t}\n\telse // spaces\n\t{\n\t\tcharsToInsert = indent * indentLength;\n\t\tline.insert(0U, charsToInsert, ' ');\n\t}\n\n\treturn charsToInsert;\n}\n\n/**\n * check for SQL \"BEGIN DECLARE SECTION\".\n * must compare case insensitive and allow any spacing between words.\n *\n * @param line          a reference to the line to indent.\n * @param index         the current line index.\n * @return              true if a hit.\n */\nbool ASEnhancer::isBeginDeclareSectionSQL(string &line, size_t index) const\n{\n\tstring word;\n\tsize_t hits = 0;\n\tsize_t i;\n\tfor (i = index; i < line.length(); i++)\n\t{\n\t\ti = line.find_first_not_of(\" \\t\", i);\n\t\tif (i == string::npos)\n\t\t\treturn false;\n\t\tif (line[i] == ';')\n\t\t\tbreak;\n\t\tif (!isCharPotentialHeader(line, i))\n\t\t\tcontinue;\n\t\tword = getCurrentWord(line, i);\n\t\tfor (size_t j = 0; j < word.length(); j++)\n\t\t\tword[j] = (char) toupper(word[j]);\n\t\tif (word == \"EXEC\" || word == \"SQL\")\n\t\t{\n\t\t\ti += word.length() - 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (word == \"DECLARE\" || word == \"SECTION\")\n\t\t{\n\t\t\thits++;\n\t\t\ti += word.length() - 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (word == \"BEGIN\")\n\t\t{\n\t\t\thits++;\n\t\t\ti += word.length() - 1;\n\t\t\tcontinue;\n\t\t}\n\t\treturn false;\n\t}\n\tif (hits == 3)\n\t\treturn true;\n\treturn false;\n}\n\n/**\n * check for SQL \"END DECLARE SECTION\".\n * must compare case insensitive and allow any spacing between words.\n *\n * @param line          a reference to the line to indent.\n * @param index         the current line index.\n * @return              true if a hit.\n */\nbool ASEnhancer::isEndDeclareSectionSQL(string &line, size_t index) const\n{\n\tstring word;\n\tsize_t hits = 0;\n\tsize_t i;\n\tfor (i = index; i < line.length(); i++)\n\t{\n\t\ti = line.find_first_not_of(\" \\t\", i);\n\t\tif (i == string::npos)\n\t\t\treturn false;\n\t\tif (line[i] == ';')\n\t\t\tbreak;\n\t\tif (!isCharPotentialHeader(line, i))\n\t\t\tcontinue;\n\t\tword = getCurrentWord(line, i);\n\t\tfor (size_t j = 0; j < word.length(); j++)\n\t\t\tword[j] = (char) toupper(word[j]);\n\t\tif (word == \"EXEC\" || word == \"SQL\")\n\t\t{\n\t\t\ti += word.length() - 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (word == \"DECLARE\" || word == \"SECTION\")\n\t\t{\n\t\t\thits++;\n\t\t\ti += word.length() - 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (word == \"END\")\n\t\t{\n\t\t\thits++;\n\t\t\ti += word.length() - 1;\n\t\t\tcontinue;\n\t\t}\n\t\treturn false;\n\t}\n\tif (hits == 3)\n\t\treturn true;\n\treturn false;\n}\n\n/**\n * check if a one-line bracket has been reached,\n * i.e. if the currently reached '{' character is closed\n * with a complimentary '}' elsewhere on the current line,\n *.\n * @return     false = one-line bracket has not been reached.\n *             true  = one-line bracket has been reached.\n */\nbool ASEnhancer::isOneLineBlockReached(string &line, int startChar) const\n{\n\tassert(line[startChar] == '{');\n\n\tbool isInComment_ = false;\n\tbool isInQuote_ = false;\n\tint _bracketCount = 1;\n\tint lineLength = line.length();\n\tchar quoteChar_ = ' ';\n\tchar ch = ' ';\n\n\tfor (int i = startChar + 1; i < lineLength; ++i)\n\t{\n\t\tch = line[i];\n\n\t\tif (isInComment_)\n\t\t{\n\t\t\tif (line.compare(i, 2, \"*/\") == 0)\n\t\t\t{\n\t\t\t\tisInComment_ = false;\n\t\t\t\t++i;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (ch == '\\\\')\n\t\t{\n\t\t\t++i;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isInQuote_)\n\t\t{\n\t\t\tif (ch == quoteChar_)\n\t\t\t\tisInQuote_ = false;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (ch == '\"' || ch == '\\'')\n\t\t{\n\t\t\tisInQuote_ = true;\n\t\t\tquoteChar_ = ch;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (line.compare(i, 2, \"//\") == 0)\n\t\t\tbreak;\n\n\t\tif (line.compare(i, 2, \"/*\") == 0)\n\t\t{\n\t\t\tisInComment_ = true;\n\t\t\t++i;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (ch == '{')\n\t\t\t++_bracketCount;\n\t\telse if (ch == '}')\n\t\t\t--_bracketCount;\n\n\t\tif (_bracketCount == 0)\n\t\t\treturn true;\n\t}\n\n\treturn false;\n}\n\n/**\n * parse characters in the current line to determine if an indent\n * or unindent is needed.\n */\nvoid ASEnhancer::parseCurrentLine(string &line, bool isInPreprocessor, bool isInSQL)\n{\n\tbool isSpecialChar = false;\t\t\t// is a backslash escape character\n\n\tfor (size_t i = 0; i < line.length(); i++)\n\t{\n\t\tchar ch = line[i];\n\n\t\t// bypass whitespace\n\t\tif (isWhiteSpace(ch))\n\t\t\tcontinue;\n\n\t\t// handle special characters (i.e. backslash+character such as \\n, \\t, ...)\n\t\tif (isSpecialChar)\n\t\t{\n\t\t\tisSpecialChar = false;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!(isInComment) && line.compare(i, 2, \"\\\\\\\\\") == 0)\n\t\t{\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!(isInComment) && ch == '\\\\')\n\t\t{\n\t\t\tisSpecialChar = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// handle quotes (such as 'x' and \"Hello Dolly\")\n\t\tif (!isInComment && (ch == '\"' || ch == '\\''))\n\t\t{\n\t\t\tif (!isInQuote)\n\t\t\t{\n\t\t\t\tquoteChar = ch;\n\t\t\t\tisInQuote = true;\n\t\t\t}\n\t\t\telse if (quoteChar == ch)\n\t\t\t{\n\t\t\t\tisInQuote = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (isInQuote)\n\t\t\tcontinue;\n\n\t\t// handle comments\n\n\t\tif (!(isInComment) && line.compare(i, 2, \"//\") == 0)\n\t\t{\n\t\t\t// check for windows line markers\n\t\t\tif (line.compare(i + 2, 1, \"\\xf0\") > 0)\n\t\t\t\tlineNumber--;\n\t\t\t// unindent if not in case brackets\n\t\t\tif (line.find_first_not_of(\" \\t\") == i\n\t\t\t        && sw.switchBracketCount == 1\n\t\t\t        && sw.unindentCase)\n\t\t\t\tshouldUnindentComment = true;\n\t\t\tbreak;                 // finished with the line\n\t\t}\n\t\telse if (!(isInComment) && line.compare(i, 2, \"/*\") == 0)\n\t\t{\n\t\t\t// unindent if not in case brackets\n\t\t\tif (sw.switchBracketCount == 1 && sw.unindentCase)\n\t\t\t\tshouldUnindentComment = true;\n\t\t\tisInComment = true;\n\t\t\tsize_t commentEnd = line.find(\"*/\", i);\n\t\t\tif (commentEnd == string::npos)\n\t\t\t\ti = line.length() - 1;\n\t\t\telse\n\t\t\t\ti = commentEnd - 1;\n\t\t\tcontinue;\n\t\t}\n\t\telse if ((isInComment) && line.compare(i, 2, \"*/\") == 0)\n\t\t{\n\t\t\t// unindent if not in case brackets\n\t\t\tif (sw.switchBracketCount == 1 && sw.unindentCase)\n\t\t\t\tshouldUnindentComment = true;\n\t\t\tisInComment = false;\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isInComment)\n\t\t{\n\t\t\t// unindent if not in case brackets\n\t\t\tif (sw.switchBracketCount == 1 && sw.unindentCase)\n\t\t\t\tshouldUnindentComment = true;\n\t\t\tsize_t commentEnd = line.find(\"*/\", i);\n\t\t\tif (commentEnd == string::npos)\n\t\t\t\ti = line.length() - 1;\n\t\t\telse\n\t\t\t\ti = commentEnd - 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// if we have reached this far then we are NOT in a comment or string of special characters\n\n\t\tif (line[i] == '{')\n\t\t\tbracketCount++;\n\n\t\tif (line[i] == '}')\n\t\t\tbracketCount--;\n\n\t\t// check for preprocessor within an event table\n\t\tif (isInEventTable && line[i] == '#' && preprocBlockIndent)\n\t\t{\n\t\t\tstring preproc;\n\t\t\tpreproc = line.substr(i + 1);\n\t\t\tif (preproc.substr(0, 2) == \"if\") // #if, #ifdef, #ifndef)\n\t\t\t\teventPreprocDepth += 1;\n\t\t\tif (preproc.substr(0, 5) == \"endif\" && eventPreprocDepth > 0)\n\t\t\t\teventPreprocDepth -= 1;\n\t\t}\n\n\t\tbool isPotentialKeyword = isCharPotentialHeader(line, i);\n\n\t\t// ----------------  wxWidgets and MFC macros  ----------------------------------\n\n\t\tif (isPotentialKeyword)\n\t\t{\n\t\t\tfor (size_t j = 0; j < indentableMacros->size(); j++)\n\t\t\t{\n\t\t\t\t// 'first' is the beginning macro\n\t\t\t\tif (findKeyword(line, i, indentableMacros->at(j)->first))\n\t\t\t\t{\n\t\t\t\t\tnextLineIsEventIndent = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (size_t j = 0; j < indentableMacros->size(); j++)\n\t\t\t{\n\t\t\t\t// 'second' is the ending macro\n\t\t\t\tif (findKeyword(line, i, indentableMacros->at(j)->second))\n\t\t\t\t{\n\t\t\t\t\tisInEventTable = false;\n\t\t\t\t\teventPreprocDepth = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// ----------------  process SQL  -----------------------------------------------\n\n\t\tif (isInSQL)\n\t\t{\n\t\t\tif (isBeginDeclareSectionSQL(line, i))\n\t\t\t\tnextLineIsDeclareIndent = true;\n\t\t\tif (isEndDeclareSectionSQL(line, i))\n\t\t\t\tisInDeclareSection = false;\n\t\t\tbreak;\n\t\t}\n\n\t\t// ----------------  process switch statements  ---------------------------------\n\n\t\tif (isPotentialKeyword && findKeyword(line, i, \"switch\"))\n\t\t{\n\t\t\tswitchDepth++;\n\t\t\tswitchStack.push_back(sw);                      // save current variables\n\t\t\tsw.switchBracketCount = 0;\n\t\t\tsw.unindentCase = false;                        // don't clear case until end of switch\n\t\t\ti += 5;                                         // bypass switch statement\n\t\t\tcontinue;\n\t\t}\n\n\t\t// just want unindented case statements from this point\n\n\t\tif (caseIndent\n\t\t        || switchDepth == 0\n\t\t        || (isInPreprocessor && !preprocDefineIndent))\n\t\t{\n\t\t\t// bypass the entire word\n\t\t\tif (isPotentialKeyword)\n\t\t\t{\n\t\t\t\tstring name = getCurrentWord(line, i);\n\t\t\t\ti += name.length() - 1;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\ti = processSwitchBlock(line, i);\n\n\t}   // end of for loop * end of for loop * end of for loop * end of for loop\n}\n\n/**\n * process the character at the current index in a switch block.\n *\n * @param line          a reference to the line to indent.\n * @param index         the current line index.\n * @return              the new line index.\n */\nsize_t ASEnhancer::processSwitchBlock(string &line, size_t index)\n{\n\tsize_t i = index;\n\tbool isPotentialKeyword = isCharPotentialHeader(line, i);\n\n\tif (line[i] == '{')\n\t{\n\t\tsw.switchBracketCount++;\n\t\tif (lookingForCaseBracket)                      // if 1st after case statement\n\t\t{\n\t\t\tsw.unindentCase = true;                     // unindenting this case\n\t\t\tsw.unindentDepth++;\n\t\t\tlookingForCaseBracket = false;              // not looking now\n\t\t}\n\t\treturn i;\n\t}\n\tlookingForCaseBracket = false;                      // no opening bracket, don't indent\n\n\tif (line[i] == '}')\n\t{\n\t\tsw.switchBracketCount--;\n\t\tassert(sw.switchBracketCount <= bracketCount);\n\t\tif (sw.switchBracketCount == 0)                 // if end of switch statement\n\t\t{\n\t\t\tint lineUnindent = sw.unindentDepth;\n\t\t\tif (line.find_first_not_of(\" \\t\") == i\n\t\t\t        && !switchStack.empty())\n\t\t\t\tlineUnindent = switchStack[switchStack.size() - 1].unindentDepth;\n\t\t\tif (shouldUnindentLine)\n\t\t\t{\n\t\t\t\tif (lineUnindent > 0)\n\t\t\t\t\ti -= unindentLine(line, lineUnindent);\n\t\t\t\tshouldUnindentLine = false;\n\t\t\t}\n\t\t\tswitchDepth--;\n\t\t\tsw = switchStack.back();\n\t\t\tswitchStack.pop_back();\n\t\t}\n\t\treturn i;\n\t}\n\n\tif (isPotentialKeyword\n\t        && (findKeyword(line, i, \"case\") || findKeyword(line, i, \"default\")))\n\t{\n\t\tif (sw.unindentCase)\t\t\t\t\t// if unindented last case\n\t\t{\n\t\t\tsw.unindentCase = false;\t\t\t// stop unindenting previous case\n\t\t\tsw.unindentDepth--;\n\t\t}\n\n\t\ti = findCaseColon(line, i);\n\n\t\ti++;\n\t\tfor (; i < line.length(); i++)\t\t\t// bypass whitespace\n\t\t{\n\t\t\tif (!isWhiteSpace(line[i]))\n\t\t\t\tbreak;\n\t\t}\n\t\tif (i < line.length())\n\t\t{\n\t\t\tif (line[i] == '{')\n\t\t\t{\n\t\t\t\tbracketCount++;\n\t\t\t\tsw.switchBracketCount++;\n\t\t\t\tif (!isOneLineBlockReached(line, i))\n\t\t\t\t\tunindentNextLine = true;\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\tlookingForCaseBracket = true;\n\t\ti--;\t\t\t\t\t\t\t\t\t// need to process this char\n\t\treturn i;\n\t}\n\tif (isPotentialKeyword)\n\t{\n\t\tstring name = getCurrentWord(line, i);          // bypass the entire name\n\t\ti += name.length() - 1;\n\t}\n\treturn i;\n}\n\n/**\n * unindent a line by a given number of tabsets\n *    by erasing the leading whitespace from the line argument.\n *\n * @param line          a reference to the line to unindent.\n * @param unindent      the number of tabsets to erase.\n * @return              the number of characters erased.\n */\nint ASEnhancer::unindentLine(string &line, int unindent) const\n{\n\tsize_t whitespace = line.find_first_not_of(\" \\t\");\n\n\tif (whitespace == string::npos)         // if line is blank\n\t\twhitespace = line.length();         // must remove padding, if any\n\n\tif (whitespace == 0)\n\t\treturn 0;\n\n\tsize_t charsToErase = 0;\n\n\tif (forceTab && indentLength != tabLength)\n\t{\n\t\t// replace tab indents with spaces\n\t\tconvertForceTabIndentToSpaces(line);\n\t\t// remove the space indents\n\t\tsize_t spaceIndentLength = line.find_first_not_of(\" \\t\");\n\t\tcharsToErase = unindent * indentLength;\n\t\tif (charsToErase <= spaceIndentLength)\n\t\t\tline.erase(0, charsToErase);\n\t\telse\n\t\t\tcharsToErase = 0;\n\t\t// replace leading spaces with tab indents\n\t\tconvertSpaceIndentToForceTab(line);\n\t}\n\telse if (useTabs)\n\t{\n\t\tcharsToErase = unindent;\n\t\tif (charsToErase <= whitespace)\n\t\t\tline.erase(0, charsToErase);\n\t\telse\n\t\t\tcharsToErase = 0;\n\t}\n\telse // spaces\n\t{\n\t\tcharsToErase = unindent * indentLength;\n\t\tif (charsToErase <= whitespace)\n\t\t\tline.erase(0, charsToErase);\n\t\telse\n\t\t\tcharsToErase = 0;\n\t}\n\n\treturn charsToErase;\n}\n\n\n}   // end namespace astyle\n"
  },
  {
    "path": "jni/highlight/core/astyle/ASFormatter.cpp",
    "content": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *   ASFormatter.cpp\n *\n *   Copyright (C) 2014 by Jim Pattee\n *   <http://www.gnu.org/licenses/lgpl-3.0.html>\n *\n *   This file is a part of Artistic Style - an indentation and\n *   reformatting tool for C, C++, C# and Java source files.\n *   <http://astyle.sourceforge.net>\n *\n *   Artistic Style is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU Lesser General Public License as published\n *   by the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   Artistic Style is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU Lesser General Public License for more details.\n *\n *   You should have received a copy of the GNU Lesser General Public License\n *   along with Artistic Style.  If not, see <http://www.gnu.org/licenses/>.\n *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n */\n\n#include \"astyle/astyle.h\"\n\n#include <algorithm>\n#include <fstream>\n\n\nnamespace astyle {\n/**\n * Constructor of ASFormatter\n */\nASFormatter::ASFormatter()\n{\n\tsourceIterator = NULL;\n\tenhancer = new ASEnhancer;\n\tpreBracketHeaderStack = NULL;\n\tbracketTypeStack = NULL;\n\tparenStack = NULL;\n\tstructStack = NULL;\n\tquestionMarkStack = NULL;\n\tlineCommentNoIndent = false;\n\tformattingStyle = STYLE_NONE;\n\tbracketFormatMode = NONE_MODE;\n\tpointerAlignment = PTR_ALIGN_NONE;\n\treferenceAlignment = REF_SAME_AS_PTR;\n\tobjCColonPadMode = COLON_PAD_NO_CHANGE;\n\tlineEnd = LINEEND_DEFAULT;\n\tmaxCodeLength = string::npos;\n\tshouldPadOperators = false;\n\tshouldPadParensOutside = false;\n\tshouldPadFirstParen = false;\n\tshouldPadParensInside = false;\n\tshouldPadHeader = false;\n\tshouldStripCommentPrefix = false;\n\tshouldUnPadParens = false;\n\tattachClosingBracketMode = false;\n\tshouldBreakOneLineBlocks = true;\n\tshouldBreakOneLineStatements = true;\n\tshouldConvertTabs = false;\n\tshouldIndentCol1Comments = false;\n\tshouldIndentPreprocBlock = false;\n\tshouldCloseTemplates = false;\n\tshouldAttachExternC = false;\n\tshouldAttachNamespace = false;\n\tshouldAttachClass = false;\n\tshouldAttachInline = false;\n\tshouldBreakBlocks = false;\n\tshouldBreakClosingHeaderBlocks = false;\n\tshouldBreakClosingHeaderBrackets = false;\n\tshouldDeleteEmptyLines = false;\n\tshouldBreakElseIfs = false;\n\tshouldBreakLineAfterLogical = false;\n\tshouldAddBrackets = false;\n\tshouldAddOneLineBrackets = false;\n\tshouldRemoveBrackets = false;\n\tshouldPadMethodColon = false;\n\tshouldPadMethodPrefix = false;\n\tshouldUnPadMethodPrefix = false;\n\n\t// initialize ASFormatter member vectors\n\tformatterFileType = 9;\t\t// reset to an invalid type\n\theaders = new vector<const string*>;\n\tnonParenHeaders = new vector<const string*>;\n\tpreDefinitionHeaders = new vector<const string*>;\n\tpreCommandHeaders = new vector<const string*>;\n\toperators = new vector<const string*>;\n\tassignmentOperators = new vector<const string*>;\n\tcastOperators = new vector<const string*>;\n\n\t// initialize ASEnhancer member vectors\n\tindentableMacros = new vector<const pair<const string, const string>* >;\n}\n\n/**\n * Destructor of ASFormatter\n */\nASFormatter::~ASFormatter()\n{\n\t// delete ASFormatter stack vectors\n\tdeleteContainer(preBracketHeaderStack);\n\tdeleteContainer(bracketTypeStack);\n\tdeleteContainer(parenStack);\n\tdeleteContainer(structStack);\n\tdeleteContainer(questionMarkStack);\n\n\t// delete ASFormatter member vectors\n\tformatterFileType = 9;\t\t// reset to an invalid type\n\tdelete headers;\n\tdelete nonParenHeaders;\n\tdelete preDefinitionHeaders;\n\tdelete preCommandHeaders;\n\tdelete operators;\n\tdelete assignmentOperators;\n\tdelete castOperators;\n\n\t// delete ASEnhancer member vectors\n\tdelete indentableMacros;\n\n\t// delete ASBeautifier member vectors\n\t// must be done when the ASFormatter object is deleted (not ASBeautifier)\n\tASBeautifier::deleteBeautifierVectors();\n\n\tdelete enhancer;\n}\n\n/**\n * initialize the ASFormatter.\n *\n * init() should be called every time a ASFormatter object is to start\n * formatting a NEW source file.\n * init() receives a pointer to a ASSourceIterator object that will be\n * used to iterate through the source code.\n *\n * @param si        a pointer to the ASSourceIterator or ASStreamIterator object.\n */\nvoid ASFormatter::init(ASSourceIterator* si)\n{\n\tbuildLanguageVectors();\n\tfixOptionVariableConflicts();\n\tASBeautifier::init(si);\n\tsourceIterator = si;\n\n\tenhancer->init(getFileType(),\n\t               getIndentLength(),\n\t               getTabLength(),\n\t               getIndentString() == \"\\t\" ? true : false,\n\t               getForceTabIndentation(),\n\t               getNamespaceIndent(),\n\t               getCaseIndent(),\n\t               shouldIndentPreprocBlock,\n\t               getPreprocDefineIndent(),\n\t               getEmptyLineFill(),\n\t               indentableMacros);\n\n\tinitContainer(preBracketHeaderStack, new vector<const string*>);\n\tinitContainer(parenStack, new vector<int>);\n\tinitContainer(structStack, new vector<bool>);\n\tinitContainer(questionMarkStack, new vector<bool>);\n\tparenStack->push_back(0);               // parenStack must contain this default entry\n\tinitContainer(bracketTypeStack, new vector<BracketType>);\n\tbracketTypeStack->push_back(NULL_TYPE); // bracketTypeStack must contain this default entry\n\tclearFormattedLineSplitPoints();\n\n\tcurrentHeader = NULL;\n\tcurrentLine = \"\";\n\treadyFormattedLine = \"\";\n\tformattedLine = \"\";\n\tverbatimDelimiter = \"\";\n\tcurrentChar = ' ';\n\tpreviousChar = ' ';\n\tpreviousCommandChar = ' ';\n\tpreviousNonWSChar = ' ';\n\tquoteChar = '\"';\n\tpreprocBlockEnd = 0;\n\tcharNum = 0;\n\tchecksumIn = 0;\n\tchecksumOut = 0;\n\tcurrentLineFirstBracketNum = string::npos;\n\tformattedLineCommentNum = 0;\n\tleadingSpaces = 0;\n\tpreviousReadyFormattedLineLength = string::npos;\n\tpreprocBracketTypeStackSize = 0;\n\tspacePadNum = 0;\n\tnextLineSpacePadNum = 0;\n\ttemplateDepth = 0;\n\tsquareBracketCount = 0;\n\thorstmannIndentChars = 0;\n\ttabIncrementIn = 0;\n\tpreviousBracketType = NULL_TYPE;\n\tpreviousOperator = NULL;\n\n\tisVirgin = true;\n\tisInLineComment = false;\n\tisInComment = false;\n\tisInCommentStartLine = false;\n\tnoTrimCommentContinuation = false;\n\tisInPreprocessor = false;\n\tisInPreprocessorBeautify = false;\n\tdoesLineStartComment = false;\n\tlineEndsInCommentOnly = false;\n\tlineIsCommentOnly = false;\n\tlineIsLineCommentOnly = false;\n\tlineIsEmpty = false;\n\tisImmediatelyPostCommentOnly = false;\n\tisImmediatelyPostEmptyLine = false;\n\tisInClassInitializer = false;\n\tisInQuote = false;\n\tisInVerbatimQuote = false;\n\thaveLineContinuationChar = false;\n\tisInQuoteContinuation = false;\n\tisHeaderInMultiStatementLine = false;\n\tisSpecialChar = false;\n\tisNonParenHeader = false;\n\tfoundNamespaceHeader = false;\n\tfoundClassHeader = false;\n\tfoundStructHeader = false;\n\tfoundInterfaceHeader = false;\n\tfoundPreDefinitionHeader = false;\n\tfoundPreCommandHeader = false;\n\tfoundPreCommandMacro = false;\n\tfoundCastOperator = false;\n\tfoundQuestionMark = false;\n\tisInLineBreak = false;\n\tendOfAsmReached = false;\n\tendOfCodeReached = false;\n\tisFormattingModeOff = false;\n\tisInEnum = false;\n\tisInExecSQL = false;\n\tisInAsm = false;\n\tisInAsmOneLine = false;\n\tisInAsmBlock = false;\n\tisLineReady = false;\n\telseHeaderFollowsComments = false;\n\tcaseHeaderFollowsComments = false;\n\tisPreviousBracketBlockRelated = false;\n\tisInPotentialCalculation = false;\n\tshouldReparseCurrentChar = false;\n\tneedHeaderOpeningBracket = false;\n\tshouldBreakLineAtNextChar = false;\n\tshouldKeepLineUnbroken = false;\n\tpassedSemicolon = false;\n\tpassedColon = false;\n\tisImmediatelyPostNonInStmt = false;\n\tisCharImmediatelyPostNonInStmt = false;\n\tisInTemplate = false;\n\tisImmediatelyPostComment = false;\n\tisImmediatelyPostLineComment = false;\n\tisImmediatelyPostEmptyBlock = false;\n\tisImmediatelyPostPreprocessor = false;\n\tisImmediatelyPostReturn = false;\n\tisImmediatelyPostThrow = false;\n\tisImmediatelyPostOperator = false;\n\tisImmediatelyPostTemplate = false;\n\tisImmediatelyPostPointerOrReference = false;\n\tisCharImmediatelyPostReturn = false;\n\tisCharImmediatelyPostThrow = false;\n\tisCharImmediatelyPostOperator = false;\n\tisCharImmediatelyPostComment = false;\n\tisPreviousCharPostComment = false;\n\tisCharImmediatelyPostLineComment = false;\n\tisCharImmediatelyPostOpenBlock = false;\n\tisCharImmediatelyPostCloseBlock = false;\n\tisCharImmediatelyPostTemplate = false;\n\tisCharImmediatelyPostPointerOrReference = false;\n\tisInObjCMethodDefinition = false;\n\tisInObjCInterface = false;\n\tisInObjCSelector = false;\n\tbreakCurrentOneLineBlock = false;\n\tshouldRemoveNextClosingBracket = false;\n\tisInHorstmannRunIn = false;\n\tcurrentLineBeginsWithBracket = false;\n\tisPrependPostBlockEmptyLineRequested = false;\n\tisAppendPostBlockEmptyLineRequested = false;\n\tisIndentableProprocessor = false;\n\tisIndentableProprocessorBlock = false;\n\tprependEmptyLine = false;\n\tappendOpeningBracket = false;\n\tfoundClosingHeader = false;\n\tisImmediatelyPostHeader = false;\n\tisInHeader = false;\n\tisInCase = false;\n\tisFirstPreprocConditional = false;\n\tprocessedFirstConditional = false;\n\tisJavaStaticConstructor = false;\n}\n\n/**\n * build vectors for each programing language\n * depending on the file extension.\n */\nvoid ASFormatter::buildLanguageVectors()\n{\n\tif (getFileType() == formatterFileType)  // don't build unless necessary\n\t\treturn;\n\n\tformatterFileType = getFileType();\n\n\theaders->clear();\n\tnonParenHeaders->clear();\n\tpreDefinitionHeaders->clear();\n\tpreCommandHeaders->clear();\n\toperators->clear();\n\tassignmentOperators->clear();\n\tcastOperators->clear();\n\tindentableMacros->clear();\t// ASEnhancer\n\n\tASResource::buildHeaders(headers, getFileType());\n\tASResource::buildNonParenHeaders(nonParenHeaders, getFileType());\n\tASResource::buildPreDefinitionHeaders(preDefinitionHeaders, getFileType());\n\tASResource::buildPreCommandHeaders(preCommandHeaders, getFileType());\n\tASResource::buildOperators(operators, getFileType());\n\tASResource::buildAssignmentOperators(assignmentOperators);\n\tASResource::buildCastOperators(castOperators);\n\tASResource::buildIndentableMacros(indentableMacros);\t//ASEnhancer\n}\n\n/**\n * set the variables for each predefined style.\n * this will override any previous settings.\n */\nvoid ASFormatter::fixOptionVariableConflicts()\n{\n\tif (formattingStyle == STYLE_ALLMAN)\n\t{\n\t\tsetBracketFormatMode(BREAK_MODE);\n\t}\n\telse if (formattingStyle == STYLE_JAVA)\n\t{\n\t\tsetBracketFormatMode(ATTACH_MODE);\n\t}\n\telse if (formattingStyle == STYLE_KR)\n\t{\n\t\tsetBracketFormatMode(LINUX_MODE);\n\t}\n\telse if (formattingStyle == STYLE_STROUSTRUP)\n\t{\n\t\tsetBracketFormatMode(STROUSTRUP_MODE);\n\t}\n\telse if (formattingStyle == STYLE_WHITESMITH)\n\t{\n\t\tsetBracketFormatMode(BREAK_MODE);\n\t\tsetBracketIndent(true);\n\t\tsetClassIndent(true);\t\t\t// avoid hanging indent with access modifiers\n\t\tsetSwitchIndent(true);\t\t\t// avoid hanging indent with case statements\n\t}\n\telse if (formattingStyle == STYLE_VTK)\n\t{\n\t\t// the unindented class bracket does NOT cause a hanging indent like Whitesmith\n\t\tsetBracketFormatMode(BREAK_MODE);\n\t\tsetBracketIndentVtk(true);\t\t// sets both bracketIndent and bracketIndentVtk\n\t\tsetSwitchIndent(true);\t\t\t// avoid hanging indent with case statements\n\t}\n\telse if (formattingStyle == STYLE_BANNER)\n\t{\n\t\t// attached brackets can have hanging indents with the closing bracket\n\t\tsetBracketFormatMode(ATTACH_MODE);\n\t\tsetBracketIndent(true);\n\t\tsetClassIndent(true);\t\t\t// avoid hanging indent with access modifiers\n\t\tsetSwitchIndent(true);\t\t\t// avoid hanging indent with case statements\n\t}\n\telse if (formattingStyle == STYLE_GNU)\n\t{\n\t\tsetBracketFormatMode(BREAK_MODE);\n\t\tsetBlockIndent(true);\n\t}\n\telse if (formattingStyle == STYLE_LINUX)\n\t{\n\t\tsetBracketFormatMode(LINUX_MODE);\n\t\t// always for Linux style\n\t\tsetMinConditionalIndentOption(MINCOND_ONEHALF);\n\t}\n\telse if (formattingStyle == STYLE_HORSTMANN)\n\t{\n\t\tsetBracketFormatMode(RUN_IN_MODE);\n\t\tsetSwitchIndent(true);\n\t}\n\telse if (formattingStyle == STYLE_1TBS)\n\t{\n\t\tsetBracketFormatMode(LINUX_MODE);\n\t\tsetAddBracketsMode(true);\n\t\tsetRemoveBracketsMode(false);\n\t}\n\telse if (formattingStyle == STYLE_GOOGLE)\n\t{\n\t\tsetBracketFormatMode(ATTACH_MODE);\n\t\tsetModifierIndent(true);\n\t\tsetClassIndent(false);\n\t}\n\telse if (formattingStyle == STYLE_PICO)\n\t{\n\t\tsetBracketFormatMode(RUN_IN_MODE);\n\t\tsetAttachClosingBracketMode(true);\n\t\tsetSwitchIndent(true);\n\t\tsetBreakOneLineBlocksMode(false);\n\t\tsetSingleStatementsMode(false);\n\t\t// add-brackets won't work for pico, but it could be fixed if necessary\n\t\t// both options should be set to true\n\t\tif (shouldAddBrackets)\n\t\t\tshouldAddOneLineBrackets = true;\n\t}\n\telse if (formattingStyle == STYLE_LISP)\n\t{\n\t\tsetBracketFormatMode(ATTACH_MODE);\n\t\tsetAttachClosingBracketMode(true);\n\t\tsetSingleStatementsMode(false);\n\t\t// add-one-line-brackets won't work for lisp\n\t\t// only shouldAddBrackets should be set to true\n\t\tif (shouldAddOneLineBrackets)\n\t\t{\n\t\t\tshouldAddBrackets = true;\n\t\t\tshouldAddOneLineBrackets = false;\n\t\t}\n\t}\n\tsetMinConditionalIndentLength();\n\t// if not set by indent=force-tab-x set equal to indentLength\n\tif (!getTabLength())\n\t\tsetDefaultTabLength();\n\t// add-one-line-brackets implies keep-one-line-blocks\n\tif (shouldAddOneLineBrackets)\n\t\tsetBreakOneLineBlocksMode(false);\n\t// don't allow add-brackets and remove-brackets\n\tif (shouldAddBrackets || shouldAddOneLineBrackets)\n\t\tsetRemoveBracketsMode(false);\n\t// don't allow indent-classes and indent-modifiers\n\tif (getClassIndent())\n\t\tsetModifierIndent(false);\n}\n\n/**\n * get the next formatted line.\n *\n * @return    formatted line.\n */\nstring ASFormatter::nextLine()\n{\n\tconst string* newHeader;\n\tbool isInVirginLine = isVirgin;\n\tisCharImmediatelyPostComment = false;\n\tisPreviousCharPostComment = false;\n\tisCharImmediatelyPostLineComment = false;\n\tisCharImmediatelyPostOpenBlock = false;\n\tisCharImmediatelyPostCloseBlock = false;\n\tisCharImmediatelyPostTemplate = false;\n\n\twhile (!isLineReady)\n\t{\n\t\tif (shouldReparseCurrentChar)\n\t\t\tshouldReparseCurrentChar = false;\n\t\telse if (!getNextChar())\n\t\t{\n\t\t\tbreakLine();\n\t\t\tcontinue;\n\t\t}\n\t\telse // stuff to do when reading a new character...\n\t\t{\n\t\t\t// make sure that a virgin '{' at the beginning of the file will be treated as a block...\n\t\t\tif (isInVirginLine && currentChar == '{'\n\t\t\t        && currentLineBeginsWithBracket\n\t\t\t        && previousCommandChar == ' ')\n\t\t\t\tpreviousCommandChar = '{';\n\t\t\tif (isInClassInitializer\n\t\t\t        && isBracketType(bracketTypeStack->back(), COMMAND_TYPE))\n\t\t\t\tisInClassInitializer = false;\n\t\t\tif (isInHorstmannRunIn)\n\t\t\t\tisInLineBreak = false;\n\t\t\tif (!isWhiteSpace(currentChar))\n\t\t\t\tisInHorstmannRunIn = false;\n\t\t\tisPreviousCharPostComment = isCharImmediatelyPostComment;\n\t\t\tisCharImmediatelyPostComment = false;\n\t\t\tisCharImmediatelyPostTemplate = false;\n\t\t\tisCharImmediatelyPostReturn = false;\n\t\t\tisCharImmediatelyPostThrow = false;\n\t\t\tisCharImmediatelyPostOperator = false;\n\t\t\tisCharImmediatelyPostPointerOrReference = false;\n\t\t\tisCharImmediatelyPostOpenBlock = false;\n\t\t\tisCharImmediatelyPostCloseBlock = false;\n\t\t}\n\n\t\tif ((lineIsLineCommentOnly || lineIsCommentOnly)\n\t\t        && currentLine.find(\"*INDENT-ON*\", charNum) != string::npos\n\t\t        && isFormattingModeOff)\n\t\t{\n\t\t\tisFormattingModeOff = false;\n\t\t\tbreakLine();\n\t\t\tformattedLine = currentLine;\n\t\t\tcharNum = (int) currentLine.length() - 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (isFormattingModeOff)\n\t\t{\n\t\t\tbreakLine();\n\t\t\tformattedLine = currentLine;\n\t\t\tcharNum = (int) currentLine.length() - 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif ((lineIsLineCommentOnly || lineIsCommentOnly)\n\t\t        && currentLine.find(\"*INDENT-OFF*\", charNum) != string::npos)\n\t\t{\n\t\t\tisFormattingModeOff = true;\n\t\t\tif (isInLineBreak)\t\t\t// is true if not the first line\n\t\t\t\tbreakLine();\n\t\t\tformattedLine = currentLine;\n\t\t\tcharNum = (int)currentLine.length() - 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (shouldBreakLineAtNextChar)\n\t\t{\n\t\t\tif (isWhiteSpace(currentChar) && !lineIsEmpty)\n\t\t\t\tcontinue;\n\t\t\tisInLineBreak = true;\n\t\t\tshouldBreakLineAtNextChar = false;\n\t\t}\n\n\t\tif (isInExecSQL && !passedSemicolon)\n\t\t{\n\t\t\tif (currentChar == ';')\n\t\t\t\tpassedSemicolon = true;\n\t\t\tappendCurrentChar();\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isInLineComment)\n\t\t{\n\t\t\tformatLineCommentBody();\n\t\t\tcontinue;\n\t\t}\n\t\telse if (isInComment)\n\t\t{\n\t\t\tformatCommentBody();\n\t\t\tcontinue;\n\t\t}\n\n\t\telse if (isInQuote)\n\t\t{\n\t\t\tformatQuoteBody();\n\t\t\tcontinue;\n\t\t}\n\n\t\t// not in quote or comment or line comment\n\n\t\tif (isSequenceReached(\"//\"))\n\t\t{\n\t\t\tformatLineCommentOpener();\n\t\t\ttestForTimeToSplitFormattedLine();\n\t\t\tcontinue;\n\t\t}\n\t\telse if (isSequenceReached(\"/*\"))\n\t\t{\n\t\t\tformatCommentOpener();\n\t\t\ttestForTimeToSplitFormattedLine();\n\t\t\tcontinue;\n\t\t}\n\t\telse if (currentChar == '\"' || currentChar == '\\'')\n\t\t{\n\t\t\tformatQuoteOpener();\n\t\t\ttestForTimeToSplitFormattedLine();\n\t\t\tcontinue;\n\t\t}\n\t\t// treat these preprocessor statements as a line comment\n\t\telse if (currentChar == '#'\n\t\t         && currentLine.find_first_not_of(\" \\t\") == (size_t) charNum)\n\t\t{\n\t\t\tstring preproc = trim(currentLine.c_str() + charNum + 1);\n\t\t\tif (preproc.length() > 0\n\t\t\t        && isCharPotentialHeader(preproc, 0)\n\t\t\t        && (findKeyword(preproc, 0, \"region\")\n\t\t\t            || findKeyword(preproc, 0, \"endregion\")\n\t\t\t            || findKeyword(preproc, 0, \"error\")\n\t\t\t            || findKeyword(preproc, 0, \"warning\")\n\t\t\t            || findKeyword(preproc, 0, \"line\")))\n\t\t\t{\n\t\t\t\tcurrentLine = rtrim(currentLine);\t// trim the end only\n\t\t\t\t// check for horstmann run-in\n\t\t\t\tif (formattedLine.length() > 0 && formattedLine[0] == '{')\n\t\t\t\t{\n\t\t\t\t\tisInLineBreak = true;\n\t\t\t\t\tisInHorstmannRunIn = false;\n\t\t\t\t}\n\t\t\t\tif (previousCommandChar == '}')\n\t\t\t\t\tcurrentHeader = NULL;\n\t\t\t\tisInLineComment = true;\n\t\t\t\tappendCurrentChar();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (isInPreprocessor)\n\t\t{\n\t\t\tappendCurrentChar();\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isInTemplate && shouldCloseTemplates)\n\t\t{\n\t\t\tif (previousCommandChar == '<' && isWhiteSpace(currentChar))\n\t\t\t\tcontinue;\n\t\t\tif (isWhiteSpace(currentChar) && peekNextChar() == '>')\n\t\t\t\tcontinue;\n\t\t}\n\n\t\tif (shouldRemoveNextClosingBracket && currentChar == '}')\n\t\t{\n\t\t\tcurrentLine[charNum] = currentChar = ' ';\n\t\t\tshouldRemoveNextClosingBracket = false;\n\t\t\tassert(adjustChecksumIn(-'}'));\n\t\t\t// if the line is empty, delete it\n\t\t\tif (currentLine.find_first_not_of(\" \\t\"))\n\t\t\t\tcontinue;\n\t\t}\n\n\t\t// handle white space - needed to simplify the rest.\n\t\tif (isWhiteSpace(currentChar))\n\t\t{\n\t\t\tappendCurrentChar();\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* not in MIDDLE of quote or comment or SQL or white-space of any type ... */\n\n\t\t// check if in preprocessor\n\t\t// ** isInPreprocessor will be automatically reset at the beginning\n\t\t//    of a new line in getnextChar()\n\t\tif (currentChar == '#')\n\t\t{\n\t\t\tisInPreprocessor = true;\n\t\t\t// check for horstmann run-in\n\t\t\tif (formattedLine.length() > 0 && formattedLine[0] == '{')\n\t\t\t{\n\t\t\t\tisInLineBreak = true;\n\t\t\t\tisInHorstmannRunIn = false;\n\t\t\t}\n\t\t\tprocessPreprocessor();\n\t\t\t// if top level it is potentially indentable\n\t\t\tif (shouldIndentPreprocBlock\n\t\t\t        && (isBracketType(bracketTypeStack->back(), NULL_TYPE)\n\t\t\t            || isBracketType(bracketTypeStack->back(), NAMESPACE_TYPE))\n\t\t\t        && !foundClassHeader\n\t\t\t        && !isInClassInitializer\n\t\t\t        && sourceIterator->tellg() > preprocBlockEnd)\n\t\t\t{\n\t\t\t\t// indent the #if preprocessor blocks\n\t\t\t\tstring preproc = ASBeautifier::extractPreprocessorStatement(currentLine);\n\t\t\t\tif (preproc.length() >= 2 && preproc.substr(0, 2) == \"if\") // #if, #ifdef, #ifndef\n\t\t\t\t{\n\t\t\t\t\tif (isImmediatelyPostPreprocessor)\n\t\t\t\t\t\tbreakLine();\n\t\t\t\t\tisIndentableProprocessorBlock = isIndentablePreprocessorBlock(currentLine, charNum);\n\t\t\t\t\tisIndentableProprocessor = isIndentableProprocessorBlock;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (isIndentableProprocessorBlock\n\t\t\t        && charNum < (int) currentLine.length() - 1\n\t\t\t        && isWhiteSpace(currentLine[charNum + 1]))\n\t\t\t{\n\t\t\t\tsize_t nextText = currentLine.find_first_not_of(\" \\t\", charNum + 1);\n\t\t\t\tif (nextText != string::npos)\n\t\t\t\t\tcurrentLine.erase(charNum + 1, nextText - charNum - 1);\n\t\t\t}\n\t\t\tif (isIndentableProprocessorBlock\n\t\t\t        && sourceIterator->tellg() >= preprocBlockEnd)\n\t\t\t\tisIndentableProprocessorBlock = false;\n\t\t\t//  need to fall thru here to reset the variables\n\t\t}\n\n\t\t/* not in preprocessor ... */\n\n\t\tif (isImmediatelyPostComment)\n\t\t{\n\t\t\tcaseHeaderFollowsComments = false;\n\t\t\tisImmediatelyPostComment = false;\n\t\t\tisCharImmediatelyPostComment = true;\n\t\t}\n\n\t\tif (isImmediatelyPostLineComment)\n\t\t{\n\t\t\tcaseHeaderFollowsComments = false;\n\t\t\tisImmediatelyPostLineComment = false;\n\t\t\tisCharImmediatelyPostLineComment = true;\n\t\t}\n\n\t\tif (isImmediatelyPostReturn)\n\t\t{\n\t\t\tisImmediatelyPostReturn = false;\n\t\t\tisCharImmediatelyPostReturn = true;\n\t\t}\n\n\t\tif (isImmediatelyPostThrow)\n\t\t{\n\t\t\tisImmediatelyPostThrow = false;\n\t\t\tisCharImmediatelyPostThrow = true;\n\t\t}\n\n\t\tif (isImmediatelyPostOperator)\n\t\t{\n\t\t\tisImmediatelyPostOperator = false;\n\t\t\tisCharImmediatelyPostOperator = true;\n\t\t}\n\t\tif (isImmediatelyPostTemplate)\n\t\t{\n\t\t\tisImmediatelyPostTemplate = false;\n\t\t\tisCharImmediatelyPostTemplate = true;\n\t\t}\n\t\tif (isImmediatelyPostPointerOrReference)\n\t\t{\n\t\t\tisImmediatelyPostPointerOrReference = false;\n\t\t\tisCharImmediatelyPostPointerOrReference = true;\n\t\t}\n\n\t\t// reset isImmediatelyPostHeader information\n\t\tif (isImmediatelyPostHeader)\n\t\t{\n\t\t\t// should brackets be added\n\t\t\tif (currentChar != '{' && shouldAddBrackets)\n\t\t\t{\n\t\t\t\tbool bracketsAdded = addBracketsToStatement();\n\t\t\t\tif (bracketsAdded && !shouldAddOneLineBrackets)\n\t\t\t\t{\n\t\t\t\t\tsize_t firstText = currentLine.find_first_not_of(\" \\t\");\n\t\t\t\t\tassert(firstText != string::npos);\n\t\t\t\t\tif ((int) firstText == charNum)\n\t\t\t\t\t\tbreakCurrentOneLineBlock = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// should brackets be removed\n\t\t\telse if (currentChar == '{' && shouldRemoveBrackets)\n\t\t\t{\n\t\t\t\tbool bracketsRemoved = removeBracketsFromStatement();\n\t\t\t\tif (bracketsRemoved)\n\t\t\t\t{\n\t\t\t\t\tshouldRemoveNextClosingBracket = true;\n\t\t\t\t\tif (isBeforeAnyLineEndComment(charNum))\n\t\t\t\t\t\tspacePadNum--;\n\t\t\t\t\telse if (shouldBreakOneLineBlocks\n\t\t\t\t\t         || (currentLineBeginsWithBracket\n\t\t\t\t\t             && currentLine.find_first_not_of(\" \\t\") != string::npos))\n\t\t\t\t\t\tshouldBreakLineAtNextChar = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// break 'else-if' if shouldBreakElseIfs is requested\n\t\t\tif (shouldBreakElseIfs\n\t\t\t        && currentHeader == &AS_ELSE\n\t\t\t        && isOkToBreakBlock(bracketTypeStack->back())\n\t\t\t        && !isBeforeAnyComment()\n\t\t\t        && (shouldBreakOneLineStatements || !isHeaderInMultiStatementLine))\n\t\t\t{\n\t\t\t\tstring nextText = peekNextText(currentLine.substr(charNum));\n\t\t\t\tif (nextText.length() > 0\n\t\t\t\t        && isCharPotentialHeader(nextText, 0)\n\t\t\t\t        && ASBeautifier::findHeader(nextText, 0, headers) == &AS_IF)\n\t\t\t\t{\n\t\t\t\t\tisInLineBreak = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tisImmediatelyPostHeader = false;\n\t\t}\n\n\t\tif (passedSemicolon)    // need to break the formattedLine\n\t\t{\n\t\t\tpassedSemicolon = false;\n\t\t\tif (parenStack->back() == 0 && !isCharImmediatelyPostComment && currentChar != ';') // allow ;;\n\t\t\t{\n\t\t\t\t// does a one-line block have ending comments?\n\t\t\t\tif (isBracketType(bracketTypeStack->back(), SINGLE_LINE_TYPE))\n\t\t\t\t{\n\t\t\t\t\tsize_t blockEnd = currentLine.rfind(AS_CLOSE_BRACKET);\n\t\t\t\t\tassert(blockEnd != string::npos);\n\t\t\t\t\t// move ending comments to this formattedLine\n\t\t\t\t\tif (isBeforeAnyLineEndComment(blockEnd))\n\t\t\t\t\t{\n\t\t\t\t\t\tsize_t commentStart = currentLine.find_first_not_of(\" \\t\", blockEnd + 1);\n\t\t\t\t\t\tassert(commentStart != string::npos);\n\t\t\t\t\t\tassert((currentLine.compare(commentStart, 2, \"//\") == 0)\n\t\t\t\t\t\t       || (currentLine.compare(commentStart, 2, \"/*\") == 0));\n\t\t\t\t\t\tsize_t commentLength = currentLine.length() - commentStart;\n\t\t\t\t\t\tformattedLine.append(getIndentLength() - 1, ' ');\n\t\t\t\t\t\tformattedLine.append(currentLine, commentStart, commentLength);\n\t\t\t\t\t\tcurrentLine.erase(commentStart, commentLength);\n\t\t\t\t\t\ttestForTimeToSplitFormattedLine();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tisInExecSQL = false;\n\t\t\t\tshouldReparseCurrentChar = true;\n\t\t\t\tif (formattedLine.find_first_not_of(\" \\t\") != string::npos)\n\t\t\t\t\tisInLineBreak = true;\n\t\t\t\tif (needHeaderOpeningBracket)\n\t\t\t\t{\n\t\t\t\t\tisCharImmediatelyPostCloseBlock = true;\n\t\t\t\t\tneedHeaderOpeningBracket = false;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (passedColon)\n\t\t{\n\t\t\tpassedColon = false;\n\t\t\tif (parenStack->back() == 0\n\t\t\t        && !isBeforeAnyComment()\n\t\t\t        && (formattedLine.find_first_not_of(\" \\t\") != string::npos))\n\t\t\t{\n\t\t\t\tshouldReparseCurrentChar = true;\n\t\t\t\tisInLineBreak = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\t// Check if in template declaration, e.g. foo<bar> or foo<bar,fig>\n\t\tif (!isInTemplate && currentChar == '<')\n\t\t{\n\t\t\tcheckIfTemplateOpener();\n\t\t}\n\n\t\t// handle parens\n\t\tif (currentChar == '(' || currentChar == '[' || (isInTemplate && currentChar == '<'))\n\t\t{\n\t\t\tquestionMarkStack->push_back(foundQuestionMark);\n\t\t\tfoundQuestionMark = false;\n\t\t\tparenStack->back()++;\n\t\t\tif (currentChar == '[')\n\t\t\t\t++squareBracketCount;\n\t\t}\n\t\telse if (currentChar == ')' || currentChar == ']' || (isInTemplate && currentChar == '>'))\n\t\t{\n\t\t\tfoundPreCommandHeader = false;\n\t\t\tparenStack->back()--;\n\t\t\t// this can happen in preprocessor directives\n\t\t\tif (parenStack->back() < 0)\n\t\t\t\tparenStack->back() = 0;\n\t\t\tif (!questionMarkStack->empty())\n\t\t\t{\n\t\t\t\tfoundQuestionMark = questionMarkStack->back();\n\t\t\t\tquestionMarkStack->pop_back();\n\t\t\t}\n\t\t\tif (isInTemplate && currentChar == '>')\n\t\t\t{\n\t\t\t\ttemplateDepth--;\n\t\t\t\tif (templateDepth == 0)\n\t\t\t\t{\n\t\t\t\t\tisInTemplate = false;\n\t\t\t\t\tisImmediatelyPostTemplate = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// check if this parenthesis closes a header, e.g. if (...), while (...)\n\t\t\tif (isInHeader && parenStack->back() == 0)\n\t\t\t{\n\t\t\t\tisInHeader = false;\n\t\t\t\tisImmediatelyPostHeader = true;\n\t\t\t\tfoundQuestionMark = false;\n\t\t\t}\n\t\t\tif (currentChar == ']')\n\t\t\t{\n\t\t\t\t--squareBracketCount;\n\t\t\t\tif (squareBracketCount < 0)\n\t\t\t\t\tsquareBracketCount = 0;\n\t\t\t}\n\t\t\tif (currentChar == ')')\n\t\t\t{\n\t\t\t\tfoundCastOperator = false;\n\t\t\t\tif (parenStack->back() == 0)\n\t\t\t\t\tendOfAsmReached = true;\n\t\t\t}\n\t\t}\n\n\t\t// handle brackets\n\t\tif (currentChar == '{' || currentChar == '}')\n\t\t{\n\t\t\t// if appendOpeningBracket this was already done for the original bracket\n\t\t\tif (currentChar == '{' && !appendOpeningBracket)\n\t\t\t{\n\t\t\t\tBracketType newBracketType = getBracketType();\n\t\t\t\tfoundNamespaceHeader = false;\n\t\t\t\tfoundClassHeader = false;\n\t\t\t\tfoundStructHeader = false;\n\t\t\t\tfoundInterfaceHeader = false;\n\t\t\t\tfoundPreDefinitionHeader = false;\n\t\t\t\tfoundPreCommandHeader = false;\n\t\t\t\tfoundPreCommandMacro = false;\n\t\t\t\tisInPotentialCalculation = false;\n\t\t\t\tisInObjCMethodDefinition = false;\n\t\t\t\tisInObjCInterface = false;\n\t\t\t\tisInEnum = false;\n\t\t\t\tisJavaStaticConstructor = false;\n\t\t\t\tisCharImmediatelyPostNonInStmt = false;\n\t\t\t\tneedHeaderOpeningBracket = false;\n\t\t\t\tshouldKeepLineUnbroken = false;\n\n\t\t\t\tisPreviousBracketBlockRelated = !isBracketType(newBracketType, ARRAY_TYPE);\n\t\t\t\tbracketTypeStack->push_back(newBracketType);\n\t\t\t\tpreBracketHeaderStack->push_back(currentHeader);\n\t\t\t\tcurrentHeader = NULL;\n\t\t\t\tstructStack->push_back(isInIndentableStruct);\n\t\t\t\tif (isBracketType(newBracketType, STRUCT_TYPE) && isCStyle())\n\t\t\t\t\tisInIndentableStruct = isStructAccessModified(currentLine, charNum);\n\t\t\t\telse\n\t\t\t\t\tisInIndentableStruct = false;\n\t\t\t}\n\n\t\t\t// this must be done before the bracketTypeStack is popped\n\t\t\tBracketType bracketType = bracketTypeStack->back();\n\t\t\tbool isOpeningArrayBracket = (isBracketType(bracketType, ARRAY_TYPE)\n\t\t\t                              && bracketTypeStack->size() >= 2\n\t\t\t                              && !isBracketType((*bracketTypeStack)[bracketTypeStack->size() - 2], ARRAY_TYPE)\n\t\t\t                             );\n\n\t\t\tif (currentChar == '}')\n\t\t\t{\n\t\t\t\t// if a request has been made to append a post block empty line,\n\t\t\t\t// but the block exists immediately before a closing bracket,\n\t\t\t\t// then there is no need for the post block empty line.\n\t\t\t\tisAppendPostBlockEmptyLineRequested = false;\n\t\t\t\tbreakCurrentOneLineBlock = false;\n\t\t\t\tif (isInAsm)\n\t\t\t\t\tendOfAsmReached = true;\n\t\t\t\tisInAsmOneLine = isInQuote = false;\n\t\t\t\tshouldKeepLineUnbroken = false;\n\t\t\t\tsquareBracketCount = 0;\n\n\t\t\t\tif (bracketTypeStack->size() > 1)\n\t\t\t\t{\n\t\t\t\t\tpreviousBracketType = bracketTypeStack->back();\n\t\t\t\t\tbracketTypeStack->pop_back();\n\t\t\t\t\tisPreviousBracketBlockRelated = !isBracketType(bracketType, ARRAY_TYPE);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpreviousBracketType = NULL_TYPE;\n\t\t\t\t\tisPreviousBracketBlockRelated = false;\n\t\t\t\t}\n\n\t\t\t\tif (!preBracketHeaderStack->empty())\n\t\t\t\t{\n\t\t\t\t\tcurrentHeader = preBracketHeaderStack->back();\n\t\t\t\t\tpreBracketHeaderStack->pop_back();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tcurrentHeader = NULL;\n\n\t\t\t\tif (!structStack->empty())\n\t\t\t\t{\n\t\t\t\t\tisInIndentableStruct = structStack->back();\n\t\t\t\t\tstructStack->pop_back();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tisInIndentableStruct = false;\n\n\t\t\t\tif (isNonInStatementArray\n\t\t\t\t        && (!isBracketType(bracketTypeStack->back(), ARRAY_TYPE)\t// check previous bracket\n\t\t\t\t            || peekNextChar() == ';'))\t\t\t\t\t\t\t\t// check for \"};\" added V2.01\n\t\t\t\t\tisImmediatelyPostNonInStmt = true;\n\t\t\t}\n\n\t\t\t// format brackets\n\t\t\tappendOpeningBracket = false;\n\t\t\tif (isBracketType(bracketType, ARRAY_TYPE))\n\t\t\t{\n\t\t\t\tformatArrayBrackets(bracketType, isOpeningArrayBracket);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (currentChar == '{')\n\t\t\t\t\tformatOpeningBracket(bracketType);\n\t\t\t\telse\n\t\t\t\t\tformatClosingBracket(bracketType);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ((((previousCommandChar == '{' && isPreviousBracketBlockRelated)\n\t\t        || ((previousCommandChar == '}'\n\t\t             && !isImmediatelyPostEmptyBlock\n\t\t             && isPreviousBracketBlockRelated\n\t\t             && !isPreviousCharPostComment       // Fixes wrongly appended newlines after '}' immediately after comments\n\t\t             && peekNextChar() != ' '\n\t\t             && !isBracketType(previousBracketType, DEFINITION_TYPE))\n\t\t            && !isBracketType(bracketTypeStack->back(), DEFINITION_TYPE)))\n\t\t        && isOkToBreakBlock(bracketTypeStack->back()))\n\t\t        // check for array\n\t\t        || (previousCommandChar == '{'\t\t\t// added 9/30/2010\n\t\t            && isBracketType(bracketTypeStack->back(), ARRAY_TYPE)\n\t\t            && !isBracketType(bracketTypeStack->back(), SINGLE_LINE_TYPE)\n\t\t            && isNonInStatementArray))\n\t\t{\n\t\t\tisCharImmediatelyPostOpenBlock = (previousCommandChar == '{');\n\t\t\tisCharImmediatelyPostCloseBlock = (previousCommandChar == '}');\n\n\t\t\tif (isCharImmediatelyPostOpenBlock\n\t\t\t        && !isCharImmediatelyPostComment\n\t\t\t        && !isCharImmediatelyPostLineComment)\n\t\t\t{\n\t\t\t\tpreviousCommandChar = ' ';\n\n\t\t\t\tif (bracketFormatMode == NONE_MODE)\n\t\t\t\t{\n\t\t\t\t\tif (shouldBreakOneLineBlocks\n\t\t\t\t\t        && isBracketType(bracketTypeStack->back(), SINGLE_LINE_TYPE))\n\t\t\t\t\t\tisInLineBreak = true;\n\t\t\t\t\telse if (currentLineBeginsWithBracket)\n\t\t\t\t\t\tformatRunIn();\n\t\t\t\t\telse\n\t\t\t\t\t\tbreakLine();\n\t\t\t\t}\n\t\t\t\telse if (bracketFormatMode == RUN_IN_MODE\n\t\t\t\t         && currentChar != '#')\n\t\t\t\t\tformatRunIn();\n\t\t\t\telse\n\t\t\t\t\tisInLineBreak = true;\n\t\t\t}\n\t\t\telse if (isCharImmediatelyPostCloseBlock\n\t\t\t         && shouldBreakOneLineStatements\n\t\t\t         && (isLegalNameChar(currentChar) && currentChar != '.')\n\t\t\t         && !isCharImmediatelyPostComment)\n\t\t\t{\n\t\t\t\tpreviousCommandChar = ' ';\n\t\t\t\tisInLineBreak = true;\n\t\t\t}\n\t\t}\n\n\t\t// reset block handling flags\n\t\tisImmediatelyPostEmptyBlock = false;\n\n\t\t// look for headers\n\t\tbool isPotentialHeader = isCharPotentialHeader(currentLine, charNum);\n\n\t\tif (isPotentialHeader && !isInTemplate && !squareBracketCount)\n\t\t{\n\t\t\tisNonParenHeader = false;\n\t\t\tfoundClosingHeader = false;\n\t\t\tnewHeader = findHeader(headers);\n\n\t\t\t// Qt headers may be variables in C++\n\t\t\tif (newHeader == &AS_FOREVER || newHeader == &AS_FOREACH)\n\t\t\t{\n\t\t\t\tif (currentLine.find_first_of(\"=;\", charNum) != string::npos)\n\t\t\t\t\tnewHeader = NULL;\n\t\t\t}\n\n\t\t\tif (newHeader != NULL)\n\t\t\t{\n\t\t\t\tconst string* previousHeader;\n\n\t\t\t\t// recognize closing headers of do..while, if..else, try..catch..finally\n\t\t\t\tif ((newHeader == &AS_ELSE && currentHeader == &AS_IF)\n\t\t\t\t        || (newHeader == &AS_WHILE && currentHeader == &AS_DO)\n\t\t\t\t        || (newHeader == &AS_CATCH && currentHeader == &AS_TRY)\n\t\t\t\t        || (newHeader == &AS_CATCH && currentHeader == &AS_CATCH)\n\t\t\t\t        || (newHeader == &AS_FINALLY && currentHeader == &AS_TRY)\n\t\t\t\t        || (newHeader == &AS_FINALLY && currentHeader == &AS_CATCH)\n\t\t\t\t        || (newHeader == &_AS_FINALLY && currentHeader == &_AS_TRY)\n\t\t\t\t        || (newHeader == &_AS_EXCEPT && currentHeader == &_AS_TRY)\n\t\t\t\t        || (newHeader == &AS_SET && currentHeader == &AS_GET)\n\t\t\t\t        || (newHeader == &AS_REMOVE && currentHeader == &AS_ADD))\n\t\t\t\t\tfoundClosingHeader = true;\n\n\t\t\t\tpreviousHeader = currentHeader;\n\t\t\t\tcurrentHeader = newHeader;\n\t\t\t\tneedHeaderOpeningBracket = true;\n\n\t\t\t\t// is the previous statement on the same line?\n\t\t\t\tif ((previousNonWSChar == ';' || previousNonWSChar == ':')\n\t\t\t\t        && !isInLineBreak\n\t\t\t\t        && isOkToBreakBlock(bracketTypeStack->back()))\n\t\t\t\t{\n\t\t\t\t\t// if breaking lines, break the line at the header\n\t\t\t\t\t// except for multiple 'case' statements on a line\n\t\t\t\t\tif (maxCodeLength != string::npos\n\t\t\t\t\t        && previousHeader != &AS_CASE)\n\t\t\t\t\t\tisInLineBreak = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tisHeaderInMultiStatementLine = true;\n\t\t\t\t}\n\n\t\t\t\tif (foundClosingHeader && previousNonWSChar == '}')\n\t\t\t\t{\n\t\t\t\t\tif (isOkToBreakBlock(bracketTypeStack->back()))\n\t\t\t\t\t\tisLineBreakBeforeClosingHeader();\n\n\t\t\t\t\t// get the adjustment for a comment following the closing header\n\t\t\t\t\tif (isInLineBreak)\n\t\t\t\t\t\tnextLineSpacePadNum = getNextLineCommentAdjustment();\n\t\t\t\t\telse\n\t\t\t\t\t\tspacePadNum = getCurrentLineCommentAdjustment();\n\t\t\t\t}\n\n\t\t\t\t// check if the found header is non-paren header\n\t\t\t\tisNonParenHeader = findHeader(nonParenHeaders) != NULL;\n\n\t\t\t\t// join 'else if' statements\n\t\t\t\tif (currentHeader == &AS_IF && previousHeader == &AS_ELSE && isInLineBreak\n\t\t\t\t        && !shouldBreakElseIfs && !isCharImmediatelyPostLineComment)\n\t\t\t\t{\n\t\t\t\t\t// 'else' must be last thing on the line\n\t\t\t\t\tsize_t start = formattedLine.length() >= 6 ? formattedLine.length() - 6 : 0;\n\t\t\t\t\tif (formattedLine.find(AS_ELSE, start) != string::npos)\n\t\t\t\t\t{\n\t\t\t\t\t\tappendSpacePad();\n\t\t\t\t\t\tisInLineBreak = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tappendSequence(*currentHeader);\n\t\t\t\tgoForward(currentHeader->length() - 1);\n\t\t\t\t// if a paren-header is found add a space after it, if needed\n\t\t\t\t// this checks currentLine, appendSpacePad() checks formattedLine\n\t\t\t\t// in 'case' and C# 'catch' can be either a paren or non-paren header\n\t\t\t\tif (shouldPadHeader\n\t\t\t\t        && (!isNonParenHeader\n\t\t\t\t            || (currentHeader == &AS_CASE && peekNextChar() == '(')\n\t\t\t\t            || (currentHeader == &AS_CATCH && peekNextChar() == '('))\n\t\t\t\t        && charNum < (int) currentLine.length() - 1 && !isWhiteSpace(currentLine[charNum + 1]))\n\t\t\t\t\tappendSpacePad();\n\n\t\t\t\t// Signal that a header has been reached\n\t\t\t\t// *** But treat a closing while() (as in do...while)\n\t\t\t\t//     as if it were NOT a header since a closing while()\n\t\t\t\t//     should never have a block after it!\n\t\t\t\tif (currentHeader != &AS_CASE && currentHeader != &AS_DEFAULT\n\t\t\t\t        && !(foundClosingHeader && currentHeader == &AS_WHILE))\n\t\t\t\t{\n\t\t\t\t\tisInHeader = true;\n\n\t\t\t\t\t// in C# 'catch' and 'delegate' can be a paren or non-paren header\n\t\t\t\t\tif (isNonParenHeader && !isSharpStyleWithParen(currentHeader))\n\t\t\t\t\t{\n\t\t\t\t\t\tisImmediatelyPostHeader = true;\n\t\t\t\t\t\tisInHeader = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (shouldBreakBlocks\n\t\t\t\t        && isOkToBreakBlock(bracketTypeStack->back())\n\t\t\t\t        && !isHeaderInMultiStatementLine)\n\t\t\t\t{\n\t\t\t\t\tif (previousHeader == NULL\n\t\t\t\t\t        && !foundClosingHeader\n\t\t\t\t\t        && !isCharImmediatelyPostOpenBlock\n\t\t\t\t\t        && !isImmediatelyPostCommentOnly)\n\t\t\t\t\t{\n\t\t\t\t\t\tisPrependPostBlockEmptyLineRequested = true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (currentHeader == &AS_ELSE\n\t\t\t\t\t        || currentHeader == &AS_CATCH\n\t\t\t\t\t        || currentHeader == &AS_FINALLY\n\t\t\t\t\t        || foundClosingHeader)\n\t\t\t\t\t{\n\t\t\t\t\t\tisPrependPostBlockEmptyLineRequested = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (shouldBreakClosingHeaderBlocks\n\t\t\t\t\t        && isCharImmediatelyPostCloseBlock\n\t\t\t\t\t        && !isImmediatelyPostCommentOnly\n\t\t\t\t\t        && currentHeader != &AS_WHILE)    // closing do-while block\n\t\t\t\t\t{\n\t\t\t\t\t\tisPrependPostBlockEmptyLineRequested = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (currentHeader == &AS_CASE\n\t\t\t\t        || currentHeader == &AS_DEFAULT)\n\t\t\t\t\tisInCase = true;\n\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if ((newHeader = findHeader(preDefinitionHeaders)) != NULL\n\t\t\t         && parenStack->back() == 0\n\t\t\t         && !isInEnum)\t\t// not C++11 enum class\n\t\t\t{\n\t\t\t\tif (newHeader == &AS_NAMESPACE)\n\t\t\t\t\tfoundNamespaceHeader = true;\n\t\t\t\tif (newHeader == &AS_CLASS)\n\t\t\t\t\tfoundClassHeader = true;\n\t\t\t\tif (newHeader == &AS_STRUCT)\n\t\t\t\t\tfoundStructHeader = true;\n\t\t\t\tif (newHeader == &AS_INTERFACE)\n\t\t\t\t\tfoundInterfaceHeader = true;\n\t\t\t\tfoundPreDefinitionHeader = true;\n\t\t\t\tappendSequence(*newHeader);\n\t\t\t\tgoForward(newHeader->length() - 1);\n\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if ((newHeader = findHeader(preCommandHeaders)) != NULL)\n\t\t\t{\n\t\t\t\t// a 'const' variable is not a preCommandHeader\n\t\t\t\tif (previousNonWSChar != ';'\n\t\t\t\t        && previousNonWSChar != '{'\n\t\t\t\t        && getPreviousWord(currentLine, charNum) != AS_STATIC)\n\t\t\t\t\tfoundPreCommandHeader = true;\n\t\t\t}\n\t\t\telse if ((newHeader = findHeader(castOperators)) != NULL)\n\t\t\t{\n\t\t\t\tfoundCastOperator = true;\n\t\t\t\tappendSequence(*newHeader);\n\t\t\t\tgoForward(newHeader->length() - 1);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}   // (isPotentialHeader && !isInTemplate)\n\n\t\tif (isInLineBreak)          // OK to break line here\n\t\t{\n\t\t\tbreakLine();\n\t\t\tif (isInVirginLine)\t\t// adjust for the first line\n\t\t\t{\n\t\t\t\tlineCommentNoBeautify = lineCommentNoIndent;\n\t\t\t\tlineCommentNoIndent = false;\n\t\t\t\tif (isImmediatelyPostPreprocessor)\n\t\t\t\t{\n\t\t\t\t\tisInIndentablePreproc = isIndentableProprocessor;\n\t\t\t\t\tisIndentableProprocessor = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (previousNonWSChar == '}' || currentChar == ';')\n\t\t{\n\t\t\tif (currentChar == ';')\n\t\t\t{\n\t\t\t\tsquareBracketCount = 0;\n\n\t\t\t\tif (((shouldBreakOneLineStatements\n\t\t\t\t        || isBracketType(bracketTypeStack->back(), SINGLE_LINE_TYPE))\n\t\t\t\t        && isOkToBreakBlock(bracketTypeStack->back()))\n\t\t\t\t        && !(attachClosingBracketMode && peekNextChar() == '}'))\n\t\t\t\t{\n\t\t\t\t\tpassedSemicolon = true;\n\t\t\t\t}\n\n\t\t\t\t// append post block empty line for unbracketed header\n\t\t\t\tif (shouldBreakBlocks\n\t\t\t\t        && currentHeader != NULL\n\t\t\t\t        && currentHeader != &AS_CASE\n\t\t\t\t        && currentHeader != &AS_DEFAULT\n\t\t\t\t        && !isHeaderInMultiStatementLine\n\t\t\t\t        && parenStack->back() == 0)\n\t\t\t\t{\n\t\t\t\t\tisAppendPostBlockEmptyLineRequested = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (currentChar != ';'\n\t\t\t        || (needHeaderOpeningBracket && parenStack->back() == 0))\n\t\t\t\tcurrentHeader = NULL;\n\t\t\tresetEndOfStatement();\n\t\t}\n\n\t\tif (currentChar == ':'\n\t\t        && previousChar != ':'         // not part of '::'\n\t\t        && peekNextChar() != ':')      // not part of '::'\n\t\t{\n\t\t\tif (isInCase)\n\t\t\t{\n\t\t\t\tisInCase = false;\n\t\t\t\tif (shouldBreakOneLineStatements)\n\t\t\t\t\tpassedColon = true;\n\t\t\t}\n\t\t\telse if (isCStyle()                     // for C/C++ only\n\t\t\t         && isOkToBreakBlock(bracketTypeStack->back())\n\t\t\t         && shouldBreakOneLineStatements\n\t\t\t         && !foundQuestionMark          // not in a ?: sequence\n\t\t\t         && !foundPreDefinitionHeader   // not in a definition block (e.g. class foo : public bar\n\t\t\t         && previousCommandChar != ')'  // not immediately after closing paren of a method header, e.g. ASFormatter::ASFormatter(...) : ASBeautifier(...)\n\t\t\t         && !foundPreCommandHeader      // not after a 'noexcept'\n\t\t\t         && !squareBracketCount         // not in objC method call\n\t\t\t         && !isInObjCMethodDefinition   // not objC '-' or '+' method\n\t\t\t         && !isInObjCInterface          // not objC @interface\n\t\t\t         && !isInObjCSelector           // not objC @selector\n\t\t\t         && !isDigit(peekNextChar())    // not a bit field\n\t\t\t         && !isInEnum                   // not an enum with a base type\n\t\t\t         && !isInAsm                    // not in extended assembler\n\t\t\t         && !isInAsmOneLine             // not in extended assembler\n\t\t\t         && !isInAsmBlock)              // not in extended assembler\n\t\t\t{\n\t\t\t\tpassedColon = true;\n\t\t\t}\n\n\t\t\tif (isCStyle()\n\t\t\t        && shouldPadMethodColon\n\t\t\t        && (squareBracketCount > 0 || isInObjCMethodDefinition || isInObjCSelector)\n\t\t\t        && !foundQuestionMark)\t\t\t// not in a ?: sequence\n\t\t\t\tpadObjCMethodColon();\n\n\t\t\tif (isInObjCInterface)\n\t\t\t{\n\t\t\t\tappendSpacePad();\n\t\t\t\tif ((int) currentLine.length() > charNum + 1 && !isWhiteSpace(currentLine[charNum + 1]))\n\t\t\t\t\tcurrentLine.insert(charNum + 1, \" \");\n\t\t\t}\n\n\t\t\tif (isClassInitializer())\n\t\t\t\tisInClassInitializer = true;\n\t\t}\n\n\t\tif (currentChar == '?')\n\t\t\tfoundQuestionMark = true;\n\n\t\tif (isPotentialHeader && !isInTemplate)\n\t\t{\n\t\t\tif (findKeyword(currentLine, charNum, AS_NEW))\n\t\t\t\tisInPotentialCalculation = false;\n\n\t\t\tif (findKeyword(currentLine, charNum, AS_RETURN))\n\t\t\t{\n\t\t\t\tisInPotentialCalculation = true;\t// return is the same as an = sign\n\t\t\t\tisImmediatelyPostReturn = true;\n\t\t\t}\n\n\t\t\tif (findKeyword(currentLine, charNum, AS_OPERATOR))\n\t\t\t\tisImmediatelyPostOperator = true;\n\n\t\t\tif (findKeyword(currentLine, charNum, AS_ENUM))\n\t\t\t{\n\t\t\t\tsize_t firstNum = currentLine.find_first_of(\"(){},/\");\n\t\t\t\tif (firstNum == string::npos\n\t\t\t\t        || currentLine[firstNum] == '{'\n\t\t\t\t        || currentLine[firstNum] == '/')\n\t\t\t\t\tisInEnum = true;\n\t\t\t}\n\n\t\t\tif (isCStyle()\n\t\t\t        && findKeyword(currentLine, charNum, AS_THROW)\n\t\t\t        && previousCommandChar != ')'\n\t\t\t        && !foundPreCommandHeader)      // 'const' throw()\n\t\t\t\tisImmediatelyPostThrow = true;\n\n\t\t\tif (isCStyle() && findKeyword(currentLine, charNum, AS_EXTERN) && isExternC())\n\t\t\t\tisInExternC = true;\n\n\t\t\t// Objective-C NSException macros are preCommandHeaders\n\t\t\tif (isCStyle() && findKeyword(currentLine, charNum, AS_NS_DURING))\n\t\t\t\tfoundPreCommandMacro = true;\n\t\t\tif (isCStyle() && findKeyword(currentLine, charNum, AS_NS_HANDLER))\n\t\t\t\tfoundPreCommandMacro = true;\n\n\t\t\tif (isCStyle() && isExecSQL(currentLine, charNum))\n\t\t\t\tisInExecSQL = true;\n\n\t\t\tif (isCStyle())\n\t\t\t{\n\t\t\t\tif (findKeyword(currentLine, charNum, AS_ASM)\n\t\t\t\t        || findKeyword(currentLine, charNum, AS__ASM__))\n\t\t\t\t{\n\t\t\t\t\tisInAsm = true;\n\t\t\t\t}\n\t\t\t\telse if (findKeyword(currentLine, charNum, AS_MS_ASM)\t\t// microsoft specific\n\t\t\t\t         || findKeyword(currentLine, charNum, AS_MS__ASM))\n\t\t\t\t{\n\t\t\t\t\tint index = 4;\n\t\t\t\t\tif (peekNextChar() == '_')\t// check for __asm\n\t\t\t\t\t\tindex = 5;\n\n\t\t\t\t\tchar peekedChar = ASBase::peekNextChar(currentLine, charNum + index);\n\t\t\t\t\tif (peekedChar == '{' || peekedChar == ' ')\n\t\t\t\t\t\tisInAsmBlock = true;\n\t\t\t\t\telse\n\t\t\t\t\t\tisInAsmOneLine = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isJavaStyle()\n\t\t\t        && (findKeyword(currentLine, charNum, AS_STATIC)\n\t\t\t            && isNextCharOpeningBracket(charNum + 6)))\n\t\t\t\tisJavaStaticConstructor = true;\n\n\t\t\tif (isSharpStyle()\n\t\t\t        && (findKeyword(currentLine, charNum, AS_DELEGATE)\n\t\t\t            || findKeyword(currentLine, charNum, AS_UNCHECKED)))\n\t\t\t\tisSharpDelegate = true;\n\n\t\t\t// append the entire name\n\t\t\tstring name = getCurrentWord(currentLine, charNum);\n\t\t\t// must pad the 'and' and 'or' operators if required\n\t\t\tif (name == \"and\" || name == \"or\")\n\t\t\t{\n\t\t\t\tif (shouldPadOperators && previousNonWSChar != ':')\n\t\t\t\t{\n\t\t\t\t\tappendSpacePad();\n\t\t\t\t\tappendOperator(name);\n\t\t\t\t\tgoForward(name.length() - 1);\n\t\t\t\t\tif (!isBeforeAnyComment()\n\t\t\t\t\t        && !(currentLine.compare(charNum + 1, 1, AS_SEMICOLON) == 0)\n\t\t\t\t\t        && !(currentLine.compare(charNum + 1, 2, AS_SCOPE_RESOLUTION) == 0))\n\t\t\t\t\t\tappendSpaceAfter();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tappendOperator(name);\n\t\t\t\t\tgoForward(name.length() - 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tappendSequence(name);\n\t\t\t\tgoForward(name.length() - 1);\n\t\t\t}\n\n\t\t\tcontinue;\n\n\t\t}   // (isPotentialHeader &&  !isInTemplate)\n\n\t\t// determine if this is an Objective-C statement\n\n\t\tif (currentChar == '@'\n\t\t        && isCharPotentialHeader(currentLine, charNum + 1)\n\t\t        && findKeyword(currentLine, charNum + 1, AS_INTERFACE)\n\t\t        && isBracketType(bracketTypeStack->back(), NULL_TYPE))\n\t\t{\n\t\t\tisInObjCInterface = true;\n\t\t\tstring name = '@' + AS_INTERFACE;\n\t\t\tappendSequence(name);\n\t\t\tgoForward(name.length() - 1);\n\t\t\tcontinue;\n\t\t}\n\t\telse if (currentChar == '@'\n\t\t         && isCharPotentialHeader(currentLine, charNum + 1)\n\t\t         && findKeyword(currentLine, charNum + 1, AS_SELECTOR))\n\t\t{\n\t\t\tisInObjCSelector = true;\n\t\t\tstring name = '@' + AS_SELECTOR;\n\t\t\tappendSequence(name);\n\t\t\tgoForward(name.length() - 1);\n\t\t\tcontinue;\n\t\t}\n\t\telse if ((currentChar == '-' || currentChar == '+')\n\t\t         && peekNextChar() == '('\n\t\t         && isBracketType(bracketTypeStack->back(), NULL_TYPE)\n\t\t         && !isInPotentialCalculation)\n\t\t{\n\t\t\tisInObjCMethodDefinition = true;\n\t\t\tisInObjCInterface = false;\n\t\t\tappendCurrentChar();\n\t\t\tif (shouldPadMethodPrefix || shouldUnPadMethodPrefix)\n\t\t\t{\n\t\t\t\tsize_t i = currentLine.find_first_not_of(\" \\t\", charNum + 1);\n\t\t\t\tif (i != string::npos)\n\t\t\t\t\tgoForward(i - charNum - 1);\n\t\t\t\tif (shouldPadMethodPrefix)\n\t\t\t\t\tappendSpaceAfter();\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\t// determine if this is a potential calculation\n\n\t\tbool isPotentialOperator = isCharPotentialOperator(currentChar);\n\t\tnewHeader = NULL;\n\n\t\tif (isPotentialOperator)\n\t\t{\n\t\t\tnewHeader = findOperator(operators);\n\n\t\t\t// check for Java ? wildcard\n\t\t\tif (newHeader == &AS_GCC_MIN_ASSIGN && isJavaStyle() && isInTemplate)\n\t\t\t\tnewHeader = NULL;\n\n\t\t\tif (newHeader != NULL)\n\t\t\t{\n\t\t\t\tif (newHeader == &AS_LAMBDA)\n\t\t\t\t\tfoundPreCommandHeader = true;\n\n\t\t\t\t// correct mistake of two >> closing a template\n\t\t\t\tif (isInTemplate && (newHeader == &AS_GR_GR || newHeader == &AS_GR_GR_GR))\n\t\t\t\t\tnewHeader = &AS_GR;\n\n\t\t\t\tif (!isInPotentialCalculation)\n\t\t\t\t{\n\t\t\t\t\t// must determine if newHeader is an assignment operator\n\t\t\t\t\t// do NOT use findOperator!!!\n\t\t\t\t\tif (find(assignmentOperators->begin(), assignmentOperators->end(), newHeader)\n\t\t\t\t\t        != assignmentOperators->end())\n\t\t\t\t\t{\n\t\t\t\t\t\tfoundPreCommandHeader = false;\n\t\t\t\t\t\tchar peekedChar = peekNextChar();\n\t\t\t\t\t\tisInPotentialCalculation = !(newHeader == &AS_EQUAL && peekedChar == '*')\n\t\t\t\t\t\t                           && !(newHeader == &AS_EQUAL && peekedChar == '&')\n\t\t\t\t\t\t                           && !isCharImmediatelyPostOperator;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// process pointers and references\n\t\t// check newHeader to eliminate things like '&&' sequence\n\t\tif (!isJavaStyle()\n\t\t        && (newHeader == &AS_MULT\n\t\t            || newHeader == &AS_BIT_AND\n\t\t            || newHeader == &AS_BIT_XOR\n\t\t            || newHeader == &AS_AND)\n\t\t        && isPointerOrReference())\n\t\t{\n\t\t\tif (!isDereferenceOrAddressOf() && !isOperatorPaddingDisabled())\n\t\t\t\tformatPointerOrReference();\n\t\t\telse\n\t\t\t{\n\t\t\t\tappendOperator(*newHeader);\n\t\t\t\tgoForward(newHeader->length() - 1);\n\t\t\t}\n\t\t\tisImmediatelyPostPointerOrReference = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (shouldPadOperators && newHeader != NULL && !isOperatorPaddingDisabled())\n\t\t{\n\t\t\tpadOperators(newHeader);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// pad commas and semi-colons\n\t\tif (currentChar == ';'\n\t\t        || (currentChar == ',' && shouldPadOperators))\n\t\t{\n\t\t\tchar nextChar = ' ';\n\t\t\tif (charNum + 1 < (int) currentLine.length())\n\t\t\t\tnextChar = currentLine[charNum + 1];\n\t\t\tif (!isWhiteSpace(nextChar)\n\t\t\t        && nextChar != '}'\n\t\t\t        && nextChar != ')'\n\t\t\t        && nextChar != ']'\n\t\t\t        && nextChar != '>'\n\t\t\t        && nextChar != ';'\n\t\t\t        && !isBeforeAnyComment()\n\t\t\t        /* && !(isBracketType(bracketTypeStack->back(), ARRAY_TYPE)) */\n\t\t\t   )\n\t\t\t{\n\t\t\t\tappendCurrentChar();\n\t\t\t\tappendSpaceAfter();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\t// do NOT use 'continue' after this, it must do padParens if necessary\n\t\tif (currentChar == '('\n\t\t        && shouldPadHeader\n\t\t        && (isCharImmediatelyPostReturn || isCharImmediatelyPostThrow))\n\t\t\tappendSpacePad();\n\n\t\tif ((currentChar == '(' || currentChar == ')')\n\t\t        && (shouldPadParensOutside || shouldPadParensInside || shouldUnPadParens || shouldPadFirstParen))\n\t\t{\n\t\t\tpadParens();\n\t\t\tcontinue;\n\t\t}\n\n\t\t// bypass the entire operator\n\t\tif (newHeader != NULL)\n\t\t{\n\t\t\tappendOperator(*newHeader);\n\t\t\tgoForward(newHeader->length() - 1);\n\t\t\tcontinue;\n\t\t}\n\n\t\tappendCurrentChar();\n\n\t}   // end of while loop  *  end of while loop  *  end of while loop  *  end of while loop\n\n\t// return a beautified (i.e. correctly indented) line.\n\n\tstring beautifiedLine;\n\tsize_t readyFormattedLineLength = trim(readyFormattedLine).length();\n\tbool isInNamespace = isBracketType(bracketTypeStack->back(), NAMESPACE_TYPE);\n\n\tif (prependEmptyLine\t\t// prepend a blank line before this formatted line\n\t        && readyFormattedLineLength > 0\n\t        && previousReadyFormattedLineLength > 0)\n\t{\n\t\tisLineReady = true;\t\t// signal a waiting readyFormattedLine\n\t\tbeautifiedLine = beautify(\"\");\n\t\tpreviousReadyFormattedLineLength = 0;\n\t\t// call the enhancer for new empty lines\n\t\tenhancer->enhance(beautifiedLine, isInNamespace, isInPreprocessorBeautify, isInBeautifySQL);\n\t}\n\telse\t\t// format the current formatted line\n\t{\n\t\tisLineReady = false;\n\t\thorstmannIndentInStatement = horstmannIndentChars;\n\t\tbeautifiedLine = beautify(readyFormattedLine);\n\t\tpreviousReadyFormattedLineLength = readyFormattedLineLength;\n\t\t// the enhancer is not called for no-indent line comments\n\t\tif (!lineCommentNoBeautify && !isFormattingModeOff)\n\t\t\tenhancer->enhance(beautifiedLine, isInNamespace, isInPreprocessorBeautify, isInBeautifySQL);\n\t\thorstmannIndentChars = 0;\n\t\tlineCommentNoBeautify = lineCommentNoIndent;\n\t\tlineCommentNoIndent = false;\n\t\tisInIndentablePreproc = isIndentableProprocessor;\n\t\tisIndentableProprocessor = false;\n\t\tisElseHeaderIndent = elseHeaderFollowsComments;\n\t\tisCaseHeaderCommentIndent = caseHeaderFollowsComments;\n\t\tif (isCharImmediatelyPostNonInStmt)\n\t\t{\n\t\t\tisNonInStatementArray = false;\n\t\t\tisCharImmediatelyPostNonInStmt = false;\n\t\t}\n\t\tisInPreprocessorBeautify = isInPreprocessor;\t// used by ASEnhancer\n\t\tisInBeautifySQL = isInExecSQL;\t\t\t\t\t// used by ASEnhancer\n\t}\n\n\tprependEmptyLine = false;\n\tassert(computeChecksumOut(beautifiedLine));\n\treturn beautifiedLine;\n}\n\n/**\n * check if there are any indented lines ready to be read by nextLine()\n *\n * @return    are there any indented lines ready?\n */\nbool ASFormatter::hasMoreLines() const\n{\n\treturn !endOfCodeReached;\n}\n\n/**\n * comparison function for BracketType enum\n */\nbool ASFormatter::isBracketType(BracketType a, BracketType b) const\n{\n\tif (a == NULL_TYPE || b == NULL_TYPE)\n\t\treturn (a == b);\n\treturn ((a & b) == b);\n}\n\n/**\n * set the formatting style.\n *\n * @param style         the formatting style.\n */\nvoid ASFormatter::setFormattingStyle(FormatStyle style)\n{\n\tformattingStyle = style;\n}\n\n/**\n * set the add brackets mode.\n * options:\n *    true     brackets added to headers for single line statements.\n *    false    brackets NOT added to headers for single line statements.\n *\n * @param state         the add brackets state.\n */\nvoid ASFormatter::setAddBracketsMode(bool state)\n{\n\tshouldAddBrackets = state;\n}\n\n/**\n * set the add one line brackets mode.\n * options:\n *    true     one line brackets added to headers for single line statements.\n *    false    one line brackets NOT added to headers for single line statements.\n *\n * @param state         the add one line brackets state.\n */\nvoid ASFormatter::setAddOneLineBracketsMode(bool state)\n{\n\tshouldAddBrackets = state;\n\tshouldAddOneLineBrackets = state;\n}\n\n/**\n * set the remove brackets mode.\n * options:\n *    true     brackets removed from headers for single line statements.\n *    false    brackets NOT removed from headers for single line statements.\n *\n * @param state         the remove brackets state.\n */\nvoid ASFormatter::setRemoveBracketsMode(bool state)\n{\n\tshouldRemoveBrackets = state;\n}\n\n/**\n * set the bracket formatting mode.\n * options:\n *\n * @param mode         the bracket formatting mode.\n */\nvoid ASFormatter::setBracketFormatMode(BracketMode mode)\n{\n\tbracketFormatMode = mode;\n}\n\n/**\n * set 'break after' mode for maximum code length\n *\n * @param state         the 'break after' mode.\n */\nvoid ASFormatter::setBreakAfterMode(bool state)\n{\n\tshouldBreakLineAfterLogical = state;\n}\n\n/**\n * set closing header bracket breaking mode\n * options:\n *    true     brackets just before closing headers (e.g. 'else', 'catch')\n *             will be broken, even if standard brackets are attached.\n *    false    closing header brackets will be treated as standard brackets.\n *\n * @param state         the closing header bracket breaking mode.\n */\nvoid ASFormatter::setBreakClosingHeaderBracketsMode(bool state)\n{\n\tshouldBreakClosingHeaderBrackets = state;\n}\n\n/**\n * set 'else if()' breaking mode\n * options:\n *    true     'else' headers will be broken from their succeeding 'if' headers.\n *    false    'else' headers will be attached to their succeeding 'if' headers.\n *\n * @param state         the 'else if()' breaking mode.\n */\nvoid ASFormatter::setBreakElseIfsMode(bool state)\n{\n\tshouldBreakElseIfs = state;\n}\n\n/**\n * set maximum code length\n *\n * @param max         the maximum code length.\n */\nvoid ASFormatter::setMaxCodeLength(int max)\n{\n\tmaxCodeLength = max;\n}\n\n/**\n * set operator padding mode.\n * options:\n *    true     statement operators will be padded with spaces around them.\n *    false    statement operators will not be padded.\n *\n * @param state         the padding mode.\n */\nvoid ASFormatter::setOperatorPaddingMode(bool state)\n{\n\tshouldPadOperators = state;\n}\n\n/**\n * set parenthesis outside padding mode.\n * options:\n *    true     statement parentheses will be padded with spaces around them.\n *    false    statement parentheses will not be padded.\n *\n * @param state         the padding mode.\n */\nvoid ASFormatter::setParensOutsidePaddingMode(bool state)\n{\n\tshouldPadParensOutside = state;\n}\n\n/**\n * set parenthesis inside padding mode.\n * options:\n *    true     statement parenthesis will be padded with spaces around them.\n *    false    statement parenthesis will not be padded.\n *\n * @param state         the padding mode.\n */\nvoid ASFormatter::setParensInsidePaddingMode(bool state)\n{\n\tshouldPadParensInside = state;\n}\n\n/**\n * set padding mode before one or more open parentheses.\n * options:\n *    true     first open parenthesis will be padded with a space before.\n *    false    first open parenthesis will not be padded.\n *\n * @param state         the padding mode.\n */\nvoid ASFormatter::setParensFirstPaddingMode(bool state)\n{\n\tshouldPadFirstParen = state;\n}\n\n/**\n * set header padding mode.\n * options:\n *    true     headers will be padded with spaces around them.\n *    false    headers will not be padded.\n *\n * @param state         the padding mode.\n */\nvoid ASFormatter::setParensHeaderPaddingMode(bool state)\n{\n\tshouldPadHeader = state;\n}\n\n/**\n * set parenthesis unpadding mode.\n * options:\n *    true     statement parenthesis will be unpadded with spaces removed around them.\n *    false    statement parenthesis will not be unpadded.\n *\n * @param state         the padding mode.\n */\nvoid ASFormatter::setParensUnPaddingMode(bool state)\n{\n\tshouldUnPadParens = state;\n}\n\n/**\n* set the state of the preprocessor indentation option.\n* If true, #ifdef blocks at level 0 will be indented.\n*\n* @param   state             state of option.\n*/\nvoid ASFormatter::setPreprocBlockIndent(bool state)\n{\n\tshouldIndentPreprocBlock = state;\n}\n\n/**\n * Set strip comment prefix mode.\n * options:\n *    true     strip leading '*' in a comment.\n *    false    leading '*' in a comment will be left unchanged.\n *\n * @param state         the strip comment prefix mode.\n */\nvoid ASFormatter::setStripCommentPrefix(bool state)\n{\n\tshouldStripCommentPrefix = state;\n}\n\n/**\n * set objective-c '-' or '+' class prefix padding mode.\n * options:\n *    true     class prefix will be padded a spaces after them.\n *    false    class prefix will be left unchanged.\n *\n * @param state         the padding mode.\n */\nvoid ASFormatter::setMethodPrefixPaddingMode(bool state)\n{\n\tshouldPadMethodPrefix = state;\n}\n\n/**\n * set objective-c '-' or '+' class prefix unpadding mode.\n * options:\n *    true     class prefix will be unpadded with spaces after them removed.\n *    false    class prefix will left unchanged.\n *\n * @param state         the unpadding mode.\n */\nvoid ASFormatter::setMethodPrefixUnPaddingMode(bool state)\n{\n\tshouldUnPadMethodPrefix = state;\n}\n\n/**\n * set objective-c method colon padding mode.\n *\n * @param mode         objective-c colon padding mode.\n */\nvoid ASFormatter::setObjCColonPaddingMode(ObjCColonPad mode)\n{\n\tshouldPadMethodColon = true;\n\tobjCColonPadMode = mode;\n}\n\n/**\n * set option to attach closing brackets\n *\n * @param state        true = attach, false = don't attach.\n */\nvoid ASFormatter::setAttachClosingBracketMode(bool state)\n{\n\tattachClosingBracketMode = state;\n}\n\n/**\n * set option to attach class brackets\n *\n * @param state        true = attach, false = use style default.\n */\nvoid ASFormatter::setAttachClass(bool state)\n{\n\tshouldAttachClass = state;\n}\n\n/**\n * set option to attach extern \"C\" brackets\n *\n * @param state        true = attach, false = use style default.\n */\nvoid ASFormatter::setAttachExternC(bool state)\n{\n\tshouldAttachExternC = state;\n}\n\n/**\n * set option to attach namespace brackets\n *\n * @param state        true = attach, false = use style default.\n */\nvoid ASFormatter::setAttachNamespace(bool state)\n{\n\tshouldAttachNamespace = state;\n}\n\n/**\n * set option to attach inline brackets\n *\n * @param state        true = attach, false = use style default.\n */\nvoid ASFormatter::setAttachInline(bool state)\n{\n\tshouldAttachInline = state;\n}\n\n/**\n * set option to break/not break one-line blocks\n *\n * @param state        true = break, false = don't break.\n */\nvoid ASFormatter::setBreakOneLineBlocksMode(bool state)\n{\n\tshouldBreakOneLineBlocks = state;\n}\n\nvoid ASFormatter::setCloseTemplatesMode(bool state)\n{\n\tshouldCloseTemplates = state;\n}\n\n/**\n * set option to break/not break lines consisting of multiple statements.\n *\n * @param state        true = break, false = don't break.\n */\nvoid ASFormatter::setSingleStatementsMode(bool state)\n{\n\tshouldBreakOneLineStatements = state;\n}\n\n/**\n * set option to convert tabs to spaces.\n *\n * @param state        true = convert, false = don't convert.\n */\nvoid ASFormatter::setTabSpaceConversionMode(bool state)\n{\n\tshouldConvertTabs = state;\n}\n\n/**\n * set option to indent comments in column 1.\n *\n * @param state        true = indent, false = don't indent.\n */\nvoid ASFormatter::setIndentCol1CommentsMode(bool state)\n{\n\tshouldIndentCol1Comments = state;\n}\n\n/**\n * set option to force all line ends to a particular style.\n *\n * @param fmt           format enum value\n */\nvoid ASFormatter::setLineEndFormat(LineEndFormat fmt)\n{\n\tlineEnd = fmt;\n}\n\n/**\n * set option to break unrelated blocks of code with empty lines.\n *\n * @param state        true = convert, false = don't convert.\n */\nvoid ASFormatter::setBreakBlocksMode(bool state)\n{\n\tshouldBreakBlocks = state;\n}\n\n/**\n * set option to break closing header blocks of code (such as 'else', 'catch', ...) with empty lines.\n *\n * @param state        true = convert, false = don't convert.\n */\nvoid ASFormatter::setBreakClosingHeaderBlocksMode(bool state)\n{\n\tshouldBreakClosingHeaderBlocks = state;\n}\n\n/**\n * set option to delete empty lines.\n *\n * @param state        true = delete, false = don't delete.\n */\nvoid ASFormatter::setDeleteEmptyLinesMode(bool state)\n{\n\tshouldDeleteEmptyLines = state;\n}\n\n/**\n * set the pointer alignment.\n *\n * @param alignment    the pointer alignment.\n */\nvoid ASFormatter::setPointerAlignment(PointerAlign alignment)\n{\n\tpointerAlignment = alignment;\n}\n\nvoid ASFormatter::setReferenceAlignment(ReferenceAlign alignment)\n{\n\treferenceAlignment = alignment;\n}\n\n/**\n * jump over several characters.\n *\n * @param i       the number of characters to jump over.\n */\nvoid ASFormatter::goForward(int i)\n{\n\twhile (--i >= 0)\n\t\tgetNextChar();\n}\n\n/**\n * peek at the next unread character.\n *\n * @return     the next unread character.\n */\nchar ASFormatter::peekNextChar() const\n{\n\tchar ch = ' ';\n\tsize_t peekNum = currentLine.find_first_not_of(\" \\t\", charNum + 1);\n\n\tif (peekNum == string::npos)\n\t\treturn ch;\n\n\tch = currentLine[peekNum];\n\n\treturn ch;\n}\n\n/**\n * check if current placement is before a comment\n *\n * @return     is before a comment.\n */\nbool ASFormatter::isBeforeComment() const\n{\n\tbool foundComment = false;\n\tsize_t peekNum = currentLine.find_first_not_of(\" \\t\", charNum + 1);\n\n\tif (peekNum == string::npos)\n\t\treturn foundComment;\n\n\tfoundComment = (currentLine.compare(peekNum, 2, \"/*\") == 0);\n\n\treturn foundComment;\n}\n\n/**\n * check if current placement is before a comment or line-comment\n *\n * @return     is before a comment or line-comment.\n */\nbool ASFormatter::isBeforeAnyComment() const\n{\n\tbool foundComment = false;\n\tsize_t peekNum = currentLine.find_first_not_of(\" \\t\", charNum + 1);\n\n\tif (peekNum == string::npos)\n\t\treturn foundComment;\n\n\tfoundComment = (currentLine.compare(peekNum, 2, \"/*\") == 0\n\t                || currentLine.compare(peekNum, 2, \"//\") == 0);\n\n\treturn foundComment;\n}\n\n/**\n * check if current placement is before a comment or line-comment\n * if a block comment it must be at the end of the line\n *\n * @return     is before a comment or line-comment.\n */\nbool ASFormatter::isBeforeAnyLineEndComment(int startPos) const\n{\n\tbool foundLineEndComment = false;\n\tsize_t peekNum = currentLine.find_first_not_of(\" \\t\", startPos + 1);\n\n\tif (peekNum != string::npos)\n\t{\n\t\tif (currentLine.compare(peekNum, 2, \"//\") == 0)\n\t\t\tfoundLineEndComment = true;\n\t\telse if (currentLine.compare(peekNum, 2, \"/*\") == 0)\n\t\t{\n\t\t\t// comment must be closed on this line with nothing after it\n\t\t\tsize_t endNum = currentLine.find(\"*/\", peekNum + 2);\n\t\t\tif (endNum != string::npos)\n\t\t\t{\n\t\t\t\tsize_t nextChar = currentLine.find_first_not_of(\" \\t\", endNum + 2);\n\t\t\t\tif (nextChar == string::npos)\n\t\t\t\t\tfoundLineEndComment = true;\n\t\t\t}\n\t\t}\n\t}\n\treturn foundLineEndComment;\n}\n\n/**\n * check if current placement is before a comment followed by a line-comment\n *\n * @return     is before a multiple line-end comment.\n */\nbool ASFormatter::isBeforeMultipleLineEndComments(int startPos) const\n{\n\tbool foundMultipleLineEndComment = false;\n\tsize_t peekNum = currentLine.find_first_not_of(\" \\t\", startPos + 1);\n\n\tif (peekNum != string::npos)\n\t{\n\t\tif (currentLine.compare(peekNum, 2, \"/*\") == 0)\n\t\t{\n\t\t\t// comment must be closed on this line with nothing after it\n\t\t\tsize_t endNum = currentLine.find(\"*/\", peekNum + 2);\n\t\t\tif (endNum != string::npos)\n\t\t\t{\n\t\t\t\tsize_t nextChar = currentLine.find_first_not_of(\" \\t\", endNum + 2);\n\t\t\t\tif (nextChar != string::npos\n\t\t\t\t        && currentLine.compare(nextChar, 2, \"//\") == 0)\n\t\t\t\t\tfoundMultipleLineEndComment = true;\n\t\t\t}\n\t\t}\n\t}\n\treturn foundMultipleLineEndComment;\n}\n\n/**\n * get the next character, increasing the current placement in the process.\n * the new character is inserted into the variable currentChar.\n *\n * @return   whether succeeded to receive the new character.\n */\nbool ASFormatter::getNextChar()\n{\n\tisInLineBreak = false;\n\tpreviousChar = currentChar;\n\n\tif (!isWhiteSpace(currentChar))\n\t{\n\t\tpreviousNonWSChar = currentChar;\n\t\tif (!isInComment && !isInLineComment && !isInQuote\n\t\t        && !isImmediatelyPostComment\n\t\t        && !isImmediatelyPostLineComment\n\t\t        && !isInPreprocessor\n\t\t        && !isSequenceReached(\"/*\")\n\t\t        && !isSequenceReached(\"//\"))\n\t\t\tpreviousCommandChar = currentChar;\n\t}\n\n\tif (charNum + 1 < (int) currentLine.length()\n\t        && (!isWhiteSpace(peekNextChar()) || isInComment || isInLineComment))\n\t{\n\t\tcurrentChar = currentLine[++charNum];\n\n\t\tif (currentChar == '\\t' && shouldConvertTabs)\n\t\t\tconvertTabToSpaces();\n\n\t\treturn true;\n\t}\n\n\t// end of line has been reached\n\treturn getNextLine();\n}\n\n/**\n * get the next line of input, increasing the current placement in the process.\n *\n * @param emptyLineWasDeleted         an empty line was deleted.\n * @return   whether succeeded in reading the next line.\n */\nbool ASFormatter::getNextLine(bool emptyLineWasDeleted /*false*/)\n{\n\tif (sourceIterator->hasMoreLines())\n\t{\n\t\tif (appendOpeningBracket)\n\t\t\tcurrentLine = \"{\";\t\t// append bracket that was removed from the previous line\n\t\telse\n\t\t{\n\t\t\tcurrentLine = sourceIterator->nextLine(emptyLineWasDeleted);\n\t\t\tassert(computeChecksumIn(currentLine));\n\t\t}\n\t\t// reset variables for new line\n\t\tinLineNumber++;\n\t\tif (endOfAsmReached)\n\t\t\tendOfAsmReached = isInAsmBlock = isInAsm = false;\n\t\tshouldKeepLineUnbroken = false;\n\t\tisInCommentStartLine = false;\n\t\tisInCase = false;\n\t\tisInAsmOneLine = false;\n\t\tisHeaderInMultiStatementLine = false;\n\t\tisInQuoteContinuation = isInVerbatimQuote | haveLineContinuationChar;\n\t\thaveLineContinuationChar = false;\n\t\tisImmediatelyPostEmptyLine = lineIsEmpty;\n\t\tpreviousChar = ' ';\n\n\t\tif (currentLine.length() == 0)\n\t\t\tcurrentLine = string(\" \");        // a null is inserted if this is not done\n\n\t\t// unless reading in the first line of the file, break a new line.\n\t\tif (!isVirgin)\n\t\t\tisInLineBreak = true;\n\t\telse\n\t\t\tisVirgin = false;\n\n\t\tif (isImmediatelyPostNonInStmt)\n\t\t{\n\t\t\tisCharImmediatelyPostNonInStmt = true;\n\t\t\tisImmediatelyPostNonInStmt = false;\n\t\t}\n\n\t\t// check if is in preprocessor before line trimming\n\t\t// a blank line after a \\ will remove the flag\n\t\tisImmediatelyPostPreprocessor = isInPreprocessor;\n\t\tif (!isInComment\n\t\t        && (previousNonWSChar != '\\\\'\n\t\t            || isEmptyLine(currentLine)))\n\t\t\tisInPreprocessor = false;\n\n\t\tif (passedSemicolon)\n\t\t\tisInExecSQL = false;\n\t\tinitNewLine();\n\n\t\tcurrentChar = currentLine[charNum];\n\t\tif (isInHorstmannRunIn && previousNonWSChar == '{' && !isInComment)\n\t\t\tisInLineBreak = false;\n\t\tisInHorstmannRunIn = false;\n\n\t\tif (currentChar == '\\t' && shouldConvertTabs)\n\t\t\tconvertTabToSpaces();\n\n\t\t// check for an empty line inside a command bracket.\n\t\t// if yes then read the next line (calls getNextLine recursively).\n\t\t// must be after initNewLine.\n\t\tif (shouldDeleteEmptyLines\n\t\t        && lineIsEmpty\n\t\t        && isBracketType((*bracketTypeStack)[bracketTypeStack->size() - 1], COMMAND_TYPE))\n\t\t{\n\t\t\tif (!shouldBreakBlocks || previousNonWSChar == '{' || !commentAndHeaderFollows())\n\t\t\t{\n\t\t\t\tisInPreprocessor = isImmediatelyPostPreprocessor;\t\t// restore\n\t\t\t\tlineIsEmpty = false;\n\t\t\t\treturn getNextLine(true);\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\telse\n\t{\n\t\tendOfCodeReached = true;\n\t\treturn false;\n\t}\n}\n\n/**\n * jump over the leading white space in the current line,\n * IF the line does not begin a comment or is in a preprocessor definition.\n */\nvoid ASFormatter::initNewLine()\n{\n\tsize_t len = currentLine.length();\n\tsize_t tabSize = getTabLength();\n\tcharNum = 0;\n\n\t// don't trim these\n\tif (isInQuoteContinuation\n\t        || (isInPreprocessor && !getPreprocDefineIndent()))\n\t\treturn;\n\n\t// SQL continuation lines must be adjusted so the leading spaces\n\t// is equivalent to the opening EXEC SQL\n\tif (isInExecSQL)\n\t{\n\t\t// replace leading tabs with spaces\n\t\t// so that continuation indent will be spaces\n\t\tsize_t tabCount_ = 0;\n\t\tsize_t i;\n\t\tfor (i = 0; i < currentLine.length(); i++)\n\t\t{\n\t\t\tif (!isWhiteSpace(currentLine[i]))\t\t// stop at first text\n\t\t\t\tbreak;\n\t\t\tif (currentLine[i] == '\\t')\n\t\t\t{\n\t\t\t\tsize_t numSpaces = tabSize - ((tabCount_ + i) % tabSize);\n\t\t\t\tcurrentLine.replace(i, 1, numSpaces, ' ');\n\t\t\t\ttabCount_++;\n\t\t\t\ti += tabSize - 1;\n\t\t\t}\n\t\t}\n\t\t// this will correct the format if EXEC SQL is not a hanging indent\n\t\ttrimContinuationLine();\n\t\treturn;\n\t}\n\n\t// comment continuation lines must be adjusted so the leading spaces\n\t// is equivalent to the opening comment\n\tif (isInComment)\n\t{\n\t\tif (noTrimCommentContinuation)\n\t\t\tleadingSpaces = tabIncrementIn = 0;\n\t\ttrimContinuationLine();\n\t\treturn;\n\t}\n\n\t// compute leading spaces\n\tisImmediatelyPostCommentOnly = lineIsLineCommentOnly || lineEndsInCommentOnly;\n\tlineIsCommentOnly = false;\n\tlineIsLineCommentOnly = false;\n\tlineEndsInCommentOnly = false;\n\tdoesLineStartComment = false;\n\tcurrentLineBeginsWithBracket = false;\n\tlineIsEmpty = false;\n\tcurrentLineFirstBracketNum = string::npos;\n\ttabIncrementIn = 0;\n\n\t// bypass whitespace at the start of a line\n\t// preprocessor tabs are replaced later in the program\n\tfor (charNum = 0; isWhiteSpace(currentLine[charNum]) && charNum + 1 < (int) len; charNum++)\n\t{\n\t\tif (currentLine[charNum] == '\\t' && !isInPreprocessor)\n\t\t\ttabIncrementIn += tabSize - 1 - ((tabIncrementIn + charNum) % tabSize);\n\t}\n\tleadingSpaces = charNum + tabIncrementIn;\n\n\tif (isSequenceReached(\"/*\"))\n\t{\n\t\tdoesLineStartComment = true;\n\t\tif ((int) currentLine.length() > charNum + 2\n\t\t        && currentLine.find(\"*/\", charNum + 2) != string::npos)\n\t\t\tlineIsCommentOnly = true;\n\t}\n\telse if (isSequenceReached(\"//\"))\n\t{\n\t\tlineIsLineCommentOnly = true;\n\t}\n\telse if (isSequenceReached(\"{\"))\n\t{\n\t\tcurrentLineBeginsWithBracket = true;\n\t\tcurrentLineFirstBracketNum = charNum;\n\t\tsize_t firstText = currentLine.find_first_not_of(\" \\t\", charNum + 1);\n\t\tif (firstText != string::npos)\n\t\t{\n\t\t\tif (currentLine.compare(firstText, 2, \"//\") == 0)\n\t\t\t\tlineIsLineCommentOnly = true;\n\t\t\telse if (currentLine.compare(firstText, 2, \"/*\") == 0\n\t\t\t         || isExecSQL(currentLine, firstText))\n\t\t\t{\n\t\t\t\t// get the extra adjustment\n\t\t\t\tsize_t j;\n\t\t\t\tfor (j = charNum + 1; j < firstText && isWhiteSpace(currentLine[j]); j++)\n\t\t\t\t{\n\t\t\t\t\tif (currentLine[j] == '\\t')\n\t\t\t\t\t\ttabIncrementIn += tabSize - 1 - ((tabIncrementIn + j) % tabSize);\n\t\t\t\t}\n\t\t\t\tleadingSpaces = j + tabIncrementIn;\n\t\t\t\tif (currentLine.compare(firstText, 2, \"/*\") == 0)\n\t\t\t\t\tdoesLineStartComment = true;\n\t\t\t}\n\t\t}\n\t}\n\telse if (isWhiteSpace(currentLine[charNum]) && !(charNum + 1 < (int) currentLine.length()))\n\t{\n\t\tlineIsEmpty = true;\n\t}\n\n\t// do not trim indented preprocessor define (except for comment continuation lines)\n\tif (isInPreprocessor)\n\t{\n\t\tif (!doesLineStartComment)\n\t\t\tleadingSpaces = 0;\n\t\tcharNum = 0;\n\t}\n}\n\n/**\n * Append a character to the current formatted line.\n * The formattedLine split points are updated.\n *\n * @param ch               the character to append.\n * @param canBreakLine     if true, a registered line-break\n */\nvoid ASFormatter::appendChar(char ch, bool canBreakLine)\n{\n\tif (canBreakLine && isInLineBreak)\n\t\tbreakLine();\n\n\tformattedLine.append(1, ch);\n\tisImmediatelyPostCommentOnly = false;\n\tif (maxCodeLength != string::npos)\n\t{\n\t\t// These compares reduce the frequency of function calls.\n\t\tif (isOkToSplitFormattedLine())\n\t\t\tupdateFormattedLineSplitPoints(ch);\n\t\tif (formattedLine.length() > maxCodeLength)\n\t\t\ttestForTimeToSplitFormattedLine();\n\t}\n}\n\n/**\n * Append a string sequence to the current formatted line.\n * The formattedLine split points are NOT updated.\n * But the formattedLine is checked for time to split.\n *\n * @param sequence         the sequence to append.\n * @param canBreakLine     if true, a registered line-break\n */\nvoid ASFormatter::appendSequence(const string &sequence, bool canBreakLine)\n{\n\tif (canBreakLine && isInLineBreak)\n\t\tbreakLine();\n\tformattedLine.append(sequence);\n\tif (formattedLine.length() > maxCodeLength)\n\t\ttestForTimeToSplitFormattedLine();\n}\n\n/**\n * Append an operator sequence to the current formatted line.\n * The formattedLine split points are updated.\n *\n * @param sequence         the sequence to append.\n * @param canBreakLine     if true, a registered line-break\n */\nvoid ASFormatter::appendOperator(const string &sequence, bool canBreakLine)\n{\n\tif (canBreakLine && isInLineBreak)\n\t\tbreakLine();\n\tformattedLine.append(sequence);\n\tif (maxCodeLength != string::npos)\n\t{\n\t\t// These compares reduce the frequency of function calls.\n\t\tif (isOkToSplitFormattedLine())\n\t\t\tupdateFormattedLineSplitPointsOperator(sequence);\n\t\tif (formattedLine.length() > maxCodeLength)\n\t\t\ttestForTimeToSplitFormattedLine();\n\t}\n}\n\n/**\n * append a space to the current formattedline, UNLESS the\n * last character is already a white-space character.\n */\nvoid ASFormatter::appendSpacePad()\n{\n\tint len = formattedLine.length();\n\tif (len > 0 && !isWhiteSpace(formattedLine[len - 1]))\n\t{\n\t\tformattedLine.append(1, ' ');\n\t\tspacePadNum++;\n\t\tif (maxCodeLength != string::npos)\n\t\t{\n\t\t\t// These compares reduce the frequency of function calls.\n\t\t\tif (isOkToSplitFormattedLine())\n\t\t\t\tupdateFormattedLineSplitPoints(' ');\n\t\t\tif (formattedLine.length() > maxCodeLength)\n\t\t\t\ttestForTimeToSplitFormattedLine();\n\t\t}\n\t}\n}\n\n/**\n * append a space to the current formattedline, UNLESS the\n * next character is already a white-space character.\n */\nvoid ASFormatter::appendSpaceAfter()\n{\n\tint len = currentLine.length();\n\tif (charNum + 1 < len && !isWhiteSpace(currentLine[charNum + 1]))\n\t{\n\t\tformattedLine.append(1, ' ');\n\t\tspacePadNum++;\n\t\tif (maxCodeLength != string::npos)\n\t\t{\n\t\t\t// These compares reduce the frequency of function calls.\n\t\t\tif (isOkToSplitFormattedLine())\n\t\t\t\tupdateFormattedLineSplitPoints(' ');\n\t\t\tif (formattedLine.length() > maxCodeLength)\n\t\t\t\ttestForTimeToSplitFormattedLine();\n\t\t}\n\t}\n}\n\n/**\n * register a line break for the formatted line.\n */\nvoid ASFormatter::breakLine(bool isSplitLine /*false*/)\n{\n\tisLineReady = true;\n\tisInLineBreak = false;\n\tspacePadNum = nextLineSpacePadNum;\n\tnextLineSpacePadNum = 0;\n\treadyFormattedLine = formattedLine;\n\tformattedLine.erase();\n\t// queue an empty line prepend request if one exists\n\tprependEmptyLine = isPrependPostBlockEmptyLineRequested;\n\n\tif (!isSplitLine)\n\t{\n\t\tformattedLineCommentNum = string::npos;\n\t\tclearFormattedLineSplitPoints();\n\n\t\tif (isAppendPostBlockEmptyLineRequested)\n\t\t{\n\t\t\tisAppendPostBlockEmptyLineRequested = false;\n\t\t\tisPrependPostBlockEmptyLineRequested = true;\n\t\t}\n\t\telse\n\t\t\tisPrependPostBlockEmptyLineRequested = false;\n\t}\n}\n\n/**\n * check if the currently reached open-bracket (i.e. '{')\n * opens a:\n * - a definition type block (such as a class or namespace),\n * - a command block (such as a method block)\n * - a static array\n * this method takes for granted that the current character\n * is an opening bracket.\n *\n * @return    the type of the opened block.\n */\nBracketType ASFormatter::getBracketType()\n{\n\tassert(currentChar == '{');\n\n\tBracketType returnVal;\n\n\tif ((previousNonWSChar == '='\n\t        || isBracketType(bracketTypeStack->back(), ARRAY_TYPE))\n\t        && previousCommandChar != ')')\n\t\treturnVal = ARRAY_TYPE;\n\telse if (foundPreDefinitionHeader && previousCommandChar != ')')\n\t{\n\t\treturnVal = DEFINITION_TYPE;\n\t\tif (foundNamespaceHeader)\n\t\t\treturnVal = (BracketType)(returnVal | NAMESPACE_TYPE);\n\t\telse if (foundClassHeader)\n\t\t\treturnVal = (BracketType)(returnVal | CLASS_TYPE);\n\t\telse if (foundStructHeader)\n\t\t\treturnVal = (BracketType)(returnVal | STRUCT_TYPE);\n\t\telse if (foundInterfaceHeader)\n\t\t\treturnVal = (BracketType)(returnVal | INTERFACE_TYPE);\n\t}\n\telse if (isInEnum)\n\t{\n\t\treturnVal = (BracketType)(ARRAY_TYPE | ENUM_TYPE);\n\t}\n\telse\n\t{\n\t\tbool isCommandType = (foundPreCommandHeader\n\t\t                      || foundPreCommandMacro\n\t\t                      || (currentHeader != NULL && isNonParenHeader)\n\t\t                      || (previousCommandChar == ')')\n\t\t                      || (previousCommandChar == ':' && !foundQuestionMark)\n\t\t                      || (previousCommandChar == ';')\n\t\t                      || ((previousCommandChar == '{' || previousCommandChar == '}')\n\t\t                          && isPreviousBracketBlockRelated)\n\t\t                      || (isInClassInitializer\n\t\t                          && (!isLegalNameChar(previousNonWSChar) || foundPreCommandHeader))\n\t\t                      || isInObjCMethodDefinition\n\t\t                      || isInObjCInterface\n\t\t                      || isJavaStaticConstructor\n\t\t                      || isSharpDelegate);\n\n\t\t// C# methods containing 'get', 'set', 'add', and 'remove' do NOT end with parens\n\t\tif (!isCommandType && isSharpStyle() && isNextWordSharpNonParenHeader(charNum + 1))\n\t\t{\n\t\t\tisCommandType = true;\n\t\t\tisSharpAccessor = true;\n\t\t}\n\n\t\tif (isInExternC)\n\t\t\treturnVal = (isCommandType ? COMMAND_TYPE : EXTERN_TYPE);\n\t\telse\n\t\t\treturnVal = (isCommandType ? COMMAND_TYPE : ARRAY_TYPE);\n\t}\n\n\tint foundOneLineBlock = isOneLineBlockReached(currentLine, charNum);\n\t// this assumes each array definition is on a single line\n\t// (foundOneLineBlock == 2) is a one line block followed by a comma\n\tif (foundOneLineBlock == 2 && returnVal == COMMAND_TYPE)\n\t\treturnVal = ARRAY_TYPE;\n\n\tif (foundOneLineBlock > 0)\t\t// found one line block\n\t\treturnVal = (BracketType)(returnVal | SINGLE_LINE_TYPE);\n\n\tif (isBracketType(returnVal, ARRAY_TYPE))\n\t{\n\t\tif (isNonInStatementArrayBracket())\n\t\t{\n\t\t\treturnVal = (BracketType)(returnVal | ARRAY_NIS_TYPE);\n\t\t\tisNonInStatementArray = true;\n\t\t\tisImmediatelyPostNonInStmt = false;\t\t// in case of \"},{\"\n\t\t\tnonInStatementBracket = formattedLine.length() - 1;\n\t\t}\n\t\tif (isUniformInitializerBracket())\n\t\t\treturnVal = (BracketType)(returnVal | INIT_TYPE);\n\t}\n\n\treturn returnVal;\n}\n\n/**\n* check if a colon is a class initializer separator\n*\n* @return        whether it is a class initializer separator\n*/\nbool ASFormatter::isClassInitializer() const\n{\n\tassert(currentLine[charNum] == ':');\n\tassert(previousChar != ':' && peekNextChar() != ':');\t// not part of '::'\n\n\t// this should be similar to ASBeautifier::parseCurrentLine()\n\tbool foundClassInitializer = false;\n\n\tif (foundQuestionMark)\n\t{\n\t\t// do nothing special\n\t}\n\telse if (parenStack->back() > 0)\n\t{\n\t\t// found a 'for' loop or an objective-C statement\n\t\t// so do nothing special\n\t}\n\telse if (isInEnum)\n\t{\n\t\t// found an enum with a base-type\n\t}\n\telse if (isCStyle()\n\t         && !isInCase\n\t         && (previousCommandChar == ')' || foundPreCommandHeader))\n\t{\n\t\t// found a 'class' c'tor initializer\n\t\tfoundClassInitializer = true;\n\t}\n\treturn foundClassInitializer;\n}\n\n/**\n * check if a line is empty\n *\n * @return        whether line is empty\n */\nbool ASFormatter::isEmptyLine(const string &line) const\n{\n\treturn line.find_first_not_of(\" \\t\") == string::npos;\n}\n\n/**\n * Check if the following text is \"C\" as in extern \"C\".\n *\n * @return        whether the statement is extern \"C\"\n */\nbool ASFormatter::isExternC() const\n{\n\t// charNum should be at 'extern'\n\tassert(!isWhiteSpace(currentLine[charNum]));\n\tsize_t startQuote = currentLine.find_first_of(\" \\t\\\"\", charNum);\n\tif (startQuote == string::npos)\n\t\treturn false;\n\tstartQuote = currentLine.find_first_not_of(\" \\t\", startQuote);\n\tif (startQuote == string::npos)\n\t\treturn false;\n\tif (currentLine.compare(startQuote, 3, \"\\\"C\\\"\") != 0)\n\t\treturn false;\n\treturn true;\n}\n\n/**\n * Check if the currently reached '*', '&' or '^' character is\n * a pointer-or-reference symbol, or another operator.\n * A pointer dereference (*) or an \"address of\" character (&)\n * counts as a pointer or reference because it is not an\n * arithmetic operator.\n *\n * @return        whether current character is a reference-or-pointer\n */\nbool ASFormatter::isPointerOrReference() const\n{\n\tassert(currentChar == '*' || currentChar == '&' || currentChar == '^');\n\n\tif (isJavaStyle())\n\t\treturn false;\n\n\tif (isCharImmediatelyPostOperator)\n\t\treturn false;\n\n\t// get the last legal word (may be a number)\n\tstring lastWord = getPreviousWord(currentLine, charNum);\n\tif (lastWord.empty())\n\t\tlastWord = \" \";\n\n\t// check for preceding or following numeric values\n\tstring nextText = peekNextText(currentLine.substr(charNum + 1));\n\tif (nextText.length() == 0)\n\t\tnextText = \" \";\n\tchar nextChar = nextText[0];\n\tif (isDigit(lastWord[0])\n\t        || isDigit(nextChar)\n\t        || nextChar == '!'\n\t        || nextChar == '~')\n\t\treturn false;\n\n\t// check for multiply then a dereference (a * *b)\n\tif (currentChar == '*'\n\t        && charNum < (int) currentLine.length() - 1\n\t        && isWhiteSpace(currentLine[charNum + 1])\n\t        && nextChar == '*')\n\t\treturn false;\n\n\tif ((foundCastOperator && nextChar == '>')\n\t        || isPointerOrReferenceVariable(lastWord))\n\t\treturn true;\n\n\tif (isInClassInitializer\n\t        && previousNonWSChar != '('\n\t        && previousNonWSChar != '{'\n\t        && previousCommandChar != ','\n\t        && nextChar != ')'\n\t        && nextChar != '}')\n\t\treturn false;\n\n\t//check for rvalue reference\n\tif (currentChar == '&' && nextChar == '&')\n\t{\n\t\tstring followingText = peekNextText(currentLine.substr(charNum + 2));\n\t\tif (followingText.length() > 0 && followingText[0] == ')')\n\t\t\treturn true;\n\t\tif (currentHeader != NULL || isInPotentialCalculation)\n\t\t\treturn false;\n\t\tif (parenStack->back() > 0 && isBracketType(bracketTypeStack->back(), COMMAND_TYPE))\n\t\t\treturn false;\n\t\treturn true;\n\t}\n\tif (nextChar == '*'\n\t        || previousNonWSChar == '='\n\t        || previousNonWSChar == '('\n\t        || previousNonWSChar == '['\n\t        || isCharImmediatelyPostReturn\n\t        || isInTemplate\n\t        || isCharImmediatelyPostTemplate\n\t        || currentHeader == &AS_CATCH\n\t        || currentHeader == &AS_FOREACH\n\t        || currentHeader == &AS_QFOREACH)\n\t\treturn true;\n\n\tif (isBracketType(bracketTypeStack->back(), ARRAY_TYPE)\n\t        && isLegalNameChar(lastWord[0])\n\t        && isLegalNameChar(nextChar)\n\t        && previousNonWSChar != ')')\n\t{\n\t\tif (isArrayOperator())\n\t\t\treturn false;\n\t}\n\n\t// checks on operators in parens\n\tif (parenStack->back() > 0\n\t        && isLegalNameChar(lastWord[0])\n\t        && isLegalNameChar(nextChar))\n\t{\n\t\t// if followed by an assignment it is a pointer or reference\n\t\t// if followed by semicolon it is a pointer or reference in range-based for\n\t\tconst string* followingOperator = getFollowingOperator();\n\t\tif (followingOperator\n\t\t        && followingOperator != &AS_MULT\n\t\t        && followingOperator != &AS_BIT_AND)\n\t\t{\n\t\t\tif (followingOperator == &AS_ASSIGN || followingOperator == &AS_COLON)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\n\t\tif (isBracketType(bracketTypeStack->back(), COMMAND_TYPE)\n\t\t        || squareBracketCount > 0)\n\t\t\treturn false;\n\t\telse\n\t\t\treturn true;\n\t}\n\n\t// checks on operators in parens with following '('\n\tif (parenStack->back() > 0\n\t        && nextChar == '('\n\t        && previousNonWSChar != ','\n\t        && previousNonWSChar != '('\n\t        && previousNonWSChar != '!'\n\t        && previousNonWSChar != '&'\n\t        && previousNonWSChar != '*'\n\t        && previousNonWSChar != '|')\n\t\treturn false;\n\n\tif (nextChar == '-'\n\t        || nextChar == '+')\n\t{\n\t\tsize_t nextNum = currentLine.find_first_not_of(\" \\t\", charNum + 1);\n\t\tif (nextNum != string::npos)\n\t\t{\n\t\t\tif (currentLine.compare(nextNum, 2, \"++\") != 0\n\t\t\t        && currentLine.compare(nextNum, 2, \"--\") != 0)\n\t\t\t\treturn false;\n\t\t}\n\t}\n\n\tbool isPR = (!isInPotentialCalculation\n\t             || (!isLegalNameChar(previousNonWSChar)\n\t                 && !(previousNonWSChar == ')' && nextChar == '(')\n\t                 && !(previousNonWSChar == ')' && currentChar == '*' && !isImmediatelyPostCast())\n\t                 && previousNonWSChar != ']')\n\t             || (!isWhiteSpace(nextChar)\n\t                 && nextChar != '-'\n\t                 && nextChar != '('\n\t                 && nextChar != '['\n\t                 && !isLegalNameChar(nextChar))\n\t            );\n\n\treturn isPR;\n}\n\n/**\n * Check if the currently reached  '*' or '&' character is\n * a dereferenced pointer or \"address of\" symbol.\n * NOTE: this MUST be a pointer or reference as determined by\n * the function isPointerOrReference().\n *\n * @return        whether current character is a dereference or address of\n */\nbool ASFormatter::isDereferenceOrAddressOf() const\n{\n\tassert(currentChar == '*' || currentChar == '&' || currentChar == '^');\n\n\tif (isCharImmediatelyPostTemplate)\n\t\treturn false;\n\n\tif (previousNonWSChar == '='\n\t        || previousNonWSChar == ','\n\t        || previousNonWSChar == '.'\n\t        || previousNonWSChar == '{'\n\t        || previousNonWSChar == '>'\n\t        || previousNonWSChar == '<'\n\t        || previousNonWSChar == '?'\n\t        || isCharImmediatelyPostLineComment\n\t        || isCharImmediatelyPostComment\n\t        || isCharImmediatelyPostReturn)\n\t\treturn true;\n\n\tchar nextChar = peekNextChar();\n\tif (currentChar == '*' && nextChar == '*')\n\t{\n\t\tif (previousNonWSChar == '(')\n\t\t\treturn true;\n\t\tif ((int) currentLine.length() < charNum + 2)\n\t\t\treturn true;\n\t\treturn false;\n\t}\n\tif (currentChar == '&' && nextChar == '&')\n\t{\n\t\tif (previousNonWSChar == '(' || isInTemplate)\n\t\t\treturn true;\n\t\tif ((int) currentLine.length() < charNum + 2)\n\t\t\treturn true;\n\t\treturn false;\n\t}\n\n\t// check first char on the line\n\tif (charNum == (int) currentLine.find_first_not_of(\" \\t\")\n\t        && (isBracketType(bracketTypeStack->back(), COMMAND_TYPE)\n\t            || parenStack->back() != 0))\n\t\treturn true;\n\n\tstring nextText = peekNextText(currentLine.substr(charNum + 1));\n\tif (nextText.length() > 0)\n\t{\n\t\tif (nextText[0] == ')' || nextText[0] == '>'\n\t\t        || nextText[0] == ',' || nextText[0] == '=')\n\t\t\treturn false;\n\t\tif (nextText[0] == ';')\n\t\t\treturn true;\n\t}\n\n\t// check for reference to a pointer *& (cannot have &*)\n\tif ((currentChar == '*' && nextChar == '&')\n\t        || (previousNonWSChar == '*' && currentChar == '&'))\n\t\treturn false;\n\n\tif (!isBracketType(bracketTypeStack->back(), COMMAND_TYPE)\n\t        && parenStack->back() == 0)\n\t\treturn false;\n\n\tstring lastWord = getPreviousWord(currentLine, charNum);\n\tif (lastWord == \"else\" || lastWord == \"delete\")\n\t\treturn true;\n\n\tif (isPointerOrReferenceVariable(lastWord))\n\t\treturn false;\n\n\tbool isDA = (!(isLegalNameChar(previousNonWSChar) || previousNonWSChar == '>')\n\t             || (nextText.length() > 0 && !isLegalNameChar(nextText[0]) && nextText[0] != '/')\n\t             || (ispunct((unsigned char)previousNonWSChar) && previousNonWSChar != '.')\n\t             || isCharImmediatelyPostReturn);\n\n\treturn isDA;\n}\n\n/**\n * Check if the currently reached  '*' or '&' character is\n * centered with one space on each side.\n * Only spaces are checked, not tabs.\n * If true then a space will be deleted on the output.\n *\n * @return        whether current character is centered.\n */\nbool ASFormatter::isPointerOrReferenceCentered() const\n{\n\tassert(currentLine[charNum] == '*' || currentLine[charNum] == '&' || currentLine[charNum] == '^');\n\n\tint prNum = charNum;\n\tint lineLength = (int) currentLine.length();\n\n\t// check for end of line\n\tif (peekNextChar() == ' ')\n\t\treturn false;\n\n\t// check space before\n\tif (prNum < 1\n\t        || currentLine[prNum - 1] != ' ')\n\t\treturn false;\n\n\t// check no space before that\n\tif (prNum < 2\n\t        || currentLine[prNum - 2] == ' ')\n\t\treturn false;\n\n\t// check for ** or &&\n\tif (prNum + 1 < lineLength\n\t        && (currentLine[prNum + 1] == '*' || currentLine[prNum + 1] == '&'))\n\t\tprNum++;\n\n\t// check space after\n\tif (prNum + 1 <= lineLength\n\t        && currentLine[prNum + 1] != ' ')\n\t\treturn false;\n\n\t// check no space after that\n\tif (prNum + 2 < lineLength\n\t        && currentLine[prNum + 2] == ' ')\n\t\treturn false;\n\n\treturn true;\n}\n\n/**\n * Check if a word is a pointer or reference variable type.\n *\n * @return        whether word is a pointer or reference variable.\n */\nbool ASFormatter::isPointerOrReferenceVariable(string &word) const\n{\n\tif (word == \"char\"\n\t        || word == \"int\"\n\t        || word == \"void\"\n\t        || (word.length() >= 6     // check end of word for _t\n\t            && word.compare(word.length() - 2, 2, \"_t\") == 0)\n\t        || word == \"INT\"\n\t        || word == \"VOID\")\n\t\treturn true;\n\treturn false;\n}\n\n/**\n * check if the currently reached '+' or '-' character is a unary operator\n * this method takes for granted that the current character\n * is a '+' or '-'.\n *\n * @return        whether the current '+' or '-' is a unary operator.\n */\nbool ASFormatter::isUnaryOperator() const\n{\n\tassert(currentChar == '+' || currentChar == '-');\n\n\treturn ((isCharImmediatelyPostReturn || !isLegalNameChar(previousCommandChar))\n\t        && previousCommandChar != '.'\n\t        && previousCommandChar != '\\\"'\n\t        && previousCommandChar != '\\''\n\t        && previousCommandChar != ')'\n\t        && previousCommandChar != ']');\n}\n\n/**\n * check if the currently reached comment is in a 'switch' statement\n *\n * @return        whether the current '+' or '-' is in an exponent.\n */\nbool ASFormatter::isInSwitchStatement() const\n{\n\tassert(isInLineComment || isInComment);\n\tif (preBracketHeaderStack->size() > 0)\n\t\tfor (size_t i = 1; i < preBracketHeaderStack->size(); i++)\n\t\t\tif (preBracketHeaderStack->at(i) == &AS_SWITCH)\n\t\t\t\treturn true;\n\treturn false;\n}\n\n/**\n * check if the currently reached '+' or '-' character is\n * part of an exponent, i.e. 0.2E-5.\n *\n * @return        whether the current '+' or '-' is in an exponent.\n */\nbool ASFormatter::isInExponent() const\n{\n\tassert(currentChar == '+' || currentChar == '-');\n\n\tint formattedLineLength = formattedLine.length();\n\tif (formattedLineLength >= 2)\n\t{\n\t\tchar prevPrevFormattedChar = formattedLine[formattedLineLength - 2];\n\t\tchar prevFormattedChar = formattedLine[formattedLineLength - 1];\n\n\t\treturn ((prevFormattedChar == 'e' || prevFormattedChar == 'E')\n\t\t        && (prevPrevFormattedChar == '.' || isDigit(prevPrevFormattedChar)));\n\t}\n\telse\n\t\treturn false;\n}\n\n/**\n * check if an array bracket should NOT have an in-statement indent\n *\n * @return        the array is non in-statement\n */\nbool ASFormatter::isNonInStatementArrayBracket() const\n{\n\tbool returnVal = false;\n\tchar nextChar = peekNextChar();\n\t// if this opening bracket begins the line there will be no inStatement indent\n\tif (currentLineBeginsWithBracket\n\t        && charNum == (int) currentLineFirstBracketNum\n\t        && nextChar != '}')\n\t\treturnVal = true;\n\t// if an opening bracket ends the line there will be no inStatement indent\n\tif (isWhiteSpace(nextChar)\n\t        || isBeforeAnyLineEndComment(charNum)\n\t        || nextChar == '{')\n\t\treturnVal = true;\n\n\t// Java \"new Type [] {...}\" IS an inStatement indent\n\tif (isJavaStyle() && previousNonWSChar == ']')\n\t\treturnVal = false;\n\n\treturn returnVal;\n}\n\n/**\n * check if a one-line bracket has been reached,\n * i.e. if the currently reached '{' character is closed\n * with a complimentary '}' elsewhere on the current line,\n *.\n * @return     0 = one-line bracket has not been reached.\n *             1 = one-line bracket has been reached.\n *             2 = one-line bracket has been reached and is followed by a comma.\n */\nint ASFormatter::isOneLineBlockReached(string &line, int startChar) const\n{\n\tassert(line[startChar] == '{');\n\n\tbool isInComment_ = false;\n\tbool isInQuote_ = false;\n\tint bracketCount = 1;\n\tint lineLength = line.length();\n\tchar quoteChar_ = ' ';\n\tchar ch = ' ';\n\tchar prevCh = ' ';\n\n\tfor (int i = startChar + 1; i < lineLength; ++i)\n\t{\n\t\tch = line[i];\n\n\t\tif (isInComment_)\n\t\t{\n\t\t\tif (line.compare(i, 2, \"*/\") == 0)\n\t\t\t{\n\t\t\t\tisInComment_ = false;\n\t\t\t\t++i;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (ch == '\\\\')\n\t\t{\n\t\t\t++i;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isInQuote_)\n\t\t{\n\t\t\tif (ch == quoteChar_)\n\t\t\t\tisInQuote_ = false;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (ch == '\"' || ch == '\\'')\n\t\t{\n\t\t\tisInQuote_ = true;\n\t\t\tquoteChar_ = ch;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (line.compare(i, 2, \"//\") == 0)\n\t\t\tbreak;\n\n\t\tif (line.compare(i, 2, \"/*\") == 0)\n\t\t{\n\t\t\tisInComment_ = true;\n\t\t\t++i;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (ch == '{')\n\t\t\t++bracketCount;\n\t\telse if (ch == '}')\n\t\t\t--bracketCount;\n\n\t\tif (bracketCount == 0)\n\t\t{\n\t\t\t// is this an array?\n\t\t\tif (parenStack->back() == 0 && prevCh != '}')\n\t\t\t{\n\t\t\t\tsize_t peekNum = line.find_first_not_of(\" \\t\", i + 1);\n\t\t\t\tif (peekNum != string::npos && line[peekNum] == ',')\n\t\t\t\t\treturn 2;\n\t\t\t}\n\t\t\treturn 1;\n\t\t}\n\t\tif (!isWhiteSpace(ch))\n\t\t\tprevCh = ch;\n\t}\n\n\treturn 0;\n}\n\n/**\n * peek at the next word to determine if it is a C# non-paren header.\n * will look ahead in the input file if necessary.\n *\n * @param  startChar      position on currentLine to start the search\n * @return                true if the next word is get or set.\n */\nbool ASFormatter::isNextWordSharpNonParenHeader(int startChar) const\n{\n\t// look ahead to find the next non-comment text\n\tstring nextText = peekNextText(currentLine.substr(startChar));\n\tif (nextText.length() == 0)\n\t\treturn false;\n\tif (nextText[0] == '[')\n\t\treturn true;\n\tif (!isCharPotentialHeader(nextText, 0))\n\t\treturn false;\n\tif (findKeyword(nextText, 0, AS_GET) || findKeyword(nextText, 0, AS_SET)\n\t        || findKeyword(nextText, 0, AS_ADD) || findKeyword(nextText, 0, AS_REMOVE))\n\t\treturn true;\n\treturn false;\n}\n\n/**\n * peek at the next char to determine if it is an opening bracket.\n * will look ahead in the input file if necessary.\n * this determines a java static constructor.\n *\n * @param startChar     position on currentLine to start the search\n * @return              true if the next word is an opening bracket.\n */\nbool ASFormatter::isNextCharOpeningBracket(int startChar) const\n{\n\tbool retVal = false;\n\tstring nextText = peekNextText(currentLine.substr(startChar));\n\tif (nextText.length() > 0\n\t        && nextText.compare(0, 1, \"{\") == 0)\n\t\tretVal = true;\n\treturn retVal;\n}\n\n/**\n* Check if operator and, pointer, and reference padding is disabled.\n* Disabling is done thru a NOPAD tag in an ending comment.\n*\n* @return              true if the formatting on this line is disabled.\n*/\nbool ASFormatter::isOperatorPaddingDisabled() const\n{\n\tsize_t commentStart = currentLine.find(\"//\", charNum);\n\tif (commentStart == string::npos)\n\t{\n\t\tcommentStart = currentLine.find(\"/*\", charNum);\n\t\t// comment must end on this line\n\t\tif (commentStart != string::npos)\n\t\t{\n\t\t\tsize_t commentEnd = currentLine.find(\"*/\", commentStart + 2);\n\t\t\tif (commentEnd == string::npos)\n\t\t\t\tcommentStart = string::npos;\n\t\t}\n\t}\n\tif (commentStart == string::npos)\n\t\treturn false;\n\tsize_t noPadStart = currentLine.find(\"*NOPAD*\", commentStart);\n\tif (noPadStart == string::npos)\n\t\treturn false;\n\treturn true;\n}\n\n/**\n* Determine if an opening array-type bracket should have a leading space pad.\n* This is to identify C++11 uniform initializers.\n*/\nbool ASFormatter::isUniformInitializerBracket() const\n{\n\tif (isCStyle() && !isInEnum && !isImmediatelyPostPreprocessor)\n\t{\n\t\tif (isInClassInitializer\n\t\t        || isLegalNameChar(previousNonWSChar))\n\t\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * get the next non-whitespace substring on following lines, bypassing all comments.\n *\n * @param   firstLine   the first line to check\n * @return  the next non-whitespace substring.\n */\nstring ASFormatter::peekNextText(const string &firstLine, bool endOnEmptyLine /*false*/, bool shouldReset /*false*/) const\n{\n\tbool isFirstLine = true;\n\tbool needReset = shouldReset;\n\tstring nextLine_ = firstLine;\n\tsize_t firstChar = string::npos;\n\n\t// find the first non-blank text, bypassing all comments.\n\tbool isInComment_ = false;\n\twhile (sourceIterator->hasMoreLines() || isFirstLine)\n\t{\n\t\tif (isFirstLine)\n\t\t\tisFirstLine = false;\n\t\telse\n\t\t{\n\t\t\tnextLine_ = sourceIterator->peekNextLine();\n\t\t\tneedReset = true;\n\t\t}\n\n\t\tfirstChar = nextLine_.find_first_not_of(\" \\t\");\n\t\tif (firstChar == string::npos)\n\t\t{\n\t\t\tif (endOnEmptyLine && !isInComment_)\n\t\t\t\tbreak;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (nextLine_.compare(firstChar, 2, \"/*\") == 0)\n\t\t{\n\t\t\tfirstChar += 2;\n\t\t\tisInComment_ = true;\n\t\t}\n\n\t\tif (isInComment_)\n\t\t{\n\t\t\tfirstChar = nextLine_.find(\"*/\", firstChar);\n\t\t\tif (firstChar == string::npos)\n\t\t\t\tcontinue;\n\t\t\tfirstChar += 2;\n\t\t\tisInComment_ = false;\n\t\t\tfirstChar = nextLine_.find_first_not_of(\" \\t\", firstChar);\n\t\t\tif (firstChar == string::npos)\n\t\t\t\tcontinue;\n\t\t}\n\n\t\tif (nextLine_.compare(firstChar, 2, \"//\") == 0)\n\t\t\tcontinue;\n\n\t\t// found the next text\n\t\tbreak;\n\t}\n\n\tif (firstChar == string::npos)\n\t\tnextLine_ = \"\";\n\telse\n\t\tnextLine_ = nextLine_.substr(firstChar);\n\tif (needReset)\n\t\tsourceIterator->peekReset();\n\treturn nextLine_;\n}\n\n/**\n * adjust comment position because of adding or deleting spaces\n * the spaces are added or deleted to formattedLine\n * spacePadNum contains the adjustment\n */\nvoid ASFormatter::adjustComments(void)\n{\n\tassert(spacePadNum != 0);\n\tassert(currentLine.compare(charNum, 2, \"//\") == 0\n\t       || currentLine.compare(charNum, 2, \"/*\") == 0);\n\n\t// block comment must be closed on this line with nothing after it\n\tif (currentLine.compare(charNum, 2, \"/*\") == 0)\n\t{\n\t\tsize_t endNum = currentLine.find(\"*/\", charNum + 2);\n\t\tif (endNum == string::npos)\n\t\t\treturn;\n\t\tif (currentLine.find_first_not_of(\" \\t\", endNum + 2) != string::npos)\n\t\t\treturn;\n\t}\n\n\tsize_t len = formattedLine.length();\n\t// don't adjust a tab\n\tif (formattedLine[len - 1] == '\\t')\n\t\treturn;\n\t// if spaces were removed, need to add spaces before the comment\n\tif (spacePadNum < 0)\n\t{\n\t\tint adjust = -spacePadNum;          // make the number positive\n\t\tformattedLine.append(adjust, ' ');\n\t}\n\t// if spaces were added, need to delete extra spaces before the comment\n\t// if cannot be done put the comment one space after the last text\n\telse if (spacePadNum > 0)\n\t{\n\t\tint adjust = spacePadNum;\n\t\tsize_t lastText = formattedLine.find_last_not_of(' ');\n\t\tif (lastText != string::npos\n\t\t        && lastText < len - adjust - 1)\n\t\t\tformattedLine.resize(len - adjust);\n\t\telse if (len > lastText + 2)\n\t\t\tformattedLine.resize(lastText + 2);\n\t\telse if (len < lastText + 2)\n\t\t\tformattedLine.append(len - lastText, ' ');\n\t}\n}\n\n/**\n * append the current bracket inside the end of line comments\n * currentChar contains the bracket, it will be appended to formattedLine\n * formattedLineCommentNum is the comment location on formattedLine\n */\nvoid ASFormatter::appendCharInsideComments(void)\n{\n\tif (formattedLineCommentNum == string::npos)    // does the comment start on the previous line?\n\t{\n\t\tappendCurrentChar();                        // don't attach\n\t\treturn;\n\t}\n\tassert(formattedLine.compare(formattedLineCommentNum, 2, \"//\") == 0\n\t       || formattedLine.compare(formattedLineCommentNum, 2, \"/*\") == 0);\n\n\t// find the previous non space char\n\tsize_t end = formattedLineCommentNum;\n\tsize_t beg = formattedLine.find_last_not_of(\" \\t\", end - 1);\n\tif (beg == string::npos)\n\t{\n\t\tappendCurrentChar();                // don't attach\n\t\treturn;\n\t}\n\tbeg++;\n\n\t// insert the bracket\n\tif (end - beg < 3)                      // is there room to insert?\n\t\tformattedLine.insert(beg, 3 - end + beg, ' ');\n\tif (formattedLine[beg] == '\\t')         // don't pad with a tab\n\t\tformattedLine.insert(beg, 1, ' ');\n\tformattedLine[beg + 1] = currentChar;\n\ttestForTimeToSplitFormattedLine();\n\n\tif (isBeforeComment())\n\t\tbreakLine();\n\telse if (isCharImmediatelyPostLineComment)\n\t\tshouldBreakLineAtNextChar = true;\n\treturn;\n}\n\n/**\n * add or remove space padding to operators\n * the operators and necessary padding will be appended to formattedLine\n * the calling function should have a continue statement after calling this method\n *\n * @param newOperator     the operator to be padded\n */\nvoid ASFormatter::padOperators(const string* newOperator)\n{\n\tassert(shouldPadOperators);\n\tassert(newOperator != NULL);\n\n\tbool shouldPad = (newOperator != &AS_SCOPE_RESOLUTION\n\t                  && newOperator != &AS_PLUS_PLUS\n\t                  && newOperator != &AS_MINUS_MINUS\n\t                  && newOperator != &AS_NOT\n\t                  && newOperator != &AS_BIT_NOT\n\t                  && newOperator != &AS_ARROW\n\t                  && !(newOperator == &AS_COLON && !foundQuestionMark\t\t\t// objC methods\n\t                       && (isInObjCMethodDefinition || isInObjCInterface\n\t                           || isInObjCSelector || squareBracketCount))\n\t                  && !(newOperator == &AS_MINUS && isInExponent())\n\t                  && !((newOperator == &AS_PLUS || newOperator == &AS_MINUS)\t// check for unary plus or minus\n\t                       && (previousNonWSChar == '('\n\t                           || previousNonWSChar == '['\n\t                           || previousNonWSChar == '='\n\t                           || previousNonWSChar == ','))\n\t                  && !(newOperator == &AS_PLUS && isInExponent())\n\t                  && !isCharImmediatelyPostOperator\n//?                   // commented out in release 2.05.1 - doesn't seem to do anything???\n//x                   && !((newOperator == &AS_MULT || newOperator == &AS_BIT_AND || newOperator == &AS_AND)\n//x                        && isPointerOrReference())\n\t                  && !(newOperator == &AS_MULT\n\t                       && (previousNonWSChar == '.'\n\t                           || previousNonWSChar == '>'))    // check for ->\n\t                  && !((isInTemplate || isImmediatelyPostTemplate)\n\t                       && (newOperator == &AS_LS || newOperator == &AS_GR))\n\t                  && !(newOperator == &AS_GCC_MIN_ASSIGN\n\t                       && ASBase::peekNextChar(currentLine, charNum + 1) == '>')\n\t                  && !(newOperator == &AS_GR && previousNonWSChar == '?')\n\t                  && !(newOperator == &AS_QUESTION\t\t\t// check for Java wildcard\n\t                       && (previousNonWSChar == '<'\n\t                           || ASBase::peekNextChar(currentLine, charNum) == '>'\n\t                           || ASBase::peekNextChar(currentLine, charNum) == '.'))\n\t                  && !isInCase\n\t                  && !isInAsm\n\t                  && !isInAsmOneLine\n\t                  && !isInAsmBlock\n\t                 );\n\n\t// pad before operator\n\tif (shouldPad\n\t        && !(newOperator == &AS_COLON\n\t             && (!foundQuestionMark && !isInEnum) && currentHeader != &AS_FOR)\n\t        && !(newOperator == &AS_QUESTION && isSharpStyle() // check for C# nullable type (e.g. int?)\n\t             && currentLine.find(':', charNum + 1) == string::npos)\n\t   )\n\t\tappendSpacePad();\n\tappendOperator(*newOperator);\n\tgoForward(newOperator->length() - 1);\n\n\tcurrentChar = (*newOperator)[newOperator->length() - 1];\n\t// pad after operator\n\t// but do not pad after a '-' that is a unary-minus.\n\tif (shouldPad\n\t        && !isBeforeAnyComment()\n\t        && !(newOperator == &AS_PLUS && isUnaryOperator())\n\t        && !(newOperator == &AS_MINUS && isUnaryOperator())\n\t        && !(currentLine.compare(charNum + 1, 1, AS_SEMICOLON) == 0)\n\t        && !(currentLine.compare(charNum + 1, 2, AS_SCOPE_RESOLUTION) == 0)\n\t        && !(peekNextChar() == ',')\n\t        && !(newOperator == &AS_QUESTION && isSharpStyle() // check for C# nullable type (e.g. int?)\n\t             && peekNextChar() == '[')\n\t   )\n\t\tappendSpaceAfter();\n\n\tpreviousOperator = newOperator;\n\treturn;\n}\n\n/**\n * format pointer or reference\n * currentChar contains the pointer or reference\n * the symbol and necessary padding will be appended to formattedLine\n * the calling function should have a continue statement after calling this method\n *\n * NOTE: Do NOT use appendCurrentChar() in this method. The line should not be\n *       broken once the calculation starts.\n */\nvoid ASFormatter::formatPointerOrReference(void)\n{\n\tassert(currentChar == '*' || currentChar == '&' || currentChar == '^');\n\tassert(!isJavaStyle());\n\n\tint pa = pointerAlignment;\n\tint ra = referenceAlignment;\n\tint itemAlignment = (currentChar == '*' || currentChar == '^') ? pa : ((ra == REF_SAME_AS_PTR) ? pa : ra);\n\n\t// check for ** and &&\n\tchar peekedChar = peekNextChar();\n\tif ((currentChar == '*' && peekedChar == '*')\n\t        || (currentChar == '&' && peekedChar == '&'))\n\t{\n\t\tsize_t nextChar = currentLine.find_first_not_of(\" \\t\", charNum + 2);\n\t\tif (nextChar == string::npos)\n\t\t\tpeekedChar = ' ';\n\t\telse\n\t\t\tpeekedChar = currentLine[nextChar];\n\t}\n\t// check for cast\n\tif (peekedChar == ')' || peekedChar == '>' || peekedChar == ',')\n\t{\n\t\tformatPointerOrReferenceCast();\n\t\treturn;\n\t}\n\n\t// check for a padded space and remove it\n\tif (charNum > 0\n\t        && !isWhiteSpace(currentLine[charNum - 1])\n\t        && formattedLine.length() > 0\n\t        && isWhiteSpace(formattedLine[formattedLine.length() - 1]))\n\t{\n\t\tformattedLine.erase(formattedLine.length() - 1);\n\t\tspacePadNum--;\n\t}\n\n\tif (itemAlignment == PTR_ALIGN_TYPE)\n\t{\n\t\tformatPointerOrReferenceToType();\n\t}\n\telse if (itemAlignment == PTR_ALIGN_MIDDLE)\n\t{\n\t\tformatPointerOrReferenceToMiddle();\n\t}\n\telse if (itemAlignment == PTR_ALIGN_NAME)\n\t{\n\t\tformatPointerOrReferenceToName();\n\t}\n\telse\t// pointerAlignment == PTR_ALIGN_NONE\n\t{\n\t\tformattedLine.append(1, currentChar);\n\t}\n}\n\n/**\n * format pointer or reference with align to type\n */\nvoid ASFormatter::formatPointerOrReferenceToType()\n{\n\tassert(currentChar == '*' || currentChar == '&' || currentChar == '^');\n\tassert(!isJavaStyle());\n\n\t// do this before bumping charNum\n\tbool isOldPRCentered = isPointerOrReferenceCentered();\n\n\tsize_t prevCh = formattedLine.find_last_not_of(\" \\t\");\n\tif (prevCh == string::npos)\n\t\tprevCh = 0;\n\tif (formattedLine.length() == 0 || prevCh == formattedLine.length() - 1)\n\t\tformattedLine.append(1, currentChar);\n\telse\n\t{\n\t\t// exchange * or & with character following the type\n\t\t// this may not work every time with a tab character\n\t\tstring charSave = formattedLine.substr(prevCh + 1, 1);\n\t\tformattedLine[prevCh + 1] = currentChar;\n\t\tformattedLine.append(charSave);\n\t}\n\tif (isSequenceReached(\"**\") || isSequenceReached(\"&&\"))\n\t{\n\t\tif (formattedLine.length() == 1)\n\t\t\tformattedLine.append(1, currentChar);\n\t\telse\n\t\t\tformattedLine.insert(prevCh + 2, 1, currentChar);\n\t\tgoForward(1);\n\t}\n\t// if no space after then add one\n\tif (charNum < (int) currentLine.length() - 1\n\t        && !isWhiteSpace(currentLine[charNum + 1])\n\t        && currentLine[charNum + 1] != ')')\n\t\tappendSpacePad();\n\t// if old pointer or reference is centered, remove a space\n\tif (isOldPRCentered\n\t        && isWhiteSpace(formattedLine[formattedLine.length() - 1]))\n\t{\n\t\tformattedLine.erase(formattedLine.length() - 1, 1);\n\t\tspacePadNum--;\n\t}\n\t// update the formattedLine split point\n\tif (maxCodeLength != string::npos)\n\t{\n\t\tsize_t index = formattedLine.length() - 1;\n\t\tif (isWhiteSpace(formattedLine[index]))\n\t\t{\n\t\t\tupdateFormattedLineSplitPointsPointerOrReference(index);\n\t\t\ttestForTimeToSplitFormattedLine();\n\t\t}\n\t}\n}\n\n/**\n * format pointer or reference with align in the middle\n */\nvoid ASFormatter::formatPointerOrReferenceToMiddle()\n{\n\tassert(currentChar == '*' || currentChar == '&' || currentChar == '^');\n\tassert(!isJavaStyle());\n\n\t// compute current whitespace before\n\tsize_t wsBefore = currentLine.find_last_not_of(\" \\t\", charNum - 1);\n\tif (wsBefore == string::npos)\n\t\twsBefore = 0;\n\telse\n\t\twsBefore = charNum - wsBefore - 1;\n\tstring sequenceToInsert(1, currentChar);\n\tif (isSequenceReached(\"**\"))\n\t{\n\t\tsequenceToInsert = \"**\";\n\t\tgoForward(1);\n\t}\n\telse if (isSequenceReached(\"&&\"))\n\t{\n\t\tsequenceToInsert = \"&&\";\n\t\tgoForward(1);\n\t}\n\t// if reference to a pointer check for conflicting alignment\n\telse if (currentChar == '*' && peekNextChar() == '&'\n\t         && (referenceAlignment == REF_ALIGN_TYPE\n\t             || referenceAlignment == REF_ALIGN_MIDDLE\n\t             || referenceAlignment == REF_SAME_AS_PTR))\n\t{\n\t\tsequenceToInsert = \"*&\";\n\t\tgoForward(1);\n\t\tfor (size_t i = charNum; i < currentLine.length() - 1 && isWhiteSpace(currentLine[i]); i++)\n\t\t\tgoForward(1);\n\t}\n\t// if a comment follows don't align, just space pad\n\tif (isBeforeAnyComment())\n\t{\n\t\tappendSpacePad();\n\t\tformattedLine.append(sequenceToInsert);\n\t\tappendSpaceAfter();\n\t\treturn;\n\t}\n\t// do this before goForward()\n\tbool isAfterScopeResolution = previousNonWSChar == ':';\n\tsize_t charNumSave = charNum;\n\t// if this is the last thing on the line\n\tif (currentLine.find_first_not_of(\" \\t\", charNum + 1) == string::npos)\n\t{\n\t\tif (wsBefore == 0 && !isAfterScopeResolution)\n\t\t\tformattedLine.append(1, ' ');\n\t\tformattedLine.append(sequenceToInsert);\n\t\treturn;\n\t}\n\t// goForward() to convert tabs to spaces, if necessary,\n\t// and move following characters to preceding characters\n\t// this may not work every time with tab characters\n\tfor (size_t i = charNum + 1; i < currentLine.length() && isWhiteSpace(currentLine[i]); i++)\n\t{\n\t\tgoForward(1);\n\t\tif (formattedLine.length() > 0)\n\t\t\tformattedLine.append(1, currentLine[i]);\n\t\telse\n\t\t\tspacePadNum--;\n\t}\n\t// find space padding after\n\tsize_t wsAfter = currentLine.find_first_not_of(\" \\t\", charNumSave + 1);\n\tif (wsAfter == string::npos || isBeforeAnyComment())\n\t\twsAfter = 0;\n\telse\n\t\twsAfter = wsAfter - charNumSave - 1;\n\t// don't pad before scope resolution operator, but pad after\n\tif (isAfterScopeResolution)\n\t{\n\t\tsize_t lastText = formattedLine.find_last_not_of(\" \\t\");\n\t\tformattedLine.insert(lastText + 1, sequenceToInsert);\n\t\tappendSpacePad();\n\t}\n\telse if (formattedLine.length() > 0)\n\t{\n\t\t// whitespace should be at least 2 chars to center\n\t\tif (wsBefore + wsAfter < 2)\n\t\t{\n\t\t\tsize_t charsToAppend = (2 - (wsBefore + wsAfter));\n\t\t\tformattedLine.append(charsToAppend, ' ');\n\t\t\tspacePadNum += charsToAppend;\n\t\t\tif (wsBefore == 0) wsBefore++;\n\t\t\tif (wsAfter == 0) wsAfter++;\n\t\t}\n\t\t// insert the pointer or reference char\n\t\tsize_t padAfter = (wsBefore + wsAfter) / 2;\n\t\tsize_t index = formattedLine.length() - padAfter;\n\t\tformattedLine.insert(index, sequenceToInsert);\n\t}\n\telse\t// formattedLine.length() == 0\n\t{\n\t\tformattedLine.append(sequenceToInsert);\n\t\tif (wsAfter == 0)\n\t\t\twsAfter++;\n\t\tformattedLine.append(wsAfter, ' ');\n\t\tspacePadNum += wsAfter;\n\t}\n\t// update the formattedLine split point after the pointer\n\tif (maxCodeLength != string::npos && formattedLine.length() > 0)\n\t{\n\t\tsize_t index = formattedLine.find_last_not_of(\" \\t\");\n\t\tif (index != string::npos && (index < formattedLine.length() - 1))\n\t\t{\n\t\t\tindex++;\n\t\t\tupdateFormattedLineSplitPointsPointerOrReference(index);\n\t\t\ttestForTimeToSplitFormattedLine();\n\t\t}\n\t}\n}\n\n/**\n * format pointer or reference with align to name\n */\nvoid ASFormatter::formatPointerOrReferenceToName()\n{\n\tassert(currentChar == '*' || currentChar == '&' || currentChar == '^');\n\tassert(!isJavaStyle());\n\n\t// do this before bumping charNum\n\tbool isOldPRCentered = isPointerOrReferenceCentered();\n\n\tsize_t startNum = formattedLine.find_last_not_of(\" \\t\");\n\tif (startNum == string::npos)\n\t\tstartNum = 0;\n\tstring sequenceToInsert(1, currentChar);\n\tif (isSequenceReached(\"**\"))\n\t{\n\t\tsequenceToInsert = \"**\";\n\t\tgoForward(1);\n\t}\n\telse if (isSequenceReached(\"&&\"))\n\t{\n\t\tsequenceToInsert = \"&&\";\n\t\tgoForward(1);\n\t}\n\t// if reference to a pointer align both to name\n\telse if (currentChar == '*' && peekNextChar() == '&')\n\t{\n\t\tsequenceToInsert = \"*&\";\n\t\tgoForward(1);\n\t\tfor (size_t i = charNum; i < currentLine.length() - 1 && isWhiteSpace(currentLine[i]); i++)\n\t\t\tgoForward(1);\n\t}\n\tchar peekedChar = peekNextChar();\n\tbool isAfterScopeResolution = previousNonWSChar == ':';\t\t// check for ::\n\t// if this is not the last thing on the line\n\tif (!isBeforeAnyComment()\n\t        && (int) currentLine.find_first_not_of(\" \\t\", charNum + 1) > charNum)\n\t{\n\t\t// goForward() to convert tabs to spaces, if necessary,\n\t\t// and move following characters to preceding characters\n\t\t// this may not work every time with tab characters\n\t\tfor (size_t i = charNum + 1; i < currentLine.length() && isWhiteSpace(currentLine[i]); i++)\n\t\t{\n\t\t\t// if a padded paren follows don't move\n\t\t\tif (shouldPadParensOutside && peekedChar == '(' && !isOldPRCentered)\n\t\t\t{\n\t\t\t\t// empty parens don't count\n\t\t\t\tsize_t start = currentLine.find_first_not_of(\"( \\t\", charNum + 1);\n\t\t\t\tif (start != string::npos && currentLine[start] != ')')\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tgoForward(1);\n\t\t\tif (formattedLine.length() > 0)\n\t\t\t\tformattedLine.append(1, currentLine[i]);\n\t\t\telse\n\t\t\t\tspacePadNum--;\n\t\t}\n\t}\n\t// don't pad before scope resolution operator\n\tif (isAfterScopeResolution)\n\t{\n\t\tsize_t lastText = formattedLine.find_last_not_of(\" \\t\");\n\t\tif (lastText != string::npos && lastText + 1 < formattedLine.length())\n\t\t\tformattedLine.erase(lastText + 1);\n\t}\n\t// if no space before * then add one\n\telse if (formattedLine.length() > 0\n\t         && (formattedLine.length() <= startNum + 1\n\t             || !isWhiteSpace(formattedLine[startNum + 1])))\n\t{\n\t\tformattedLine.insert(startNum + 1, 1, ' ');\n\t\tspacePadNum++;\n\t}\n\tappendSequence(sequenceToInsert, false);\n\t// if old pointer or reference is centered, remove a space\n\tif (isOldPRCentered\n\t        && formattedLine.length() > startNum + 1\n\t        && isWhiteSpace(formattedLine[startNum + 1])\n\t        && !isBeforeAnyComment())\n\t{\n\t\tformattedLine.erase(startNum + 1, 1);\n\t\tspacePadNum--;\n\t}\n\t// don't convert to *= or &=\n\tif (peekedChar == '=')\n\t{\n\t\tappendSpaceAfter();\n\t\t// if more than one space before, delete one\n\t\tif (formattedLine.length() > startNum\n\t\t        && isWhiteSpace(formattedLine[startNum + 1])\n\t\t        && isWhiteSpace(formattedLine[startNum + 2]))\n\t\t{\n\t\t\tformattedLine.erase(startNum + 1, 1);\n\t\t\tspacePadNum--;\n\t\t}\n\t}\n\t// update the formattedLine split point\n\tif (maxCodeLength != string::npos)\n\t{\n\t\tsize_t index = formattedLine.find_last_of(\" \\t\");\n\t\tif (index != string::npos\n\t\t        && index < formattedLine.length() - 1\n\t\t        && (formattedLine[index + 1] == '*'\n\t\t            || formattedLine[index + 1] == '&'\n\t\t            || formattedLine[index + 1] == '^'))\n\t\t{\n\t\t\tupdateFormattedLineSplitPointsPointerOrReference(index);\n\t\t\ttestForTimeToSplitFormattedLine();\n\t\t}\n\t}\n}\n\n/**\n * format pointer or reference cast\n * currentChar contains the pointer or reference\n * NOTE: the pointers and references in function definitions\n *       are processed as a cast (e.g. void foo(void*, void*))\n *       is processed here.\n */\nvoid ASFormatter::formatPointerOrReferenceCast(void)\n{\n\tassert(currentChar == '*' || currentChar == '&' || currentChar == '^');\n\tassert(!isJavaStyle());\n\n\tint pa = pointerAlignment;\n\tint ra = referenceAlignment;\n\tint itemAlignment = (currentChar == '*' || currentChar == '^') ? pa : ((ra == REF_SAME_AS_PTR) ? pa : ra);\n\n\tstring sequenceToInsert(1, currentChar);\n\tif (isSequenceReached(\"**\") || isSequenceReached(\"&&\"))\n\t{\n\t\tgoForward(1);\n\t\tsequenceToInsert.append(1, currentLine[charNum]);\n\t}\n\tif (itemAlignment == PTR_ALIGN_NONE)\n\t{\n\t\tappendSequence(sequenceToInsert, false);\n\t\treturn;\n\t}\n\t// remove preceding whitespace\n\tchar prevCh = ' ';\n\tsize_t prevNum = formattedLine.find_last_not_of(\" \\t\");\n\tif (prevNum != string::npos)\n\t{\n\t\tprevCh = formattedLine[prevNum];\n\t\tif (prevNum + 1 < formattedLine.length()\n\t\t        && isWhiteSpace(formattedLine[prevNum + 1])\n\t\t        && prevCh != '(')\n\t\t{\n\t\t\tspacePadNum -= (formattedLine.length() - 1 - prevNum);\n\t\t\tformattedLine.erase(prevNum + 1);\n\t\t}\n\t}\n\tbool isAfterScopeResolution = previousNonWSChar == ':';\n\tif ((itemAlignment == PTR_ALIGN_MIDDLE || itemAlignment == PTR_ALIGN_NAME)\n\t        && !isAfterScopeResolution && prevCh != '(')\n\t{\n\t\tappendSpacePad();\n\t\t// in this case appendSpacePad may or may not update the split point\n\t\tif (maxCodeLength != string::npos && formattedLine.length() > 0)\n\t\t\tupdateFormattedLineSplitPointsPointerOrReference(formattedLine.length() - 1);\n\t\tappendSequence(sequenceToInsert, false);\n\t}\n\telse\n\t\tappendSequence(sequenceToInsert, false);\n\t// remove trailing whitespace if comma follows\n\tchar nextChar = peekNextChar();\n\tif (nextChar == ',')\n\t{\n\t\twhile (isWhiteSpace(currentLine[charNum + 1]))\n\t\t{\n\t\t\tgoForward(1);\n\t\t\tspacePadNum--;\n\t\t}\n\t}\n}\n\n/**\n * add or remove space padding to parens\n * currentChar contains the paren\n * the parens and necessary padding will be appended to formattedLine\n * the calling function should have a continue statement after calling this method\n */\nvoid ASFormatter::padParens(void)\n{\n\tassert(shouldPadParensOutside || shouldPadParensInside || shouldUnPadParens || shouldPadFirstParen);\n\tassert(currentChar == '(' || currentChar == ')');\n\n\tint spacesOutsideToDelete = 0;\n\tint spacesInsideToDelete = 0;\n\n\tif (currentChar == '(')\n\t{\n\t\tspacesOutsideToDelete = formattedLine.length() - 1;\n\t\tspacesInsideToDelete = 0;\n\n\t\t// compute spaces outside the opening paren to delete\n\t\tif (shouldUnPadParens)\n\t\t{\n\t\t\tchar lastChar = ' ';\n\t\t\tbool prevIsParenHeader = false;\n\t\t\tsize_t i = formattedLine.find_last_not_of(\" \\t\");\n\t\t\tif (i != string::npos)\n\t\t\t{\n\t\t\t\t// if last char is a bracket the previous whitespace is an indent\n\t\t\t\tif (formattedLine[i] == '{')\n\t\t\t\t\tspacesOutsideToDelete = 0;\n\t\t\t\telse if (isCharImmediatelyPostPointerOrReference)\n\t\t\t\t\tspacesOutsideToDelete = 0;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tspacesOutsideToDelete -= i;\n\t\t\t\t\tlastChar = formattedLine[i];\n\t\t\t\t\t// if previous word is a header, it will be a paren header\n\t\t\t\t\tstring prevWord = getPreviousWord(formattedLine, formattedLine.length());\n\t\t\t\t\tconst string* prevWordH = NULL;\n\t\t\t\t\tif (shouldPadHeader\n\t\t\t\t\t        && prevWord.length() > 0\n\t\t\t\t\t        && isCharPotentialHeader(prevWord, 0))\n\t\t\t\t\t\tprevWordH = ASBeautifier::findHeader(prevWord, 0, headers);\n\t\t\t\t\tif (prevWordH != NULL)\n\t\t\t\t\t\tprevIsParenHeader = true;\n\t\t\t\t\telse if (prevWord == \"return\")  // don't unpad\n\t\t\t\t\t\tprevIsParenHeader = true;\n\t\t\t\t\telse if (isCStyle() && prevWord == \"throw\" && shouldPadHeader) // don't unpad\n\t\t\t\t\t\tprevIsParenHeader = true;\n\t\t\t\t\telse if (prevWord == \"and\" || prevWord == \"or\")  // don't unpad\n\t\t\t\t\t\tprevIsParenHeader = true;\n\t\t\t\t\t// don't unpad variables\n\t\t\t\t\telse if (prevWord == \"bool\"\n\t\t\t\t\t         || prevWord == \"int\"\n\t\t\t\t\t         || prevWord == \"void\"\n\t\t\t\t\t         || prevWord == \"void*\"\n\t\t\t\t\t         || prevWord == \"char\"\n\t\t\t\t\t         || prevWord == \"long\"\n\t\t\t\t\t         || prevWord == \"double\"\n\t\t\t\t\t         || prevWord == \"float\"\n\t\t\t\t\t         || (prevWord.length() >= 4     // check end of word for _t\n\t\t\t\t\t             && prevWord.compare(prevWord.length() - 2, 2, \"_t\") == 0)\n\t\t\t\t\t         || prevWord == \"Int32\"\n\t\t\t\t\t         || prevWord == \"UInt32\"\n\t\t\t\t\t         || prevWord == \"Int64\"\n\t\t\t\t\t         || prevWord == \"UInt64\"\n\t\t\t\t\t         || prevWord == \"BOOL\"\n\t\t\t\t\t         || prevWord == \"DWORD\"\n\t\t\t\t\t         || prevWord == \"HWND\"\n\t\t\t\t\t         || prevWord == \"INT\"\n\t\t\t\t\t         || prevWord == \"LPSTR\"\n\t\t\t\t\t         || prevWord == \"VOID\"\n\t\t\t\t\t         || prevWord == \"LPVOID\"\n\t\t\t\t\t        )\n\t\t\t\t\t{\n\t\t\t\t\t\tprevIsParenHeader = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// do not unpad operators, but leave them if already padded\n\t\t\tif (shouldPadParensOutside || prevIsParenHeader)\n\t\t\t\tspacesOutsideToDelete--;\n\t\t\telse if (lastChar == '|'          // check for ||\n\t\t\t         || lastChar == '&'       // check for &&\n\t\t\t         || lastChar == ','\n\t\t\t         || (lastChar == '(' && shouldPadParensInside)\n\t\t\t         || (lastChar == '>' && !foundCastOperator)\n\t\t\t         || lastChar == '<'\n\t\t\t         || lastChar == '?'\n\t\t\t         || lastChar == ':'\n\t\t\t         || lastChar == ';'\n\t\t\t         || lastChar == '='\n\t\t\t         || lastChar == '+'\n\t\t\t         || lastChar == '-'\n\t\t\t         || lastChar == '*'\n\t\t\t         || lastChar == '/'\n\t\t\t         || lastChar == '%'\n\t\t\t         || lastChar == '^'\n\t\t\t        )\n\t\t\t\tspacesOutsideToDelete--;\n\n\t\t\tif (spacesOutsideToDelete > 0)\n\t\t\t{\n\t\t\t\tformattedLine.erase(i + 1, spacesOutsideToDelete);\n\t\t\t\tspacePadNum -= spacesOutsideToDelete;\n\t\t\t}\n\t\t}\n\n\t\t// pad open paren outside\n\t\tchar peekedCharOutside = peekNextChar();\n\t\tif (shouldPadFirstParen && previousChar != '(' && peekedCharOutside != ')')\n\t\t\tappendSpacePad();\n\t\telse if (shouldPadParensOutside)\n\t\t{\n\t\t\tif (!(currentChar == '(' && peekedCharOutside == ')'))\n\t\t\t\tappendSpacePad();\n\t\t}\n\n\t\tappendCurrentChar();\n\n\t\t// unpad open paren inside\n\t\tif (shouldUnPadParens)\n\t\t{\n\t\t\tsize_t j = currentLine.find_first_not_of(\" \\t\", charNum + 1);\n\t\t\tif (j != string::npos)\n\t\t\t\tspacesInsideToDelete = j - charNum - 1;\n\t\t\tif (shouldPadParensInside)\n\t\t\t\tspacesInsideToDelete--;\n\t\t\tif (spacesInsideToDelete > 0)\n\t\t\t{\n\t\t\t\tcurrentLine.erase(charNum + 1, spacesInsideToDelete);\n\t\t\t\tspacePadNum -= spacesInsideToDelete;\n\t\t\t}\n\t\t\t// convert tab to space if requested\n\t\t\tif (shouldConvertTabs\n\t\t\t        && (int) currentLine.length() > charNum + 1\n\t\t\t        && currentLine[charNum + 1] == '\\t')\n\t\t\t\tcurrentLine[charNum + 1] = ' ';\n\t\t}\n\n\t\t// pad open paren inside\n\t\tchar peekedCharInside = peekNextChar();\n\t\tif (shouldPadParensInside)\n\t\t\tif (!(currentChar == '(' && peekedCharInside == ')'))\n\t\t\t\tappendSpaceAfter();\n\t}\n\telse if (currentChar == ')')\n\t{\n\t\t// unpad close paren inside\n\t\tif (shouldUnPadParens)\n\t\t{\n\t\t\tspacesInsideToDelete = formattedLine.length();\n\t\t\tsize_t i = formattedLine.find_last_not_of(\" \\t\");\n\t\t\tif (i != string::npos)\n\t\t\t\tspacesInsideToDelete = formattedLine.length() - 1 - i;\n\t\t\tif (shouldPadParensInside)\n\t\t\t\tspacesInsideToDelete--;\n\t\t\tif (spacesInsideToDelete > 0)\n\t\t\t{\n\t\t\t\tformattedLine.erase(i + 1, spacesInsideToDelete);\n\t\t\t\tspacePadNum -= spacesInsideToDelete;\n\t\t\t}\n\t\t}\n\n\t\t// pad close paren inside\n\t\tif (shouldPadParensInside)\n\t\t\tif (!(previousChar == '(' && currentChar == ')'))\n\t\t\t\tappendSpacePad();\n\n\t\tappendCurrentChar();\n\n\t\t// unpad close paren outside\n\t\t// close parens outside are left unchanged\n\t\tif (shouldUnPadParens)\n\t\t{\n\t\t\t//spacesOutsideToDelete = 0;\n\t\t\t//size_t j = currentLine.find_first_not_of(\" \\t\", charNum + 1);\n\t\t\t//if (j != string::npos)\n\t\t\t//\tspacesOutsideToDelete = j - charNum - 1;\n\t\t\t//if (shouldPadParensOutside)\n\t\t\t//\tspacesOutsideToDelete--;\n\n\t\t\t//if (spacesOutsideToDelete > 0)\n\t\t\t//{\n\t\t\t//\tcurrentLine.erase(charNum + 1, spacesOutsideToDelete);\n\t\t\t//\tspacePadNum -= spacesOutsideToDelete;\n\t\t\t//}\n\t\t}\n\n\t\t// pad close paren outside\n\t\tchar peekedCharOutside = peekNextChar();\n\t\tif (shouldPadParensOutside)\n\t\t\tif (peekedCharOutside != ';'\n\t\t\t        && peekedCharOutside != ','\n\t\t\t        && peekedCharOutside != '.'\n\t\t\t        && peekedCharOutside != '+'    // check for ++\n\t\t\t        && peekedCharOutside != '-'    // check for --\n\t\t\t        && peekedCharOutside != ']')\n\t\t\t\tappendSpaceAfter();\n\t}\n\treturn;\n}\n\n/**\n * format opening bracket as attached or broken\n * currentChar contains the bracket\n * the brackets will be appended to the current formattedLine or a new formattedLine as necessary\n * the calling function should have a continue statement after calling this method\n *\n * @param bracketType    the type of bracket to be formatted.\n */\nvoid ASFormatter::formatOpeningBracket(BracketType bracketType)\n{\n\tassert(!isBracketType(bracketType, ARRAY_TYPE));\n\tassert(currentChar == '{');\n\n\tparenStack->push_back(0);\n\n\tbool breakBracket = isCurrentBracketBroken();\n\n\tif (breakBracket)\n\t{\n\t\tif (isBeforeAnyComment() && isOkToBreakBlock(bracketType))\n\t\t{\n\t\t\t// if comment is at line end leave the comment on this line\n\t\t\tif (isBeforeAnyLineEndComment(charNum) && !currentLineBeginsWithBracket)\n\t\t\t{\n\t\t\t\tcurrentChar = ' ';              // remove bracket from current line\n\t\t\t\tif (parenStack->size() > 1)\n\t\t\t\t\tparenStack->pop_back();\n\t\t\t\tcurrentLine[charNum] = currentChar;\n\t\t\t\tappendOpeningBracket = true;    // append bracket to following line\n\t\t\t}\n\t\t\t// else put comment after the bracket\n\t\t\telse if (!isBeforeMultipleLineEndComments(charNum))\n\t\t\t\tbreakLine();\n\t\t}\n\t\telse if (!isBracketType(bracketType, SINGLE_LINE_TYPE))\n\t\t\tbreakLine();\n\t\telse if (shouldBreakOneLineBlocks && peekNextChar() != '}')\n\t\t\tbreakLine();\n\t\telse if (!isInLineBreak)\n\t\t\tappendSpacePad();\n\n\t\tappendCurrentChar();\n\n\t\t// should a following comment break from the bracket?\n\t\t// must break the line AFTER the bracket\n\t\tif (isBeforeComment()\n\t\t        && formattedLine.length() > 0\n\t\t        && formattedLine[0] == '{'\n\t\t        && isOkToBreakBlock(bracketType)\n\t\t        && (bracketFormatMode == BREAK_MODE\n\t\t            || bracketFormatMode == LINUX_MODE\n\t\t            || bracketFormatMode == STROUSTRUP_MODE))\n\t\t{\n\t\t\tshouldBreakLineAtNextChar = true;\n\t\t}\n\t}\n\telse    // attach bracket\n\t{\n\t\t// are there comments before the bracket?\n\t\tif (isCharImmediatelyPostComment || isCharImmediatelyPostLineComment)\n\t\t{\n\t\t\tif (isOkToBreakBlock(bracketType)\n\t\t\t        && !(isCharImmediatelyPostComment && isCharImmediatelyPostLineComment)\t// don't attach if two comments on the line\n\t\t\t        && !isImmediatelyPostPreprocessor\n//\t\t\t        && peekNextChar() != '}'\t\t// don't attach { }\t\t// removed release 2.03\n\t\t\t        && previousCommandChar != '{'\t// don't attach { {\n\t\t\t        && previousCommandChar != '}'\t// don't attach } {\n\t\t\t        && previousCommandChar != ';')\t// don't attach ; {\n\t\t\t{\n\t\t\t\tappendCharInsideComments();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tappendCurrentChar();\t\t\t\t// don't attach\n\t\t\t}\n\t\t}\n\t\telse if (previousCommandChar == '{'\n\t\t         || (previousCommandChar == '}' && !isInClassInitializer)\n\t\t         || previousCommandChar == ';')\t\t// '}' , ';' chars added for proper handling of '{' immediately after a '}' or ';'\n\t\t{\n\t\t\tappendCurrentChar();\t\t\t\t\t// don't attach\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// if a blank line precedes this don't attach\n\t\t\tif (isEmptyLine(formattedLine))\n\t\t\t\tappendCurrentChar();\t\t\t\t// don't attach\n\t\t\telse if (isOkToBreakBlock(bracketType)\n\t\t\t         && !(isImmediatelyPostPreprocessor\n\t\t\t              && currentLineBeginsWithBracket))\n\t\t\t{\n\t\t\t\tif (peekNextChar() != '}')\n\t\t\t\t{\n\t\t\t\t\tappendSpacePad();\n\t\t\t\t\tappendCurrentChar(false);\t\t\t\t// OK to attach\n\t\t\t\t\ttestForTimeToSplitFormattedLine();\t\t// line length will have changed\n\t\t\t\t\t// should a following comment attach with the bracket?\n\t\t\t\t\t// insert spaces to reposition the comment\n\t\t\t\t\tif (isBeforeComment()\n\t\t\t\t\t        && !isBeforeMultipleLineEndComments(charNum)\n\t\t\t\t\t        && (!isBeforeAnyLineEndComment(charNum)\t|| currentLineBeginsWithBracket))\n\t\t\t\t\t{\n\t\t\t\t\t\tshouldBreakLineAtNextChar = true;\n\t\t\t\t\t\tcurrentLine.insert(charNum + 1, charNum + 1, ' ');\n\t\t\t\t\t}\n\t\t\t\t\telse if (!isBeforeAnyComment())\t\t// added in release 2.03\n\t\t\t\t\t{\n\t\t\t\t\t\tshouldBreakLineAtNextChar = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (currentLineBeginsWithBracket && charNum == (int) currentLineFirstBracketNum)\n\t\t\t\t\t{\n\t\t\t\t\t\tappendSpacePad();\n\t\t\t\t\t\tappendCurrentChar(false);\t\t// attach\n\t\t\t\t\t\tshouldBreakLineAtNextChar = true;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tappendSpacePad();\n\t\t\t\t\t\tappendCurrentChar();\t\t// don't attach\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (!isInLineBreak)\n\t\t\t\t\tappendSpacePad();\n\t\t\t\tappendCurrentChar();\t\t\t\t// don't attach\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * format closing bracket\n * currentChar contains the bracket\n * the calling function should have a continue statement after calling this method\n *\n * @param bracketType    the type of the opening bracket for this closing bracket.\n */\nvoid ASFormatter::formatClosingBracket(BracketType bracketType)\n{\n\tassert(!isBracketType(bracketType, ARRAY_TYPE));\n\tassert(currentChar == '}');\n\n\t// parenStack must contain one entry\n\tif (parenStack->size() > 1)\n\t\tparenStack->pop_back();\n\n\t// mark state of immediately after empty block\n\t// this state will be used for locating brackets that appear immediately AFTER an empty block (e.g. '{} \\n}').\n\tif (previousCommandChar == '{')\n\t\tisImmediatelyPostEmptyBlock = true;\n\n\tif (attachClosingBracketMode)\n\t{\n\t\t// for now, namespaces and classes will be attached. Uncomment the lines below to break.\n\t\tif ((isEmptyLine(formattedLine)\t\t\t// if a blank line precedes this\n\t\t        || isCharImmediatelyPostLineComment\n\t\t        || isCharImmediatelyPostComment\n\t\t        || (isImmediatelyPostPreprocessor && (int) currentLine.find_first_not_of(\" \\t\") == charNum)\n//\t\t        || (isBracketType(bracketType, CLASS_TYPE) && isOkToBreakBlock(bracketType) && previousNonWSChar != '{')\n//\t\t        || (isBracketType(bracketType, NAMESPACE_TYPE) && isOkToBreakBlock(bracketType) && previousNonWSChar != '{')\n\t\t    )\n\t\t        && (!isBracketType(bracketType, SINGLE_LINE_TYPE) || isOkToBreakBlock(bracketType)))\n\t\t{\n\t\t\tbreakLine();\n\t\t\tappendCurrentChar();\t\t\t\t// don't attach\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (previousNonWSChar != '{'\n\t\t\t        && (!isBracketType(bracketType, SINGLE_LINE_TYPE) || isOkToBreakBlock(bracketType)))\n\t\t\t\tappendSpacePad();\n\t\t\tappendCurrentChar(false);\t\t\t// attach\n\t\t}\n\t}\n\telse if ((!(previousCommandChar == '{' && isPreviousBracketBlockRelated))\t// this '}' does not close an empty block\n\t         && isOkToBreakBlock(bracketType))\t\t\t\t\t\t\t\t\t// astyle is allowed to break one line blocks\n\t{\n\t\tbreakLine();\n\t\tappendCurrentChar();\n\t}\n\telse\n\t{\n\t\tappendCurrentChar();\n\t}\n\n\t// if a declaration follows a definition, space pad\n\tif (isLegalNameChar(peekNextChar()))\n\t\tappendSpaceAfter();\n\n\tif (shouldBreakBlocks\n\t        && currentHeader != NULL\n\t        && !isHeaderInMultiStatementLine\n\t        && parenStack->back() == 0)\n\t{\n\t\tif (currentHeader == &AS_CASE || currentHeader == &AS_DEFAULT)\n\t\t{\n\t\t\t// do not yet insert a line if \"break\" statement is outside the brackets\n\t\t\tstring nextText = peekNextText(currentLine.substr(charNum + 1));\n\t\t\tif (nextText.length() > 0\n\t\t\t        && nextText.substr(0, 5) != \"break\")\n\t\t\t\tisAppendPostBlockEmptyLineRequested = true;\n\t\t}\n\t\telse\n\t\t\tisAppendPostBlockEmptyLineRequested = true;\n\t}\n}\n\n/**\n * format array brackets as attached or broken\n * determine if the brackets can have an inStatement indent\n * currentChar contains the bracket\n * the brackets will be appended to the current formattedLine or a new formattedLine as necessary\n * the calling function should have a continue statement after calling this method\n *\n * @param bracketType            the type of bracket to be formatted, must be an ARRAY_TYPE.\n * @param isOpeningArrayBracket  indicates if this is the opening bracket for the array block.\n */\nvoid ASFormatter::formatArrayBrackets(BracketType bracketType, bool isOpeningArrayBracket)\n{\n\tassert(isBracketType(bracketType, ARRAY_TYPE));\n\tassert(currentChar == '{' || currentChar == '}');\n\n\tif (currentChar == '{')\n\t{\n\t\t// is this the first opening bracket in the array?\n\t\tif (isOpeningArrayBracket)\n\t\t{\n\t\t\tif (bracketFormatMode == ATTACH_MODE\n\t\t\t        || bracketFormatMode == LINUX_MODE\n\t\t\t        || bracketFormatMode == STROUSTRUP_MODE)\n\t\t\t{\n\t\t\t\t// don't attach to a preprocessor directive or '\\' line\n\t\t\t\tif ((isImmediatelyPostPreprocessor\n\t\t\t\t        || (formattedLine.length() > 0\n\t\t\t\t            && formattedLine[formattedLine.length() - 1] == '\\\\'))\n\t\t\t\t        && currentLineBeginsWithBracket)\n\t\t\t\t{\n\t\t\t\t\tisInLineBreak = true;\n\t\t\t\t\tappendCurrentChar();                // don't attach\n\t\t\t\t}\n\t\t\t\telse if (isCharImmediatelyPostComment)\n\t\t\t\t{\n\t\t\t\t\t// TODO: attach bracket to line-end comment\n\t\t\t\t\tappendCurrentChar();                // don't attach\n\t\t\t\t}\n\t\t\t\telse if (isCharImmediatelyPostLineComment && !isBracketType(bracketType, SINGLE_LINE_TYPE))\n\t\t\t\t{\n\t\t\t\t\tappendCharInsideComments();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// if a blank line precedes this don't attach\n\t\t\t\t\tif (isEmptyLine(formattedLine))\n\t\t\t\t\t\tappendCurrentChar();            // don't attach\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t// if bracket is broken or not an assignment\n\t\t\t\t\t\tif (currentLineBeginsWithBracket\n\t\t\t\t\t\t        && !isBracketType(bracketType, SINGLE_LINE_TYPE))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tappendSpacePad();\n\t\t\t\t\t\t\tappendCurrentChar(false);\t\t\t\t// OK to attach\n\t\t\t\t\t\t\t// TODO: debug the following line\n\t\t\t\t\t\t\ttestForTimeToSplitFormattedLine();\t\t// line length will have changed\n\n\t\t\t\t\t\t\tif (currentLineBeginsWithBracket\n\t\t\t\t\t\t\t        && (int) currentLineFirstBracketNum == charNum)\n\t\t\t\t\t\t\t\tshouldBreakLineAtNextChar = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (previousNonWSChar != '(')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// don't space pad C++11 uniform initialization\n\t\t\t\t\t\t\t\tif (!isBracketType(bracketType, INIT_TYPE))\n\t\t\t\t\t\t\t\t\tappendSpacePad();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tappendCurrentChar();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (bracketFormatMode == BREAK_MODE)\n\t\t\t{\n\t\t\t\tif (isWhiteSpace(peekNextChar()))\n\t\t\t\t\tbreakLine();\n\t\t\t\telse if (isBeforeAnyComment())\n\t\t\t\t{\n\t\t\t\t\t// do not break unless comment is at line end\n\t\t\t\t\tif (isBeforeAnyLineEndComment(charNum) && !currentLineBeginsWithBracket)\n\t\t\t\t\t{\n\t\t\t\t\t\tcurrentChar = ' ';              // remove bracket from current line\n\t\t\t\t\t\tappendOpeningBracket = true;    // append bracket to following line\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!isInLineBreak && previousNonWSChar != '(')\n\t\t\t\t{\n\t\t\t\t\t// don't space pad C++11 uniform initialization\n\t\t\t\t\tif (!isBracketType(bracketType, INIT_TYPE))\n\t\t\t\t\t\tappendSpacePad();\n\t\t\t\t}\n\t\t\t\tappendCurrentChar();\n\n\t\t\t\tif (currentLineBeginsWithBracket\n\t\t\t\t        && (int) currentLineFirstBracketNum == charNum\n\t\t\t\t        && !isBracketType(bracketType, SINGLE_LINE_TYPE))\n\t\t\t\t\tshouldBreakLineAtNextChar = true;\n\t\t\t}\n\t\t\telse if (bracketFormatMode == RUN_IN_MODE)\n\t\t\t{\n\t\t\t\tif (isWhiteSpace(peekNextChar()))\n\t\t\t\t\tbreakLine();\n\t\t\t\telse if (isBeforeAnyComment())\n\t\t\t\t{\n\t\t\t\t\t// do not break unless comment is at line end\n\t\t\t\t\tif (isBeforeAnyLineEndComment(charNum) && !currentLineBeginsWithBracket)\n\t\t\t\t\t{\n\t\t\t\t\t\tcurrentChar = ' ';              // remove bracket from current line\n\t\t\t\t\t\tappendOpeningBracket = true;    // append bracket to following line\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!isInLineBreak && previousNonWSChar != '(')\n\t\t\t\t{\n\t\t\t\t\t// don't space pad C++11 uniform initialization\n\t\t\t\t\tif (!isBracketType(bracketType, INIT_TYPE))\n\t\t\t\t\t\tappendSpacePad();\n\t\t\t\t}\n\t\t\t\tappendCurrentChar();\n\t\t\t}\n\t\t\telse if (bracketFormatMode == NONE_MODE)\n\t\t\t{\n\t\t\t\tif (currentLineBeginsWithBracket\n\t\t\t\t        && charNum == (int) currentLineFirstBracketNum)\n\t\t\t\t{\n\t\t\t\t\tappendCurrentChar();                // don't attach\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (previousNonWSChar != '(')\n\t\t\t\t\t{\n\t\t\t\t\t\t// don't space pad C++11 uniform initialization\n\t\t\t\t\t\tif (!isBracketType(bracketType, INIT_TYPE))\n\t\t\t\t\t\t\tappendSpacePad();\n\t\t\t\t\t}\n\t\t\t\t\tappendCurrentChar(false);           // OK to attach\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\t     // not the first opening bracket\n\t\t{\n\t\t\tif (bracketFormatMode == RUN_IN_MODE)\n\t\t\t{\n\t\t\t\tif (previousNonWSChar == '{'\n\t\t\t\t        && bracketTypeStack->size() > 2\n\t\t\t\t        && !isBracketType((*bracketTypeStack)[bracketTypeStack->size() - 2], SINGLE_LINE_TYPE))\n\t\t\t\t\tformatArrayRunIn();\n\t\t\t}\n\t\t\telse if (!isInLineBreak\n\t\t\t         && !isWhiteSpace(peekNextChar())\n\t\t\t         && previousNonWSChar == '{'\n\t\t\t         && bracketTypeStack->size() > 2\n\t\t\t         && !isBracketType((*bracketTypeStack)[bracketTypeStack->size() - 2], SINGLE_LINE_TYPE))\n\t\t\t\tformatArrayRunIn();\n\n\t\t\tappendCurrentChar();\n\t\t}\n\t}\n\telse if (currentChar == '}')\n\t{\n\t\tif (attachClosingBracketMode)\n\t\t{\n\t\t\tif (isEmptyLine(formattedLine)\t\t\t// if a blank line precedes this\n\t\t\t        || isImmediatelyPostPreprocessor\n\t\t\t        || isCharImmediatelyPostLineComment\n\t\t\t        || isCharImmediatelyPostComment)\n\t\t\t\tappendCurrentChar();\t\t\t\t// don't attach\n\t\t\telse\n\t\t\t{\n\t\t\t\tappendSpacePad();\n\t\t\t\tappendCurrentChar(false);\t\t\t// attach\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// does this close the first opening bracket in the array?\n\t\t\t// must check if the block is still a single line because of anonymous statements\n\t\t\tif (!isBracketType(bracketType, INIT_TYPE)\n\t\t\t        && (!isBracketType(bracketType, SINGLE_LINE_TYPE)\n\t\t\t            || formattedLine.find('{') == string::npos))\n\t\t\t\tbreakLine();\n\t\t\tappendCurrentChar();\n\t\t}\n\n\t\t// if a declaration follows an enum definition, space pad\n\t\tchar peekedChar = peekNextChar();\n\t\tif (isLegalNameChar(peekedChar)\n\t\t        || peekedChar == '[')\n\t\t\tappendSpaceAfter();\n\t}\n}\n\n/**\n * determine if a run-in can be attached.\n * if it can insert the indents in formattedLine and reset the current line break.\n */\nvoid ASFormatter::formatRunIn()\n{\n\tassert(bracketFormatMode == RUN_IN_MODE || bracketFormatMode == NONE_MODE);\n\n\t// keep one line blocks returns true without indenting the run-in\n\tif (!isOkToBreakBlock(bracketTypeStack->back()))\n\t\treturn; // true;\n\n\t// make sure the line begins with a bracket\n\tsize_t lastText = formattedLine.find_last_not_of(\" \\t\");\n\tif (lastText == string::npos || formattedLine[lastText] != '{')\n\t\treturn; // false;\n\n\t// make sure the bracket is broken\n\tif (formattedLine.find_first_not_of(\" \\t{\") != string::npos)\n\t\treturn; // false;\n\n\tif (isBracketType(bracketTypeStack->back(), NAMESPACE_TYPE))\n\t\treturn; // false;\n\n\tbool extraIndent = false;\n\tbool extraHalfIndent = false;\n\tisInLineBreak = true;\n\n\t// cannot attach a class modifier without indent-classes\n\tif (isCStyle()\n\t        && isCharPotentialHeader(currentLine, charNum)\n\t        && (isBracketType(bracketTypeStack->back(), CLASS_TYPE)\n\t            || (isBracketType(bracketTypeStack->back(), STRUCT_TYPE)\n\t                && isInIndentableStruct)))\n\t{\n\t\tif (findKeyword(currentLine, charNum, AS_PUBLIC)\n\t\t        || findKeyword(currentLine, charNum, AS_PRIVATE)\n\t\t        || findKeyword(currentLine, charNum, AS_PROTECTED))\n\t\t{\n\t\t\tif (getModifierIndent())\n\t\t\t\textraHalfIndent = true;\n\t\t\telse if (!getClassIndent())\n\t\t\t\treturn; // false;\n\t\t}\n\t\telse if (getClassIndent())\n\t\t\textraIndent = true;\n\t}\n\n\t// cannot attach a 'case' statement without indent-switches\n\tif (!getSwitchIndent()\n\t        && isCharPotentialHeader(currentLine, charNum)\n\t        && (findKeyword(currentLine, charNum, AS_CASE)\n\t            || findKeyword(currentLine, charNum, AS_DEFAULT)))\n\t\treturn; // false;\n\n\t// extra indent for switch statements\n\tif (getSwitchIndent()\n\t        && !preBracketHeaderStack->empty()\n\t        && preBracketHeaderStack->back() == &AS_SWITCH\n\t        && ((isLegalNameChar(currentChar)\n\t             && !findKeyword(currentLine, charNum, AS_CASE))))\n\t\textraIndent = true;\n\n\tisInLineBreak = false;\n\t// remove for extra whitespace\n\tif (formattedLine.length() > lastText + 1\n\t        && formattedLine.find_first_not_of(\" \\t\", lastText + 1) == string::npos)\n\t\tformattedLine.erase(lastText + 1);\n\n\tif (extraHalfIndent)\n\t{\n\t\tint indentLength_ = getIndentLength();\n\t\thorstmannIndentChars = indentLength_ / 2;\n\t\tformattedLine.append(horstmannIndentChars - 1, ' ');\n\t}\n\telse if (getForceTabIndentation() && getIndentLength() != getTabLength())\n\t{\n\t\t// insert the space indents\n\t\tstring indent;\n\t\tint indentLength_ = getIndentLength();\n\t\tint tabLength_ = getTabLength();\n\t\tindent.append(indentLength_, ' ');\n\t\tif (extraIndent)\n\t\t\tindent.append(indentLength_, ' ');\n\t\t// replace spaces indents with tab indents\n\t\tsize_t tabCount = indent.length() / tabLength_;\t\t// truncate extra spaces\n\t\tindent.erase(0U, tabCount * tabLength_);\n\t\tindent.insert(0U, tabCount, '\\t');\n\t\thorstmannIndentChars = indentLength_;\n\t\tif (indent[0] == ' ')\t\t\t// allow for bracket\n\t\t\tindent.erase(0, 1);\n\t\tformattedLine.append(indent);\n\t}\n\telse if (getIndentString() == \"\\t\")\n\t{\n\t\tappendChar('\\t', false);\n\t\thorstmannIndentChars = 2;\t// one for { and one for tab\n\t\tif (extraIndent)\n\t\t{\n\t\t\tappendChar('\\t', false);\n\t\t\thorstmannIndentChars++;\n\t\t}\n\t}\n\telse // spaces\n\t{\n\t\tint indentLength_ = getIndentLength();\n\t\tformattedLine.append(indentLength_ - 1, ' ');\n\t\thorstmannIndentChars = indentLength_;\n\t\tif (extraIndent)\n\t\t{\n\t\t\tformattedLine.append(indentLength_, ' ');\n\t\t\thorstmannIndentChars += indentLength_;\n\t\t}\n\t}\n\tisInHorstmannRunIn = true;\n}\n\n/**\n * remove whitespace and add indentation for an array run-in.\n */\nvoid ASFormatter::formatArrayRunIn()\n{\n\tassert(isBracketType(bracketTypeStack->back(), ARRAY_TYPE));\n\n\t// make sure the bracket is broken\n\tif (formattedLine.find_first_not_of(\" \\t{\") != string::npos)\n\t\treturn;\n\n\tsize_t lastText = formattedLine.find_last_not_of(\" \\t\");\n\tif (lastText == string::npos || formattedLine[lastText] != '{')\n\t\treturn;\n\n\t// check for extra whitespace\n\tif (formattedLine.length() > lastText + 1\n\t        && formattedLine.find_first_not_of(\" \\t\", lastText + 1) == string::npos)\n\t\tformattedLine.erase(lastText + 1);\n\n\tif (getIndentString() == \"\\t\")\n\t{\n\t\tappendChar('\\t', false);\n\t\thorstmannIndentChars = 2;\t// one for { and one for tab\n\t}\n\telse\n\t{\n\t\tint indent = getIndentLength();\n\t\tformattedLine.append(indent - 1, ' ');\n\t\thorstmannIndentChars = indent;\n\t}\n\tisInHorstmannRunIn = true;\n\tisInLineBreak = false;\n}\n\n/**\n * delete a bracketTypeStack vector object\n * BracketTypeStack did not work with the DeleteContainer template\n */\nvoid ASFormatter::deleteContainer(vector<BracketType>* &container)\n{\n\tif (container != NULL)\n\t{\n\t\tcontainer->clear();\n\t\tdelete (container);\n\t\tcontainer = NULL;\n\t}\n}\n\n/**\n * delete a vector object\n * T is the type of vector\n * used for all vectors except bracketTypeStack\n */\ntemplate<typename T>\nvoid ASFormatter::deleteContainer(T &container)\n{\n\tif (container != NULL)\n\t{\n\t\tcontainer->clear();\n\t\tdelete (container);\n\t\tcontainer = NULL;\n\t}\n}\n\n/**\n * initialize a BracketType vector object\n * BracketType did not work with the DeleteContainer template\n */\nvoid ASFormatter::initContainer(vector<BracketType>* &container, vector<BracketType>* value)\n{\n\tif (container != NULL)\n\t\tdeleteContainer(container);\n\tcontainer = value;\n}\n\n/**\n * initialize a vector object\n * T is the type of vector\n * used for all vectors except bracketTypeStack\n */\ntemplate<typename T>\nvoid ASFormatter::initContainer(T &container, T value)\n{\n\t// since the ASFormatter object is never deleted,\n\t// the existing vectors must be deleted before creating new ones\n\tif (container != NULL)\n\t\tdeleteContainer(container);\n\tcontainer = value;\n}\n\n/**\n * convert a tab to spaces.\n * charNum points to the current character to convert to spaces.\n * tabIncrementIn is the increment that must be added for tab indent characters\n *     to get the correct column for the current tab.\n * replaces the tab in currentLine with the required number of spaces.\n * replaces the value of currentChar.\n */\nvoid ASFormatter::convertTabToSpaces()\n{\n\tassert(currentLine[charNum] == '\\t');\n\n\t// do NOT replace if in quotes\n\tif (isInQuote || isInQuoteContinuation)\n\t\treturn;\n\n\tsize_t tabSize = getTabLength();\n\tsize_t numSpaces = tabSize - ((tabIncrementIn + charNum) % tabSize);\n\tcurrentLine.replace(charNum, 1, numSpaces, ' ');\n\tcurrentChar = currentLine[charNum];\n}\n\n/**\n* is it ok to break this block?\n*/\nbool ASFormatter::isOkToBreakBlock(BracketType bracketType) const\n{\n\t// Actually, there should not be an ARRAY_TYPE bracket here.\n\t// But this will avoid breaking a one line block when there is.\n\t// Otherwise they will be formatted differently on consecutive runs.\n\tif (isBracketType(bracketType, ARRAY_TYPE)\n\t        && isBracketType(bracketType, SINGLE_LINE_TYPE))\n\t\treturn false;\n\tif (!isBracketType(bracketType, SINGLE_LINE_TYPE)\n\t        || shouldBreakOneLineBlocks\n\t        || breakCurrentOneLineBlock)\n\t\treturn true;\n\treturn false;\n}\n\n/**\n* check if a sharp header is a paren or non-paren header\n*/\nbool ASFormatter::isSharpStyleWithParen(const string* header) const\n{\n\tif (isSharpStyle() && peekNextChar() == '('\n\t        && (header == &AS_CATCH\n\t            || header == &AS_DELEGATE))\n\t\treturn true;\n\treturn false;\n}\n\n/**\n * Check for a following header when a comment is reached.\n * firstLine must contain the start of the comment.\n * return value is a pointer to the header or NULL.\n */\nconst string* ASFormatter::checkForHeaderFollowingComment(const string &firstLine) const\n{\n\tassert(isInComment || isInLineComment);\n\tassert(shouldBreakElseIfs || shouldBreakBlocks || isInSwitchStatement());\n\t// look ahead to find the next non-comment text\n\tbool endOnEmptyLine = (currentHeader == NULL);\n\tif (isInSwitchStatement())\n\t\tendOnEmptyLine = false;\n\tstring nextText = peekNextText(firstLine, endOnEmptyLine);\n\n\tif (nextText.length() == 0 || !isCharPotentialHeader(nextText, 0))\n\t\treturn NULL;\n\n\treturn ASBeautifier::findHeader(nextText, 0, headers);\n}\n\n/**\n * process preprocessor statements.\n * charNum should be the index of the #.\n *\n * delete bracketTypeStack entries added by #if if a #else is found.\n * prevents double entries in the bracketTypeStack.\n */\nvoid ASFormatter::processPreprocessor()\n{\n\tassert(currentChar == '#');\n\n\tconst size_t preproc = currentLine.find_first_not_of(\" \\t\", charNum + 1);\n\n\tif (preproc == string::npos)\n\t\treturn;\n\n\tif (currentLine.compare(preproc, 2, \"if\") == 0)\n\t{\n\t\tpreprocBracketTypeStackSize = bracketTypeStack->size();\n\t}\n\telse if (currentLine.compare(preproc, 4, \"else\") == 0)\n\t{\n\t\t// delete stack entries added in #if\n\t\t// should be replaced by #else\n\t\tif (preprocBracketTypeStackSize > 0)\n\t\t{\n\t\t\tint addedPreproc = bracketTypeStack->size() - preprocBracketTypeStackSize;\n\t\t\tfor (int i = 0; i < addedPreproc; i++)\n\t\t\t\tbracketTypeStack->pop_back();\n\t\t}\n\t}\n}\n\n/**\n * determine if the next line starts a comment\n * and a header follows the comment or comments.\n */\nbool ASFormatter::commentAndHeaderFollows()\n{\n\t// called ONLY IF shouldDeleteEmptyLines and shouldBreakBlocks are TRUE.\n\tassert(shouldDeleteEmptyLines && shouldBreakBlocks);\n\n\t// is the next line a comment\n\tif (!sourceIterator->hasMoreLines())\n\t\treturn false;\n\tstring nextLine_ = sourceIterator->peekNextLine();\n\tsize_t firstChar = nextLine_.find_first_not_of(\" \\t\");\n\tif (firstChar == string::npos\n\t        || !(nextLine_.compare(firstChar, 2, \"//\") == 0\n\t             || nextLine_.compare(firstChar, 2, \"/*\") == 0))\n\t{\n\t\tsourceIterator->peekReset();\n\t\treturn false;\n\t}\n\n\t// find the next non-comment text, and reset\n\tstring nextText = peekNextText(nextLine_, false, true);\n\tif (nextText.length() == 0 || !isCharPotentialHeader(nextText, 0))\n\t\treturn false;\n\n\tconst string* newHeader = ASBeautifier::findHeader(nextText, 0, headers);\n\n\tif (newHeader == NULL)\n\t\treturn false;\n\n\t// if a closing header, reset break unless break is requested\n\tif (isClosingHeader(newHeader) && !shouldBreakClosingHeaderBlocks)\n\t{\n\t\tisAppendPostBlockEmptyLineRequested = false;\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * determine if a bracket should be attached or broken\n * uses brackets in the bracketTypeStack\n * the last bracket in the bracketTypeStack is the one being formatted\n * returns true if the bracket should be broken\n */\nbool ASFormatter::isCurrentBracketBroken() const\n{\n\tassert(bracketTypeStack->size() > 1);\n\n\tbool breakBracket = false;\n\tsize_t stackEnd = bracketTypeStack->size() - 1;\n\n\t// check bracket modifiers\n\tif (shouldAttachExternC\n\t        && isBracketType((*bracketTypeStack)[stackEnd], EXTERN_TYPE))\n\t{\n\t\treturn false;\n\t}\n\tif (shouldAttachNamespace\n\t        && isBracketType((*bracketTypeStack)[stackEnd], NAMESPACE_TYPE))\n\t{\n\t\treturn false;\n\t}\n\telse if (shouldAttachClass\n\t         && (isBracketType((*bracketTypeStack)[stackEnd], CLASS_TYPE)\n\t             || isBracketType((*bracketTypeStack)[stackEnd], INTERFACE_TYPE)))\n\t{\n\t\treturn false;\n\t}\n\telse if (shouldAttachInline\n\t         && isCStyle()\t\t\t// for C++ only\n\t         && bracketFormatMode != RUN_IN_MODE\n\t         && isBracketType((*bracketTypeStack)[stackEnd], COMMAND_TYPE))\n\t{\n\t\tsize_t i;\n\t\tfor (i = 1; i < bracketTypeStack->size(); i++)\n\t\t\tif (isBracketType((*bracketTypeStack)[i], CLASS_TYPE)\n\t\t\t        || isBracketType((*bracketTypeStack)[i], STRUCT_TYPE))\n\t\t\t\treturn false;\n\t}\n\n\t// check brackets\n\tif (isBracketType((*bracketTypeStack)[stackEnd], EXTERN_TYPE))\n\t{\n\t\tif (currentLineBeginsWithBracket\n\t\t        || bracketFormatMode == RUN_IN_MODE)\n\t\t\tbreakBracket = true;\n\t}\n\telse if (bracketFormatMode == NONE_MODE)\n\t{\n\t\tif (currentLineBeginsWithBracket\n\t\t        && (int) currentLineFirstBracketNum == charNum)\n\t\t\tbreakBracket = true;\n\t}\n\telse if (bracketFormatMode == BREAK_MODE || bracketFormatMode == RUN_IN_MODE)\n\t{\n\t\tbreakBracket = true;\n\t}\n\telse if (bracketFormatMode == LINUX_MODE || bracketFormatMode == STROUSTRUP_MODE)\n\t{\n\t\t// break a namespace, class, or interface if Linux\n\t\tif (isBracketType((*bracketTypeStack)[stackEnd], NAMESPACE_TYPE)\n\t\t        || isBracketType((*bracketTypeStack)[stackEnd], CLASS_TYPE)\n\t\t        || isBracketType((*bracketTypeStack)[stackEnd], INTERFACE_TYPE))\n\t\t{\n\t\t\tif (bracketFormatMode == LINUX_MODE)\n\t\t\t\tbreakBracket = true;\n\t\t}\n\t\t// break the first bracket if a function\n\t\telse if (isBracketType((*bracketTypeStack)[stackEnd], COMMAND_TYPE))\n\t\t{\n\t\t\tif (stackEnd == 1)\n\t\t\t{\n\t\t\t\tbreakBracket = true;\n\t\t\t}\n\t\t\telse if (stackEnd > 1)\n\t\t\t{\n\t\t\t\t// break the first bracket after these if a function\n\t\t\t\tif (isBracketType((*bracketTypeStack)[stackEnd - 1], NAMESPACE_TYPE)\n\t\t\t\t        || isBracketType((*bracketTypeStack)[stackEnd - 1], CLASS_TYPE)\n\t\t\t\t        || isBracketType((*bracketTypeStack)[stackEnd - 1], ARRAY_TYPE)\n\t\t\t\t        || isBracketType((*bracketTypeStack)[stackEnd - 1], STRUCT_TYPE)\n\t\t\t\t        || isBracketType((*bracketTypeStack)[stackEnd - 1], EXTERN_TYPE))\n\t\t\t\t{\n\t\t\t\t\tbreakBracket = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn breakBracket;\n}\n\n/**\n * format comment body\n * the calling function should have a continue statement after calling this method\n */\nvoid ASFormatter::formatCommentBody()\n{\n\tassert(isInComment);\n\n\t// append the comment\n\twhile (charNum < (int) currentLine.length())\n\t{\n\t\tcurrentChar = currentLine[charNum];\n\t\tif (currentLine.compare(charNum, 2, \"*/\") == 0)\n\t\t{\n\t\t\tformatCommentCloser();\n\t\t\tbreak;\n\t\t}\n\t\tif (currentChar == '\\t' && shouldConvertTabs)\n\t\t\tconvertTabToSpaces();\n\t\tappendCurrentChar();\n\t\t++charNum;\n\t}\n\tif (shouldStripCommentPrefix)\n\t\tstripCommentPrefix();\n}\n\n/**\n * format a comment opener\n * the comment opener will be appended to the current formattedLine or a new formattedLine as necessary\n * the calling function should have a continue statement after calling this method\n */\nvoid ASFormatter::formatCommentOpener()\n{\n\tassert(isSequenceReached(\"/*\"));\n\n\tisInComment = isInCommentStartLine = true;\n\tisImmediatelyPostLineComment = false;\n\tif (previousNonWSChar == '}')\n\t\tresetEndOfStatement();\n\n\t// Check for a following header.\n\t// For speed do not check multiple comment lines more than once.\n\t// For speed do not check shouldBreakBlocks if previous line is empty, a comment, or a '{'.\n\tconst string* followingHeader = NULL;\n\tif ((doesLineStartComment\n\t        && !isImmediatelyPostCommentOnly\n\t        && isBracketType(bracketTypeStack->back(), COMMAND_TYPE))\n\t        && (shouldBreakElseIfs\n\t            || isInSwitchStatement()\n\t            || (shouldBreakBlocks\n\t                && !isImmediatelyPostEmptyLine\n\t                && previousCommandChar != '{')))\n\t\tfollowingHeader = checkForHeaderFollowingComment(currentLine.substr(charNum));\n\n\tif (spacePadNum != 0 && !isInLineBreak)\n\t\tadjustComments();\n\tformattedLineCommentNum = formattedLine.length();\n\n\t// must be done BEFORE appendSequence\n\tif (previousCommandChar == '{'\n\t        && !isImmediatelyPostComment\n\t        && !isImmediatelyPostLineComment)\n\t{\n\t\tif (bracketFormatMode == NONE_MODE)\n\t\t{\n\t\t\t// should a run-in statement be attached?\n\t\t\tif (currentLineBeginsWithBracket)\n\t\t\t\tformatRunIn();\n\t\t}\n\t\telse if (bracketFormatMode == ATTACH_MODE)\n\t\t{\n\t\t\t// if the bracket was not attached?\n\t\t\tif (formattedLine.length() > 0 && formattedLine[0] == '{'\n\t\t\t        && !isBracketType(bracketTypeStack->back(), SINGLE_LINE_TYPE))\n\t\t\t\tisInLineBreak = true;\n\t\t}\n\t\telse if (bracketFormatMode == RUN_IN_MODE)\n\t\t{\n\t\t\t// should a run-in statement be attached?\n\t\t\tif (formattedLine.length() > 0 && formattedLine[0] == '{')\n\t\t\t\tformatRunIn();\n\t\t}\n\t}\n\telse if (!doesLineStartComment)\n\t\tnoTrimCommentContinuation = true;\n\n\t// ASBeautifier needs to know the following statements\n\tif (shouldBreakElseIfs && followingHeader == &AS_ELSE)\n\t\telseHeaderFollowsComments = true;\n\tif (followingHeader == &AS_CASE || followingHeader == &AS_DEFAULT)\n\t\tcaseHeaderFollowsComments = true;\n\n\t// appendSequence will write the previous line\n\tappendSequence(AS_OPEN_COMMENT);\n\tgoForward(1);\n\n\t// must be done AFTER appendSequence\n\n\t// Break before the comment if a header follows the line comment.\n\t// But not break if previous line is empty, a comment, or a '{'.\n\tif (shouldBreakBlocks\n\t        && followingHeader != NULL\n\t        && !isImmediatelyPostEmptyLine\n\t        && previousCommandChar != '{')\n\t{\n\t\tif (isClosingHeader(followingHeader))\n\t\t{\n\t\t\tif (!shouldBreakClosingHeaderBlocks)\n\t\t\t\tisPrependPostBlockEmptyLineRequested = false;\n\t\t}\n\t\t// if an opening header, break before the comment\n\t\telse\n\t\t\tisPrependPostBlockEmptyLineRequested = true;\n\t}\n\n\tif (previousCommandChar == '}')\n\t\tcurrentHeader = NULL;\n}\n\n/**\n * format a comment closer\n * the comment closer will be appended to the current formattedLine\n */\nvoid ASFormatter::formatCommentCloser()\n{\n\tisInComment = false;\n\tnoTrimCommentContinuation = false;\n\tisImmediatelyPostComment = true;\n\tappendSequence(AS_CLOSE_COMMENT);\n\tgoForward(1);\n\tif (doesLineStartComment\n\t        && (currentLine.find_first_not_of(\" \\t\", charNum + 1) == string::npos))\n\t\tlineEndsInCommentOnly = true;\n\tif (peekNextChar() == '}'\n\t        && previousCommandChar != ';'\n\t        && !isBracketType(bracketTypeStack->back(),  ARRAY_TYPE)\n\t        && !isInPreprocessor\n\t        && isOkToBreakBlock(bracketTypeStack->back()))\n\t{\n\t\tisInLineBreak = true;\n\t\tshouldBreakLineAtNextChar = true;\n\t}\n}\n\n/**\n * format a line comment body\n * the calling function should have a continue statement after calling this method\n */\nvoid ASFormatter::formatLineCommentBody()\n{\n\tassert(isInLineComment);\n\n\t// append the comment\n\twhile (charNum < (int) currentLine.length())\n//\t        && !isLineReady\t// commented out in release 2.04, unnecessary\n\t{\n\t\tcurrentChar = currentLine[charNum];\n\t\tif (currentChar == '\\t' && shouldConvertTabs)\n\t\t\tconvertTabToSpaces();\n\t\tappendCurrentChar();\n\t\t++charNum;\n\t}\n\n\t// explicitly break a line when a line comment's end is found.\n\tif (charNum == (int) currentLine.length())\n\t{\n\t\tisInLineBreak = true;\n\t\tisInLineComment = false;\n\t\tisImmediatelyPostLineComment = true;\n\t\tcurrentChar = 0;  //make sure it is a neutral char.\n\t}\n}\n\n/**\n * format a line comment opener\n * the line comment opener will be appended to the current formattedLine or a new formattedLine as necessary\n * the calling function should have a continue statement after calling this method\n */\nvoid ASFormatter::formatLineCommentOpener()\n{\n\tassert(isSequenceReached(\"//\"));\n\n\tif ((int) currentLine.length() > charNum + 2\n\t        && currentLine[charNum + 2] == '\\xf2')     // check for windows line marker\n\t\tisAppendPostBlockEmptyLineRequested = false;\n\n\tisInLineComment = true;\n\tisCharImmediatelyPostComment = false;\n\tif (previousNonWSChar == '}')\n\t\tresetEndOfStatement();\n\n\t// Check for a following header.\n\t// For speed do not check multiple comment lines more than once.\n\t// For speed do not check shouldBreakBlocks if previous line is empty, a comment, or a '{'.\n\tconst string* followingHeader = NULL;\n\tif ((lineIsLineCommentOnly\n\t        && !isImmediatelyPostCommentOnly\n\t        && isBracketType(bracketTypeStack->back(), COMMAND_TYPE))\n\t        && (shouldBreakElseIfs\n\t            || isInSwitchStatement()\n\t            || (shouldBreakBlocks\n\t                && !isImmediatelyPostEmptyLine\n\t                && previousCommandChar != '{')))\n\t\tfollowingHeader = checkForHeaderFollowingComment(currentLine.substr(charNum));\n\n\t// do not indent if in column 1 or 2\n\t// or in a namespace before the opening bracket\n\tif ((!shouldIndentCol1Comments && !lineCommentNoIndent)\n\t        || foundNamespaceHeader)\n\t{\n\t\tif (charNum == 0)\n\t\t\tlineCommentNoIndent = true;\n\t\telse if (charNum == 1 && currentLine[0] == ' ')\n\t\t\tlineCommentNoIndent = true;\n\t}\n\t// move comment if spaces were added or deleted\n\tif (lineCommentNoIndent == false && spacePadNum != 0 && !isInLineBreak)\n\t\tadjustComments();\n\tformattedLineCommentNum = formattedLine.length();\n\n\t// must be done BEFORE appendSequence\n\t// check for run-in statement\n\tif (previousCommandChar == '{'\n\t        && !isImmediatelyPostComment\n\t        && !isImmediatelyPostLineComment)\n\t{\n\t\tif (bracketFormatMode == NONE_MODE)\n\t\t{\n\t\t\tif (currentLineBeginsWithBracket)\n\t\t\t\tformatRunIn();\n\t\t}\n\t\telse if (bracketFormatMode == RUN_IN_MODE)\n\t\t{\n\t\t\tif (!lineCommentNoIndent)\n\t\t\t\tformatRunIn();\n\t\t\telse\n\t\t\t\tisInLineBreak = true;\n\t\t}\n\t\telse if (bracketFormatMode == BREAK_MODE)\n\t\t{\n\t\t\tif (formattedLine.length() > 0 && formattedLine[0] == '{')\n\t\t\t\tisInLineBreak = true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (currentLineBeginsWithBracket)\n\t\t\t\tisInLineBreak = true;\n\t\t}\n\t}\n\n\t// ASBeautifier needs to know the following statements\n\tif (shouldBreakElseIfs && followingHeader == &AS_ELSE)\n\t\telseHeaderFollowsComments = true;\n\tif (followingHeader == &AS_CASE || followingHeader == &AS_DEFAULT)\n\t\tcaseHeaderFollowsComments = true;\n\n\t// appendSequence will write the previous line\n\tappendSequence(AS_OPEN_LINE_COMMENT);\n\tgoForward(1);\n\n\t// must be done AFTER appendSequence\n\n\t// Break before the comment if a header follows the line comment.\n\t// But do not break if previous line is empty, a comment, or a '{'.\n\tif (shouldBreakBlocks\n\t        && followingHeader != NULL\n\t        && !isImmediatelyPostEmptyLine\n\t        && previousCommandChar != '{')\n\t{\n\t\tif (isClosingHeader(followingHeader))\n\t\t{\n\t\t\tif (!shouldBreakClosingHeaderBlocks)\n\t\t\t\tisPrependPostBlockEmptyLineRequested = false;\n\t\t}\n\t\t// if an opening header, break before the comment\n\t\telse\n\t\t\tisPrependPostBlockEmptyLineRequested = true;\n\t}\n\n\tif (previousCommandChar == '}')\n\t\tcurrentHeader = NULL;\n\n\t// if tabbed input don't convert the immediately following tabs to spaces\n\tif (getIndentString() == \"\\t\" && lineCommentNoIndent)\n\t{\n\t\twhile (charNum + 1 < (int) currentLine.length()\n\t\t        && currentLine[charNum + 1] == '\\t')\n\t\t{\n\t\t\tcurrentChar = currentLine[++charNum];\n\t\t\tappendCurrentChar();\n\t\t}\n\t}\n\n\t// explicitly break a line when a line comment's end is found.\n\tif (charNum + 1 == (int) currentLine.length())\n\t{\n\t\tisInLineBreak = true;\n\t\tisInLineComment = false;\n\t\tisImmediatelyPostLineComment = true;\n\t\tcurrentChar = 0;  //make sure it is a neutral char.\n\t}\n}\n\n/**\n * format quote body\n * the calling function should have a continue statement after calling this method\n */\nvoid ASFormatter::formatQuoteBody()\n{\n\tassert(isInQuote);\n\n\tif (isSpecialChar)\n\t{\n\t\tisSpecialChar = false;\n\t}\n\telse if (currentChar == '\\\\' && !isInVerbatimQuote)\n\t{\n\t\tif (peekNextChar() == ' ')              // is this '\\' at end of line\n\t\t\thaveLineContinuationChar = true;\n\t\telse\n\t\t\tisSpecialChar = true;\n\t}\n\telse if (isInVerbatimQuote && currentChar == '\"')\n\t{\n\t\tif (isCStyle())\n\t\t{\n\t\t\tstring delim = ')' + verbatimDelimiter;\n\t\t\tint delimStart = charNum - delim.length();\n\t\t\tif (delimStart > 0 && currentLine.substr(delimStart, delim.length()) == delim)\n\t\t\t{\n\t\t\t\tisInQuote = false;\n\t\t\t\tisInVerbatimQuote = false;\n\t\t\t}\n\t\t}\n\t\telse if (isSharpStyle())\n\t\t{\n\t\t\tif (peekNextChar() == '\"')              // check consecutive quotes\n\t\t\t{\n\t\t\t\tappendSequence(\"\\\"\\\"\");\n\t\t\t\tgoForward(1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tisInQuote = false;\n\t\t\t\tisInVerbatimQuote = false;\n\t\t\t}\n\t\t}\n\t}\n\telse if (quoteChar == currentChar)\n\t{\n\t\tisInQuote = false;\n\t}\n\n\tappendCurrentChar();\n\n\t// append the text to the ending quoteChar or an escape sequence\n\t// tabs in quotes are NOT changed by convert-tabs\n\tif (isInQuote && currentChar != '\\\\')\n\t{\n\t\twhile (charNum + 1 < (int) currentLine.length()\n\t\t        && currentLine[charNum + 1] != quoteChar\n\t\t        && currentLine[charNum + 1] != '\\\\')\n\t\t{\n\t\t\tcurrentChar = currentLine[++charNum];\n\t\t\tappendCurrentChar();\n\t\t}\n\t}\n}\n\n/**\n * format a quote opener\n * the quote opener will be appended to the current formattedLine or a new formattedLine as necessary\n * the calling function should have a continue statement after calling this method\n */\nvoid ASFormatter::formatQuoteOpener()\n{\n\tassert(currentChar == '\"' || currentChar == '\\'');\n\n\tisInQuote = true;\n\tquoteChar = currentChar;\n\tif (isCStyle() && previousChar == 'R')\n\t{\n\t\tint parenPos = currentLine.find('(', charNum);\n\t\tif (parenPos != -1)\n\t\t{\n\t\t\tisInVerbatimQuote = true;\n\t\t\tverbatimDelimiter = currentLine.substr(charNum + 1, parenPos - charNum - 1);\n\t\t}\n\t}\n\telse if (isSharpStyle() && previousChar == '@')\n\t\tisInVerbatimQuote = true;\n\n\t// a quote following a bracket is an array\n\tif (previousCommandChar == '{'\n\t        && !isImmediatelyPostComment\n\t        && !isImmediatelyPostLineComment\n\t        && isNonInStatementArray\n\t        && !isBracketType(bracketTypeStack->back(), SINGLE_LINE_TYPE)\n\t        && !isWhiteSpace(peekNextChar()))\n\t{\n\t\tif (bracketFormatMode == NONE_MODE)\n\t\t{\n\t\t\tif (currentLineBeginsWithBracket)\n\t\t\t\tformatRunIn();\n\t\t}\n\t\telse if (bracketFormatMode == RUN_IN_MODE)\n\t\t{\n\t\t\tformatRunIn();\n\t\t}\n\t\telse if (bracketFormatMode == BREAK_MODE)\n\t\t{\n\t\t\tif (formattedLine.length() > 0 && formattedLine[0] == '{')\n\t\t\t\tisInLineBreak = true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (currentLineBeginsWithBracket)\n\t\t\t\tisInLineBreak = true;\n\t\t}\n\t}\n\tpreviousCommandChar = ' ';\n\tappendCurrentChar();\n}\n\n/**\n * get the next line comment adjustment that results from breaking a closing bracket.\n * the bracket must be on the same line as the closing header.\n * i.e \"} else\" changed to \"} <NL> else\".\n */\nint ASFormatter::getNextLineCommentAdjustment()\n{\n\tassert(foundClosingHeader && previousNonWSChar == '}');\n\tif (charNum < 1)\t\t\t// \"else\" is in column 1\n\t\treturn 0;\n\tsize_t lastBracket = currentLine.rfind('}', charNum - 1);\n\tif (lastBracket != string::npos)\n\t\treturn (lastBracket - charNum);\t// return a negative number\n\treturn 0;\n}\n\n// for console build only\nLineEndFormat ASFormatter::getLineEndFormat() const\n{\n\treturn lineEnd;\n}\n\n/**\n * get the current line comment adjustment that results from attaching\n * a closing header to a closing bracket.\n * the bracket must be on the line previous to the closing header.\n * the adjustment is 2 chars, one for the bracket and one for the space.\n * i.e \"} <NL> else\" changed to \"} else\".\n */\nint ASFormatter::getCurrentLineCommentAdjustment()\n{\n\tassert(foundClosingHeader && previousNonWSChar == '}');\n\tif (charNum < 1)\n\t\treturn 2;\n\tsize_t lastBracket = currentLine.rfind('}', charNum - 1);\n\tif (lastBracket == string::npos)\n\t\treturn 2;\n\treturn 0;\n}\n\n/**\n * get the previous word on a line\n * the argument 'currPos' must point to the current position.\n *\n * @return is the previous word or an empty string if none found.\n */\nstring ASFormatter::getPreviousWord(const string &line, int currPos) const\n{\n\t// get the last legal word (may be a number)\n\tif (currPos == 0)\n\t\treturn string();\n\n\tsize_t end = line.find_last_not_of(\" \\t\", currPos - 1);\n\tif (end == string::npos || !isLegalNameChar(line[end]))\n\t\treturn string();\n\n\tint start;          // start of the previous word\n\tfor (start = end; start > -1; start--)\n\t{\n\t\tif (!isLegalNameChar(line[start]) || line[start] == '.')\n\t\t\tbreak;\n\t}\n\tstart++;\n\n\treturn (line.substr(start, end - start + 1));\n}\n\n/**\n * check if a line break is needed when a closing bracket\n * is followed by a closing header.\n * the break depends on the bracketFormatMode and other factors.\n */\nvoid ASFormatter::isLineBreakBeforeClosingHeader()\n{\n\tassert(foundClosingHeader && previousNonWSChar == '}');\n\tif (bracketFormatMode == BREAK_MODE\n\t        || bracketFormatMode == RUN_IN_MODE\n\t        || attachClosingBracketMode)\n\t{\n\t\tisInLineBreak = true;\n\t}\n\telse if (bracketFormatMode == NONE_MODE)\n\t{\n\t\tif (shouldBreakClosingHeaderBrackets\n\t\t        || getBracketIndent() || getBlockIndent())\n\t\t{\n\t\t\tisInLineBreak = true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tappendSpacePad();\n\t\t\t// is closing bracket broken?\n\t\t\tsize_t i = currentLine.find_first_not_of(\" \\t\");\n\t\t\tif (i != string::npos && currentLine[i] == '}')\n\t\t\t\tisInLineBreak = false;\n\n\t\t\tif (shouldBreakBlocks)\n\t\t\t\tisAppendPostBlockEmptyLineRequested = false;\n\t\t}\n\t}\n\t// bracketFormatMode == ATTACH_MODE, LINUX_MODE, STROUSTRUP_MODE\n\telse\n\t{\n\t\tif (shouldBreakClosingHeaderBrackets\n\t\t        || getBracketIndent() || getBlockIndent())\n\t\t{\n\t\t\tisInLineBreak = true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// if a blank line does not precede this\n\t\t\t// or last line is not a one line block, attach header\n\t\t\tbool previousLineIsEmpty = isEmptyLine(formattedLine);\n\t\t\tint previousLineIsOneLineBlock = 0;\n\t\t\tsize_t firstBracket = findNextChar(formattedLine, '{');\n\t\t\tif (firstBracket != string::npos)\n\t\t\t\tpreviousLineIsOneLineBlock = isOneLineBlockReached(formattedLine, firstBracket);\n\t\t\tif (!previousLineIsEmpty\n\t\t\t        && previousLineIsOneLineBlock == 0)\n\t\t\t{\n\t\t\t\tisInLineBreak = false;\n\t\t\t\tappendSpacePad();\n\t\t\t\tspacePadNum = 0;\t// don't count as comment padding\n\t\t\t}\n\n\t\t\tif (shouldBreakBlocks)\n\t\t\t\tisAppendPostBlockEmptyLineRequested = false;\n\t\t}\n\t}\n}\n\n/**\n * Add brackets to a single line statement following a header.\n * Brackets are not added if the proper conditions are not met.\n * Brackets are added to the currentLine.\n */\nbool ASFormatter::addBracketsToStatement()\n{\n\tassert(isImmediatelyPostHeader);\n\n\tif (currentHeader != &AS_IF\n\t        && currentHeader != &AS_ELSE\n\t        && currentHeader != &AS_FOR\n\t        && currentHeader != &AS_WHILE\n\t        && currentHeader != &AS_DO\n\t        && currentHeader != &AS_FOREACH\n\t        && currentHeader != &AS_QFOREACH\n\t        && currentHeader != &AS_QFOREVER\n\t        && currentHeader != &AS_FOREVER)\n\t\treturn false;\n\n\tif (currentHeader == &AS_WHILE && foundClosingHeader)\t// do-while\n\t\treturn false;\n\n\t// do not bracket an empty statement\n\tif (currentChar == ';')\n\t\treturn false;\n\n\t// do not add if a header follows\n\tif (isCharPotentialHeader(currentLine, charNum))\n\t\tif (findHeader(headers) != NULL)\n\t\t\treturn false;\n\n\t// find the next semi-colon\n\tsize_t nextSemiColon = charNum;\n\tif (currentChar != ';')\n\t\tnextSemiColon = findNextChar(currentLine, ';', charNum + 1);\n\tif (nextSemiColon == string::npos)\n\t\treturn false;\n\n\t// add closing bracket before changing the line length\n\tif (nextSemiColon == currentLine.length() - 1)\n\t\tcurrentLine.append(\" }\");\n\telse\n\t\tcurrentLine.insert(nextSemiColon + 1, \" }\");\n\t// add opening bracket\n\tcurrentLine.insert(charNum, \"{ \");\n\tassert(computeChecksumIn(\"{}\"));\n\tcurrentChar = '{';\n\t// remove extra spaces\n\tif (!shouldAddOneLineBrackets)\n\t{\n\t\tsize_t lastText = formattedLine.find_last_not_of(\" \\t\");\n\t\tif ((formattedLine.length() - 1) - lastText > 1)\n\t\t\tformattedLine.erase(lastText + 1);\n\t}\n\treturn true;\n}\n\n/**\n * Remove brackets from a single line statement following a header.\n * Brackets are not removed if the proper conditions are not met.\n * The first bracket is replaced by a space.\n */\nbool ASFormatter::removeBracketsFromStatement()\n{\n\tassert(isImmediatelyPostHeader);\n\tassert(currentChar == '{');\n\n\tif (currentHeader != &AS_IF\n\t        && currentHeader != &AS_ELSE\n\t        && currentHeader != &AS_FOR\n\t        && currentHeader != &AS_WHILE\n\t        && currentHeader != &AS_FOREACH)\n\t\treturn false;\n\n\tif (currentHeader == &AS_WHILE && foundClosingHeader)\t// do-while\n\t\treturn false;\n\n\tbool isFirstLine = true;\n\tbool needReset = false;\n\tstring nextLine_;\n\t// leave nextLine_ empty if end of line comment follows\n\tif (!isBeforeAnyLineEndComment(charNum) || currentLineBeginsWithBracket)\n\t\tnextLine_ = currentLine.substr(charNum + 1);\n\tsize_t nextChar = 0;\n\n\t// find the first non-blank text\n\twhile (sourceIterator->hasMoreLines() || isFirstLine)\n\t{\n\t\tif (isFirstLine)\n\t\t\tisFirstLine = false;\n\t\telse\n\t\t{\n\t\t\tnextLine_ = sourceIterator->peekNextLine();\n\t\t\tnextChar = 0;\n\t\t\tneedReset = true;\n\t\t}\n\n\t\tnextChar = nextLine_.find_first_not_of(\" \\t\", nextChar);\n\t\tif (nextChar != string::npos)\n\t\t\tbreak;\n\t}\n\n\t// don't remove if comments or a header follow the bracket\n\tif ((nextLine_.compare(nextChar, 2, \"/*\") == 0)\n\t        || (nextLine_.compare(nextChar, 2, \"//\") == 0)\n\t        || (isCharPotentialHeader(nextLine_, nextChar)\n\t            && ASBeautifier::findHeader(nextLine_, nextChar, headers) != NULL))\n\t{\n\t\tif (needReset)\n\t\t\tsourceIterator->peekReset();\n\t\treturn false;\n\t}\n\n\t// find the next semi-colon\n\tsize_t nextSemiColon = nextChar;\n\tif (nextLine_[nextChar] != ';')\n\t\tnextSemiColon = findNextChar(nextLine_, ';', nextChar + 1);\n\tif (nextSemiColon == string::npos)\n\t{\n\t\tif (needReset)\n\t\t\tsourceIterator->peekReset();\n\t\treturn false;\n\t}\n\n\t// find the closing bracket\n\tisFirstLine = true;\n\tnextChar = nextSemiColon + 1;\n\twhile (sourceIterator->hasMoreLines() || isFirstLine)\n\t{\n\t\tif (isFirstLine)\n\t\t\tisFirstLine = false;\n\t\telse\n\t\t{\n\t\t\tnextLine_ = sourceIterator->peekNextLine();\n\t\t\tnextChar = 0;\n\t\t\tneedReset = true;\n\t\t}\n\t\tnextChar = nextLine_.find_first_not_of(\" \\t\", nextChar);\n\t\tif (nextChar != string::npos)\n\t\t\tbreak;\n\t}\n\tif (nextLine_.length() == 0 || nextLine_[nextChar] != '}')\n\t{\n\t\tif (needReset)\n\t\t\tsourceIterator->peekReset();\n\t\treturn false;\n\t}\n\n\t// remove opening bracket\n\tcurrentLine[charNum] = currentChar = ' ';\n\tassert(adjustChecksumIn(-'{'));\n\tif (needReset)\n\t\tsourceIterator->peekReset();\n\treturn true;\n}\n\n/**\n * Find the next character that is not in quotes or a comment.\n *\n * @param line         the line to be searched.\n * @param searchChar   the char to find.\n * @param searchStart  the start position on the line (default is 0).\n * @return the position on the line or string::npos if not found.\n */\nsize_t ASFormatter::findNextChar(string &line, char searchChar, int searchStart /*0*/)\n{\n\t// find the next searchChar\n\tsize_t i;\n\tfor (i = searchStart; i < line.length(); i++)\n\t{\n\t\tif (line.compare(i, 2, \"//\") == 0)\n\t\t\treturn string::npos;\n\t\tif (line.compare(i, 2, \"/*\") == 0)\n\t\t{\n\t\t\tsize_t endComment = line.find(\"*/\", i + 2);\n\t\t\tif (endComment == string::npos)\n\t\t\t\treturn string::npos;\n\t\t\ti = endComment + 2;\n\t\t\tif (i >= line.length())\n\t\t\t\treturn string::npos;\n\t\t}\n\t\tif (line[i] == '\\'' || line[i] == '\\\"')\n\t\t{\n\t\t\tchar quote = line[i];\n\t\t\twhile (i < line.length())\n\t\t\t{\n\t\t\t\tsize_t endQuote = line.find(quote, i + 1);\n\t\t\t\tif (endQuote == string::npos)\n\t\t\t\t\treturn string::npos;\n\t\t\t\ti = endQuote;\n\t\t\t\tif (line[endQuote - 1] != '\\\\')\t// check for '\\\"'\n\t\t\t\t\tbreak;\n\t\t\t\tif (line[endQuote - 2] == '\\\\')\t// check for '\\\\'\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (line[i] == searchChar)\n\t\t\tbreak;\n\n\t\t// for now don't process C# 'delegate' brackets\n\t\t// do this last in case the search char is a '{'\n\t\tif (line[i] == '{')\n\t\t\treturn string::npos;\n\t}\n\tif (i >= line.length())\t// didn't find searchChar\n\t\treturn string::npos;\n\n\treturn i;\n}\n\n/**\n * Look ahead in the file to see if a struct has access modifiers.\n *\n * @param firstLine     a reference to the line to indent.\n * @param index         the current line index.\n * @return              true if the struct has access modifiers.\n */\nbool ASFormatter::isStructAccessModified(string &firstLine, size_t index) const\n{\n\tassert(firstLine[index] == '{');\n\tassert(isCStyle());\n\n\tbool isFirstLine = true;\n\tbool needReset = false;\n\tsize_t bracketCount = 1;\n\tstring nextLine_ = firstLine.substr(index + 1);\n\n\t// find the first non-blank text, bypassing all comments and quotes.\n\tbool isInComment_ = false;\n\tbool isInQuote_ = false;\n\tchar quoteChar_ = ' ';\n\twhile (sourceIterator->hasMoreLines() || isFirstLine)\n\t{\n\t\tif (isFirstLine)\n\t\t\tisFirstLine = false;\n\t\telse\n\t\t{\n\t\t\tnextLine_ = sourceIterator->peekNextLine();\n\t\t\tneedReset = true;\n\t\t}\n\t\t// parse the line\n\t\tfor (size_t i = 0; i < nextLine_.length(); i++)\n\t\t{\n\t\t\tif (isWhiteSpace(nextLine_[i]))\n\t\t\t\tcontinue;\n\t\t\tif (nextLine_.compare(i, 2, \"/*\") == 0)\n\t\t\t\tisInComment_ = true;\n\t\t\tif (isInComment_)\n\t\t\t{\n\t\t\t\tif (nextLine_.compare(i, 2, \"*/\") == 0)\n\t\t\t\t{\n\t\t\t\t\tisInComment_ = false;\n\t\t\t\t\t++i;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (nextLine_[i] == '\\\\')\n\t\t\t{\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isInQuote_)\n\t\t\t{\n\t\t\t\tif (nextLine_[i] == quoteChar_)\n\t\t\t\t\tisInQuote_ = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (nextLine_[i] == '\"' || nextLine_[i] == '\\'')\n\t\t\t{\n\t\t\t\tisInQuote_ = true;\n\t\t\t\tquoteChar_ = nextLine_[i];\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (nextLine_.compare(i, 2, \"//\") == 0)\n\t\t\t{\n\t\t\t\ti = nextLine_.length();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// handle brackets\n\t\t\tif (nextLine_[i] == '{')\n\t\t\t\t++bracketCount;\n\t\t\tif (nextLine_[i] == '}')\n\t\t\t\t--bracketCount;\n\t\t\tif (bracketCount == 0)\n\t\t\t{\n\t\t\t\tif (needReset)\n\t\t\t\t\tsourceIterator->peekReset();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// check for access modifiers\n\t\t\tif (isCharPotentialHeader(nextLine_, i))\n\t\t\t{\n\t\t\t\tif (findKeyword(nextLine_, i, AS_PUBLIC)\n\t\t\t\t        || findKeyword(nextLine_, i, AS_PRIVATE)\n\t\t\t\t        || findKeyword(nextLine_, i, AS_PROTECTED))\n\t\t\t\t{\n\t\t\t\t\tif (needReset)\n\t\t\t\t\t\tsourceIterator->peekReset();\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tstring name = getCurrentWord(nextLine_, i);\n\t\t\t\ti += name.length() - 1;\n\t\t\t}\n\t\t}\t// end of for loop\n\t}\t// end of while loop\n\n\tif (needReset)\n\t\tsourceIterator->peekReset();\n\treturn false;\n}\n\n/**\n* Look ahead in the file to see if a preprocessor block is indentable.\n*\n* @param firstLine     a reference to the line to indent.\n* @param index         the current line index.\n* @return              true if the block is indentable.\n*/\nbool ASFormatter::isIndentablePreprocessorBlock(string &firstLine, size_t index)\n{\n\tassert(firstLine[index] == '#');\n\n\tbool isFirstLine = true;\n\tbool needReset = false;\n\tbool isInIndentableBlock = false;\n\tbool blockContainsBrackets = false;\n\tbool blockContainsDefineContinuation = false;\n\tbool isInClassConstructor = false;\n\tint  numBlockIndents = 0;\n\tint  lineParenCount = 0;\n\tstring nextLine_ = firstLine.substr(index);\n\n\t// find end of the block, bypassing all comments and quotes.\n\tbool isInComment_ = false;\n\tbool isInQuote_ = false;\n\tchar quoteChar_ = ' ';\n\twhile (sourceIterator->hasMoreLines() || isFirstLine)\n\t{\n\t\tif (isFirstLine)\n\t\t\tisFirstLine = false;\n\t\telse\n\t\t{\n\t\t\tnextLine_ = sourceIterator->peekNextLine();\n\t\t\tneedReset = true;\n\t\t}\n\t\t// parse the line\n\t\tfor (size_t i = 0; i < nextLine_.length(); i++)\n\t\t{\n\t\t\tif (isWhiteSpace(nextLine_[i]))\n\t\t\t\tcontinue;\n\t\t\tif (nextLine_.compare(i, 2, \"/*\") == 0)\n\t\t\t\tisInComment_ = true;\n\t\t\tif (isInComment_)\n\t\t\t{\n\t\t\t\tif (nextLine_.compare(i, 2, \"*/\") == 0)\n\t\t\t\t{\n\t\t\t\t\tisInComment_ = false;\n\t\t\t\t\t++i;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (nextLine_[i] == '\\\\')\n\t\t\t{\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (isInQuote_)\n\t\t\t{\n\t\t\t\tif (nextLine_[i] == quoteChar_)\n\t\t\t\t\tisInQuote_ = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (nextLine_[i] == '\"' || nextLine_[i] == '\\'')\n\t\t\t{\n\t\t\t\tisInQuote_ = true;\n\t\t\t\tquoteChar_ = nextLine_[i];\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (nextLine_.compare(i, 2, \"//\") == 0)\n\t\t\t{\n\t\t\t\ti = nextLine_.length();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// handle preprocessor statement\n\t\t\tif (nextLine_[i] == '#')\n\t\t\t{\n\t\t\t\tstring preproc = ASBeautifier::extractPreprocessorStatement(nextLine_);\n\t\t\t\tif (preproc.length() >= 2 && preproc.substr(0, 2) == \"if\") // #if, #ifdef, #ifndef\n\t\t\t\t{\n\t\t\t\t\tnumBlockIndents += 1;\n\t\t\t\t\tisInIndentableBlock = true;\n\t\t\t\t\t// flag first preprocessor conditional for header include guard check\n\t\t\t\t\tif (!processedFirstConditional)\n\t\t\t\t\t{\n\t\t\t\t\t\tprocessedFirstConditional = true;\n\t\t\t\t\t\tisFirstPreprocConditional = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (preproc == \"endif\")\n\t\t\t\t{\n\t\t\t\t\tif (numBlockIndents > 0)\n\t\t\t\t\t\tnumBlockIndents -= 1;\n\t\t\t\t\t// must exit BOTH loops\n\t\t\t\t\tif (numBlockIndents == 0)\n\t\t\t\t\t\tgoto EndOfWhileLoop;\n\t\t\t\t}\n\t\t\t\telse if (preproc == \"define\" && nextLine_[nextLine_.length() - 1] == '\\\\')\n\t\t\t\t{\n\t\t\t\t\tblockContainsDefineContinuation = true;\n\t\t\t\t}\n\t\t\t\ti = nextLine_.length();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// handle exceptions\n\t\t\tif (nextLine_[i] == '{' || nextLine_[i] == '}')\n\t\t\t\tblockContainsBrackets = true;\n\t\t\telse if (nextLine_[i] == '(')\n\t\t\t\t++lineParenCount;\n\t\t\telse if (nextLine_[i] == ')')\n\t\t\t\t--lineParenCount;\n\t\t\telse if (nextLine_[i] == ':')\n\t\t\t{\n\t\t\t\t// check for '::'\n\t\t\t\tif (nextLine_.length() > i && nextLine_[i + 1] == ':')\n\t\t\t\t\t++i;\n\t\t\t\telse\n\t\t\t\t\tisInClassConstructor = true;\n\t\t\t}\n\t\t\t// bypass unnecessary parsing - must exit BOTH loops\n\t\t\tif (blockContainsBrackets || isInClassConstructor || blockContainsDefineContinuation)\n\t\t\t\tgoto EndOfWhileLoop;\n\t\t}\t// end of for loop, end of line\n\t\tif (lineParenCount != 0)\n\t\t\tbreak;\n\t}\t// end of while loop\nEndOfWhileLoop:\n\tpreprocBlockEnd = sourceIterator->tellg();\n\tif (preprocBlockEnd < 0)\n\t\tpreprocBlockEnd = sourceIterator->getStreamLength();\n\tif (blockContainsBrackets\n\t        || isInClassConstructor\n\t        || blockContainsDefineContinuation\n\t        || lineParenCount != 0\n\t        || numBlockIndents != 0)\n\t\tisInIndentableBlock = false;\n\t// find next executable instruction\n\t// this WILL RESET the get pointer\n\tstring nextText = peekNextText(\"\", false, needReset);\n\t// bypass header include guards, with an exception for small test files\n\tif (isFirstPreprocConditional)\n\t{\n\t\tisFirstPreprocConditional = false;\n\t\tif (nextText.empty() && sourceIterator->getStreamLength() > 250)\n\t\t{\n\t\t\tisInIndentableBlock = false;\n\t\t\tpreprocBlockEnd = 0;\n\t\t}\n\t}\n\t// this allows preprocessor blocks within this block to be indented\n\tif (!isInIndentableBlock)\n\t\tpreprocBlockEnd = 0;\n\t// peekReset() is done by previous peekNextText()\n\treturn isInIndentableBlock;\n}\n\n/**\n * Check to see if this is an EXEC SQL statement.\n *\n * @param line          a reference to the line to indent.\n * @param index         the current line index.\n * @return              true if the statement is EXEC SQL.\n */\nbool ASFormatter::isExecSQL(string  &line, size_t index) const\n{\n\tif (line[index] != 'e' && line[index] != 'E')\t// quick check to reject most\n\t\treturn false;\n\tstring word;\n\tif (isCharPotentialHeader(line, index))\n\t\tword = getCurrentWord(line, index);\n\tfor (size_t i = 0; i < word.length(); i++)\n\t\tword[i] = (char) toupper(word[i]);\n\tif (word != \"EXEC\")\n\t\treturn false;\n\tsize_t index2 = index + word.length();\n\tindex2 = line.find_first_not_of(\" \\t\", index2);\n\tif (index2 == string::npos)\n\t\treturn false;\n\tword.erase();\n\tif (isCharPotentialHeader(line, index2))\n\t\tword = getCurrentWord(line, index2);\n\tfor (size_t i = 0; i < word.length(); i++)\n\t\tword[i] = (char) toupper(word[i]);\n\tif (word != \"SQL\")\n\t\treturn false;\n\treturn true;\n}\n\n/**\n * The continuation lines must be adjusted so the leading spaces\n *     is equivalent to the text on the opening line.\n *\n * Updates currentLine and charNum.\n */\nvoid ASFormatter::trimContinuationLine()\n{\n\tsize_t len = currentLine.length();\n\tsize_t tabSize = getTabLength();\n\tcharNum = 0;\n\n\tif (leadingSpaces > 0 && len > 0)\n\t{\n\t\tsize_t i;\n\t\tsize_t continuationIncrementIn = 0;\n\t\tfor (i = 0; (i < len) && (i + continuationIncrementIn < leadingSpaces); i++)\n\t\t{\n\t\t\tif (!isWhiteSpace(currentLine[i]))\t\t// don't delete any text\n\t\t\t{\n\t\t\t\tif (i < continuationIncrementIn)\n\t\t\t\t\tleadingSpaces = i + tabIncrementIn;\n\t\t\t\tcontinuationIncrementIn = tabIncrementIn;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (currentLine[i] == '\\t')\n\t\t\t\tcontinuationIncrementIn += tabSize - 1 - ((continuationIncrementIn + i) % tabSize);\n\t\t}\n\n\t\tif ((int) continuationIncrementIn == tabIncrementIn)\n\t\t\tcharNum = i;\n\t\telse\n\t\t{\n\t\t\t// build a new line with the equivalent leading chars\n\t\t\tstring newLine;\n\t\t\tint leadingChars = 0;\n\t\t\tif ((int) leadingSpaces > tabIncrementIn)\n\t\t\t\tleadingChars = leadingSpaces - tabIncrementIn;\n\t\t\tnewLine.append(leadingChars, ' ');\n\t\t\tnewLine.append(currentLine, i, len - i);\n\t\t\tcurrentLine = newLine;\n\t\t\tcharNum = leadingChars;\n\t\t\tif (currentLine.length() == 0)\n\t\t\t\tcurrentLine = string(\" \");        // a null is inserted if this is not done\n\t\t}\n\t\tif (i >= len)\n\t\t\tcharNum = 0;\n\t}\n\treturn;\n}\n\n/**\n * Determine if a header is a closing header\n *\n * @return      true if the header is a closing header.\n */\nbool ASFormatter::isClosingHeader(const string* header) const\n{\n\treturn (header == &AS_ELSE\n\t        || header == &AS_CATCH\n\t        || header == &AS_FINALLY);\n}\n\n/**\n * Determine if a * following a closing paren is immediately.\n * after a cast. If so it is a deference and not a multiply.\n * e.g. \"(int*) *ptr\" is a deference.\n */\nbool ASFormatter::isImmediatelyPostCast() const\n{\n\tassert(previousNonWSChar == ')' && currentChar == '*');\n\t// find preceding closing paren on currentLine or readyFormattedLine\n\tstring line;\t\t// currentLine or readyFormattedLine\n\tsize_t paren = currentLine.rfind(\")\", charNum);\n\tif (paren != string::npos)\n\t\tline = currentLine;\n\t// if not on currentLine it must be on the previous line\n\telse\n\t{\n\t\tline = readyFormattedLine;\n\t\tparen = line.rfind(\")\");\n\t\tif (paren == string::npos)\n\t\t\treturn false;\n\t}\n\tif (paren == 0)\n\t\treturn false;\n\n\t// find character preceding the closing paren\n\tsize_t lastChar = line.find_last_not_of(\" \\t\", paren - 1);\n\tif (lastChar == string::npos)\n\t\treturn false;\n\t// check for pointer cast\n\tif (line[lastChar] == '*')\n\t\treturn true;\n\treturn false;\n}\n\n/**\n * Determine if a < is a template definition or instantiation.\n * Sets the class variables isInTemplate and templateDepth.\n */\nvoid ASFormatter::checkIfTemplateOpener()\n{\n\tassert(!isInTemplate && currentChar == '<');\n\n\t// find first char after the '<' operators\n\tsize_t firstChar = currentLine.find_first_not_of(\"< \\t\", charNum);\n\tif (firstChar == string::npos\n\t        || currentLine[firstChar] == '=')\n\t{\n\t\t// this is not a template -> leave...\n\t\tisInTemplate = false;\n\t\treturn;\n\t}\n\n\tbool isFirstLine = true;\n\tbool needReset = false;\n\tint parenDepth_ = 0;\n\tint maxTemplateDepth = 0;\n\ttemplateDepth = 0;\n\tstring nextLine_ = currentLine.substr(charNum);\n\n\t// find the angle brackets, bypassing all comments and quotes.\n\tbool isInComment_ = false;\n\tbool isInQuote_ = false;\n\tchar quoteChar_ = ' ';\n\twhile (sourceIterator->hasMoreLines() || isFirstLine)\n\t{\n\t\tif (isFirstLine)\n\t\t\tisFirstLine = false;\n\t\telse\n\t\t{\n\t\t\tnextLine_ = sourceIterator->peekNextLine();\n\t\t\tneedReset = true;\n\t\t}\n\t\t// parse the line\n\t\tfor (size_t i = 0; i < nextLine_.length(); i++)\n\t\t{\n\t\t\tchar currentChar_ = nextLine_[i];\n\t\t\tif (isWhiteSpace(currentChar_))\n\t\t\t\tcontinue;\n\t\t\tif (nextLine_.compare(i, 2, \"/*\") == 0)\n\t\t\t\tisInComment_ = true;\n\t\t\tif (isInComment_)\n\t\t\t{\n\t\t\t\tif (nextLine_.compare(i, 2, \"*/\") == 0)\n\t\t\t\t{\n\t\t\t\t\tisInComment_ = false;\n\t\t\t\t\t++i;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (currentChar_ == '\\\\')\n\t\t\t{\n\t\t\t\t++i;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (isInQuote_)\n\t\t\t{\n\t\t\t\tif (currentChar_ == quoteChar_)\n\t\t\t\t\tisInQuote_ = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (currentChar_ == '\"' || currentChar_ == '\\'')\n\t\t\t{\n\t\t\t\tisInQuote_ = true;\n\t\t\t\tquoteChar_ = currentChar_;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (nextLine_.compare(i, 2, \"//\") == 0)\n\t\t\t{\n\t\t\t\ti = nextLine_.length();\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// not in a comment or quote\n\t\t\tif (currentChar_ == '<')\n\t\t\t{\n\t\t\t\t++templateDepth;\n\t\t\t\t++maxTemplateDepth;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if (currentChar_ == '>')\n\t\t\t{\n\t\t\t\t--templateDepth;\n\t\t\t\tif (templateDepth == 0)\n\t\t\t\t{\n\t\t\t\t\tif (parenDepth_ == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t// this is a template!\n\t\t\t\t\t\tisInTemplate = true;\n\t\t\t\t\t\ttemplateDepth = maxTemplateDepth;\n\t\t\t\t\t}\n\t\t\t\t\tgoto exitFromSearch;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if (currentChar_ == '(' || currentChar_ == ')')\n\t\t\t{\n\t\t\t\tif (currentChar_ == '(')\n\t\t\t\t\t++parenDepth_;\n\t\t\t\telse\n\t\t\t\t\t--parenDepth_;\n\t\t\t\tif (parenDepth_ >= 0)\n\t\t\t\t\tcontinue;\n\t\t\t\t// this is not a template -> leave...\n\t\t\t\tisInTemplate = false;\n\t\t\t\tgoto exitFromSearch;\n\t\t\t}\n\t\t\telse if (nextLine_.compare(i, 2, AS_AND) == 0\n\t\t\t         || nextLine_.compare(i, 2, AS_OR) == 0)\n\t\t\t{\n\t\t\t\t// this is not a template -> leave...\n\t\t\t\tisInTemplate = false;\n\t\t\t\tgoto exitFromSearch;\n\t\t\t}\n\t\t\telse if (currentChar_ == ','  // comma,     e.g. A<int, char>\n\t\t\t         || currentChar_ == '&'    // reference, e.g. A<int&>\n\t\t\t         || currentChar_ == '*'    // pointer,   e.g. A<int*>\n\t\t\t         || currentChar_ == '^'    // C++/CLI managed pointer, e.g. A<int^>\n\t\t\t         || currentChar_ == ':'    // ::,        e.g. std::string\n\t\t\t         || currentChar_ == '='    // assign     e.g. default parameter\n\t\t\t         || currentChar_ == '['    // []         e.g. string[]\n\t\t\t         || currentChar_ == ']'    // []         e.g. string[]\n\t\t\t         || currentChar_ == '('    // (...)      e.g. function definition\n\t\t\t         || currentChar_ == ')'    // (...)      e.g. function definition\n\t\t\t         || (isJavaStyle() && currentChar_ == '?')   // Java wildcard\n\t\t\t        )\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse if (!isLegalNameChar(currentChar_))\n\t\t\t{\n\t\t\t\t// this is not a template -> leave...\n\t\t\t\tisInTemplate = false;\n\t\t\t\ttemplateDepth = 0;\n\t\t\t\tgoto exitFromSearch;\n\t\t\t}\n\t\t\tstring name = getCurrentWord(nextLine_, i);\n\t\t\ti += name.length() - 1;\n\t\t}\t// end of for loop\n\t}\t// end of while loop\n\n\t// goto needed to exit from two loops\nexitFromSearch:\n\tif (needReset)\n\t\tsourceIterator->peekReset();\n}\n\nvoid ASFormatter::updateFormattedLineSplitPoints(char appendedChar)\n{\n\tassert(maxCodeLength != string::npos);\n\tassert(formattedLine.length() > 0);\n\n\tif (!isOkToSplitFormattedLine())\n\t\treturn;\n\n\tchar nextChar = peekNextChar();\n\n\t// don't split before an end of line comment\n\tif (nextChar == '/')\n\t\treturn;\n\n\t// don't split before or after a bracket\n\tif (appendedChar == '{' || appendedChar == '}'\n\t        || previousNonWSChar == '{' || previousNonWSChar == '}'\n\t        || nextChar == '{' || nextChar == '}'\n\t        || currentChar == '{' || currentChar == '}')\t// currentChar tests for an appended bracket\n\t\treturn;\n\n\t// don't split before or after a block paren\n\tif (appendedChar == '[' || appendedChar == ']'\n\t        || previousNonWSChar == '['\n\t        || nextChar == '[' || nextChar == ']')\n\t\treturn;\n\n\tif (isWhiteSpace(appendedChar))\n\t{\n\t\tif (nextChar != ')'\t\t\t\t\t\t// space before a closing paren\n\t\t        && nextChar != '('\t\t\t\t// space before an opening paren\n\t\t        && nextChar != '/'\t\t\t\t// space before a comment\n\t\t        && nextChar != ':'\t\t\t\t// space before a colon\n\t\t        && currentChar != ')'\t\t\t// appended space before and after a closing paren\n\t\t        && currentChar != '('\t\t\t// appended space before and after a opening paren\n\t\t        && previousNonWSChar != '('\t\t// decided at the '('\n\t\t        // don't break before a pointer or reference aligned to type\n\t\t        && !(nextChar == '*'\n\t\t             && !isCharPotentialOperator(previousNonWSChar)\n\t\t             && pointerAlignment == PTR_ALIGN_TYPE)\n\t\t        && !(nextChar == '&'\n\t\t             && !isCharPotentialOperator(previousNonWSChar)\n\t\t             && (referenceAlignment == REF_ALIGN_TYPE\n\t\t                 || (referenceAlignment == REF_SAME_AS_PTR && pointerAlignment == PTR_ALIGN_TYPE)))\n\t\t   )\n\t\t{\n\t\t\tif (formattedLine.length() - 1 <= maxCodeLength)\n\t\t\t\tmaxWhiteSpace = formattedLine.length() - 1;\n\t\t\telse\n\t\t\t\tmaxWhiteSpacePending = formattedLine.length() - 1;\n\t\t}\n\t}\n\t// unpadded closing parens may split after the paren (counts as whitespace)\n\telse if (appendedChar == ')')\n\t{\n\t\tif (nextChar != ')'\n\t\t        && nextChar != ' '\n\t\t        && nextChar != ';'\n\t\t        && nextChar != ','\n\t\t        && nextChar != '.'\n\t\t        && !(nextChar == '-' && pointerSymbolFollows()))\t// check for ->\n\t\t{\n\t\t\tif (formattedLine.length() <= maxCodeLength)\n\t\t\t\tmaxWhiteSpace = formattedLine.length();\n\t\t\telse\n\t\t\t\tmaxWhiteSpacePending = formattedLine.length();\n\t\t}\n\t}\n\t// unpadded commas may split after the comma\n\telse if (appendedChar == ',')\n\t{\n\t\tif (formattedLine.length() <= maxCodeLength)\n\t\t\tmaxComma = formattedLine.length();\n\t\telse\n\t\t\tmaxCommaPending = formattedLine.length();\n\t}\n\telse if (appendedChar == '(')\n\t{\n\t\tif (nextChar != ')' && nextChar != '(' && nextChar != '\"' && nextChar != '\\'')\n\t\t{\n\t\t\t// if follows an operator break before\n\t\t\tsize_t parenNum;\n\t\t\tif (isCharPotentialOperator(previousNonWSChar))\n\t\t\t\tparenNum = formattedLine.length() - 1 ;\n\t\t\telse\n\t\t\t\tparenNum = formattedLine.length();\n\t\t\tif (formattedLine.length() <= maxCodeLength)\n\t\t\t\tmaxParen = parenNum;\n\t\t\telse\n\t\t\t\tmaxParenPending = parenNum;\n\t\t}\n\t}\n\telse if (appendedChar == ';')\n\t{\n\t\tif (nextChar != ' '  && nextChar != '}' && nextChar != '/')\t// check for following comment\n\t\t{\n\t\t\tif (formattedLine.length() <= maxCodeLength)\n\t\t\t\tmaxSemi = formattedLine.length();\n\t\t\telse\n\t\t\t\tmaxSemiPending = formattedLine.length();\n\t\t}\n\t}\n}\n\nvoid ASFormatter::updateFormattedLineSplitPointsOperator(const string &sequence)\n{\n\tassert(maxCodeLength != string::npos);\n\tassert(formattedLine.length() > 0);\n\n\tif (!isOkToSplitFormattedLine())\n\t\treturn;\n\n\tchar nextChar = peekNextChar();\n\n\t// don't split before an end of line comment\n\tif (nextChar == '/')\n\t\treturn;\n\n\t// check for logical conditional\n\tif (sequence == \"||\" || sequence ==  \"&&\" || sequence ==  \"or\" || sequence ==  \"and\")\n\t{\n\t\tif (shouldBreakLineAfterLogical)\n\t\t{\n\t\t\tif (formattedLine.length() <= maxCodeLength)\n\t\t\t\tmaxAndOr = formattedLine.length();\n\t\t\telse\n\t\t\t\tmaxAndOrPending = formattedLine.length();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// adjust for leading space in the sequence\n\t\t\tsize_t sequenceLength = sequence.length();\n\t\t\tif (formattedLine.length() > sequenceLength\n\t\t\t        && isWhiteSpace(formattedLine[formattedLine.length() - sequenceLength - 1]))\n\t\t\t\tsequenceLength++;\n\t\t\tif (formattedLine.length() - sequenceLength <= maxCodeLength)\n\t\t\t\tmaxAndOr = formattedLine.length() - sequenceLength;\n\t\t\telse\n\t\t\t\tmaxAndOrPending = formattedLine.length() - sequenceLength;\n\t\t}\n\t}\n\t// comparison operators will split after the operator (counts as whitespace)\n\telse if (sequence == \"==\" || sequence ==  \"!=\" || sequence ==  \">=\" || sequence ==  \"<=\")\n\t{\n\t\tif (formattedLine.length() <= maxCodeLength)\n\t\t\tmaxWhiteSpace = formattedLine.length();\n\t\telse\n\t\t\tmaxWhiteSpacePending = formattedLine.length();\n\t}\n\t// unpadded operators that will split BEFORE the operator (counts as whitespace)\n\telse if (sequence == \"+\" || sequence == \"-\" || sequence == \"?\")\n\t{\n\t\tif (charNum > 0\n\t\t        && (isLegalNameChar(currentLine[charNum - 1])\n\t\t            || currentLine[charNum - 1] == ')'\n\t\t            || currentLine[charNum - 1] == ']'\n\t\t            || currentLine[charNum - 1] == '\\\"'))\n\t\t{\n\t\t\tif (formattedLine.length() - 1 <=  maxCodeLength)\n\t\t\t\tmaxWhiteSpace = formattedLine.length() - 1;\n\t\t\telse\n\t\t\t\tmaxWhiteSpacePending = formattedLine.length() - 1;\n\t\t}\n\t}\n\t// unpadded operators that will USUALLY split AFTER the operator (counts as whitespace)\n\telse if (sequence == \"=\" || sequence == \":\")\n\t{\n\t\t// split BEFORE if the line is too long\n\t\t// do NOT use <= here, must allow for a bracket attached to an array\n\t\tsize_t splitPoint = 0;\n\t\tif (formattedLine.length() <  maxCodeLength)\n\t\t\tsplitPoint = formattedLine.length();\n\t\telse\n\t\t\tsplitPoint = formattedLine.length() - 1;\n\t\t// padded or unpadded arrays\n\t\tif (previousNonWSChar == ']')\n\t\t{\n\t\t\tif (formattedLine.length() - 1 <=  maxCodeLength)\n\t\t\t\tmaxWhiteSpace = splitPoint;\n\t\t\telse\n\t\t\t\tmaxWhiteSpacePending = splitPoint;\n\t\t}\n\t\telse if (charNum > 0\n\t\t         && (isLegalNameChar(currentLine[charNum - 1])\n\t\t             || currentLine[charNum - 1] == ')'\n\t\t             || currentLine[charNum - 1] == ']'))\n\t\t{\n\t\t\tif (formattedLine.length() <=  maxCodeLength)\n\t\t\t\tmaxWhiteSpace = splitPoint;\n\t\t\telse\n\t\t\t\tmaxWhiteSpacePending = splitPoint;\n\t\t}\n\t}\n}\n\n/**\n * Update the split point when a pointer or reference is formatted.\n * The argument is the maximum index of the last whitespace character.\n */\nvoid ASFormatter::updateFormattedLineSplitPointsPointerOrReference(size_t index)\n{\n\tassert(maxCodeLength != string::npos);\n\tassert(formattedLine.length() > 0);\n\tassert(index < formattedLine.length());\n\n\tif (!isOkToSplitFormattedLine())\n\t\treturn;\n\n\tif (index < maxWhiteSpace)\t\t// just in case\n\t\treturn;\n\n\tif (index <= maxCodeLength)\n\t\tmaxWhiteSpace = index;\n\telse\n\t\tmaxWhiteSpacePending = index;\n}\n\nbool ASFormatter::isOkToSplitFormattedLine()\n{\n\tassert(maxCodeLength != string::npos);\n\t// Is it OK to split the line?\n\tif (shouldKeepLineUnbroken\n\t        || isInLineComment\n\t        || isInComment\n\t        || isInQuote\n\t        || isInCase\n\t        || isInPreprocessor\n\t        || isInExecSQL\n\t        || isInAsm || isInAsmOneLine || isInAsmBlock\n\t        || isInTemplate)\n\t\treturn false;\n\n\tif (!isOkToBreakBlock(bracketTypeStack->back()) && currentChar != '{')\n\t{\n\t\tshouldKeepLineUnbroken = true;\n\t\tclearFormattedLineSplitPoints();\n\t\treturn false;\n\t}\n\telse if (isBracketType(bracketTypeStack->back(), ARRAY_TYPE))\n\t{\n\t\tshouldKeepLineUnbroken = true;\n\t\tif (!isBracketType(bracketTypeStack->back(), ARRAY_NIS_TYPE))\n\t\t\tclearFormattedLineSplitPoints();\n\t\treturn false;\n\t}\n\treturn true;\n}\n\n/* This is called if the option maxCodeLength is set.\n */\nvoid ASFormatter::testForTimeToSplitFormattedLine()\n{\n\t//\tDO NOT ASSERT maxCodeLength HERE\n\t// should the line be split\n\tif (formattedLine.length() > maxCodeLength && !isLineReady)\n\t{\n\t\tsize_t splitPoint = findFormattedLineSplitPoint();\n\t\tif (splitPoint > 0 && splitPoint < formattedLine.length())\n\t\t{\n\t\t\tstring splitLine = formattedLine.substr(splitPoint);\n\t\t\tformattedLine = formattedLine.substr(0, splitPoint);\n\t\t\tbreakLine(true);\n\t\t\tformattedLine = splitLine;\n\t\t\t// if break-blocks is requested and this is a one-line statement\n\t\t\tstring nextWord = ASBeautifier::getNextWord(currentLine, charNum - 1);\n\t\t\tif (isAppendPostBlockEmptyLineRequested\n\t\t\t        && (nextWord == \"break\" || nextWord == \"continue\"))\n\t\t\t{\n\t\t\t\tisAppendPostBlockEmptyLineRequested = false;\n\t\t\t\tisPrependPostBlockEmptyLineRequested = true;\n\t\t\t}\n\t\t\telse\n\t\t\t\tisPrependPostBlockEmptyLineRequested = false;\n\t\t\t// adjust max split points\n\t\t\tmaxAndOr = (maxAndOr > splitPoint) ? (maxAndOr - splitPoint) : 0;\n\t\t\tmaxSemi = (maxSemi > splitPoint) ? (maxSemi - splitPoint) : 0;\n\t\t\tmaxComma = (maxComma > splitPoint) ? (maxComma - splitPoint) : 0;\n\t\t\tmaxParen = (maxParen > splitPoint) ? (maxParen - splitPoint) : 0;\n\t\t\tmaxWhiteSpace = (maxWhiteSpace > splitPoint) ? (maxWhiteSpace - splitPoint) : 0;\n\t\t\tif (maxSemiPending > 0)\n\t\t\t{\n\t\t\t\tmaxSemi = (maxSemiPending > splitPoint) ? (maxSemiPending - splitPoint) : 0;\n\t\t\t\tmaxSemiPending = 0;\n\t\t\t}\n\t\t\tif (maxAndOrPending > 0)\n\t\t\t{\n\t\t\t\tmaxAndOr = (maxAndOrPending > splitPoint) ? (maxAndOrPending - splitPoint) : 0;\n\t\t\t\tmaxAndOrPending = 0;\n\t\t\t}\n\t\t\tif (maxCommaPending > 0)\n\t\t\t{\n\t\t\t\tmaxComma = (maxCommaPending > splitPoint) ? (maxCommaPending - splitPoint) : 0;\n\t\t\t\tmaxCommaPending = 0;\n\t\t\t}\n\t\t\tif (maxParenPending > 0)\n\t\t\t{\n\t\t\t\tmaxParen = (maxParenPending > splitPoint) ? (maxParenPending - splitPoint) : 0;\n\t\t\t\tmaxParenPending = 0;\n\t\t\t}\n\t\t\tif (maxWhiteSpacePending > 0)\n\t\t\t{\n\t\t\t\tmaxWhiteSpace = (maxWhiteSpacePending > splitPoint) ? (maxWhiteSpacePending - splitPoint) : 0;\n\t\t\t\tmaxWhiteSpacePending = 0;\n\t\t\t}\n\t\t\t// don't allow an empty formatted line\n\t\t\tsize_t firstText = formattedLine.find_first_not_of(\" \\t\");\n\t\t\tif (firstText == string::npos && formattedLine.length() > 0)\n\t\t\t{\n\t\t\t\tformattedLine.erase();\n\t\t\t\tclearFormattedLineSplitPoints();\n\t\t\t\tif (isWhiteSpace(currentChar))\n\t\t\t\t\tfor (size_t i = charNum + 1; i < currentLine.length() && isWhiteSpace(currentLine[i]); i++)\n\t\t\t\t\t\tgoForward(1);\n\t\t\t}\n\t\t\telse if (firstText > 0)\n\t\t\t{\n\t\t\t\tformattedLine.erase(0, firstText);\n\t\t\t\tmaxSemi = (maxSemi > firstText) ? (maxSemi - firstText) : 0;\n\t\t\t\tmaxAndOr = (maxAndOr > firstText) ? (maxAndOr - firstText) : 0;\n\t\t\t\tmaxComma = (maxComma > firstText) ? (maxComma - firstText) : 0;\n\t\t\t\tmaxParen = (maxParen > firstText) ? (maxParen - firstText) : 0;\n\t\t\t\tmaxWhiteSpace = (maxWhiteSpace > firstText) ? (maxWhiteSpace - firstText) : 0;\n\t\t\t}\n\t\t\t// reset formattedLineCommentNum\n\t\t\tif (formattedLineCommentNum != string::npos)\n\t\t\t{\n\t\t\t\tformattedLineCommentNum = formattedLine.find(\"//\");\n\t\t\t\tif (formattedLineCommentNum == string::npos)\n\t\t\t\t\tformattedLineCommentNum = formattedLine.find(\"/*\");\n\t\t\t}\n\t\t}\n\t}\n}\n\nsize_t ASFormatter::findFormattedLineSplitPoint() const\n{\n\tassert(maxCodeLength != string::npos);\n\t// determine where to split\n\tsize_t minCodeLength = 10;\n\tsize_t splitPoint = 0;\n\tsplitPoint = maxSemi;\n\tif (maxAndOr >= minCodeLength)\n\t\tsplitPoint = maxAndOr;\n\tif (splitPoint < minCodeLength)\n\t{\n\t\tsplitPoint = maxWhiteSpace;\n\t\t// use maxParen instead if it is long enough\n\t\tif (maxParen > splitPoint\n\t\t        || maxParen >= maxCodeLength * .7)\n\t\t\tsplitPoint = maxParen;\n\t\t// use maxComma instead if it is long enough\n\t\t// increasing the multiplier causes more splits at whitespace\n\t\tif (maxComma > splitPoint\n\t\t        || maxComma >= maxCodeLength * .3)\n\t\t\tsplitPoint = maxComma;\n\t}\n\t// replace split point with first available break point\n\tif (splitPoint < minCodeLength)\n\t{\n\t\tsplitPoint = string::npos;\n\t\tif (maxSemiPending > 0 && maxSemiPending < splitPoint)\n\t\t\tsplitPoint = maxSemiPending;\n\t\tif (maxAndOrPending > 0 && maxAndOrPending < splitPoint)\n\t\t\tsplitPoint = maxAndOrPending;\n\t\tif (maxCommaPending > 0 && maxCommaPending < splitPoint)\n\t\t\tsplitPoint = maxCommaPending;\n\t\tif (maxParenPending > 0 && maxParenPending < splitPoint)\n\t\t\tsplitPoint = maxParenPending;\n\t\tif (maxWhiteSpacePending > 0 && maxWhiteSpacePending < splitPoint)\n\t\t\tsplitPoint = maxWhiteSpacePending;\n\t\tif (splitPoint == string::npos)\n\t\t\tsplitPoint = 0;\n\t}\n\t// if remaining line after split is too long\n\telse if (formattedLine.length() - splitPoint > maxCodeLength)\n\t{\n\t\t// if end of the currentLine, find a new split point\n\t\tsize_t newCharNum;\n\t\tif (isCharPotentialHeader(currentLine, charNum))\n\t\t\tnewCharNum = getCurrentWord(currentLine, charNum).length() + charNum;\n\t\telse\n\t\t\tnewCharNum = charNum + 2;\n\t\tif (newCharNum + 1 > currentLine.length())\n\t\t{\n\t\t\t// don't move splitPoint from before a conditional to after\n\t\t\tif (maxWhiteSpace > splitPoint + 3)\n\t\t\t\tsplitPoint = maxWhiteSpace;\n\t\t\tif (maxParen > splitPoint)\n\t\t\t\tsplitPoint = maxParen;\n\t\t}\n\t}\n\n\treturn splitPoint;\n}\n\nvoid ASFormatter::clearFormattedLineSplitPoints()\n{\n\tmaxSemi = 0;\n\tmaxAndOr = 0;\n\tmaxComma = 0;\n\tmaxParen = 0;\n\tmaxWhiteSpace = 0;\n\tmaxSemiPending = 0;\n\tmaxAndOrPending = 0;\n\tmaxCommaPending = 0;\n\tmaxParenPending = 0;\n\tmaxWhiteSpacePending = 0;\n}\n\n/**\n * Check if a pointer symbol (->) follows on the currentLine.\n */\nbool ASFormatter::pointerSymbolFollows() const\n{\n\tsize_t peekNum = currentLine.find_first_not_of(\" \\t\", charNum + 1);\n\tif (peekNum == string::npos || currentLine.compare(peekNum, 2, \"->\") != 0)\n\t\treturn false;\n\treturn true;\n}\n\n/**\n * Compute the input checksum.\n * This is called as an assert so it for is debug config only\n */\nbool ASFormatter::computeChecksumIn(const string &currentLine_)\n{\n\tfor (size_t i = 0; i < currentLine_.length(); i++)\n\t\tif (!isWhiteSpace(currentLine_[i]))\n\t\t\tchecksumIn += currentLine_[i];\n\treturn true;\n}\n\n/**\n * Adjust the input checksum for deleted chars.\n * This is called as an assert so it for is debug config only\n */\nbool ASFormatter::adjustChecksumIn(int adjustment)\n{\n\tchecksumIn += adjustment;\n\treturn true;\n}\n\n/**\n * get the value of checksumIn for unit testing\n *\n * @return   checksumIn.\n */\nsize_t ASFormatter::getChecksumIn() const\n{\n\treturn checksumIn;\n}\n\n/**\n * Compute the output checksum.\n * This is called as an assert so it is for debug config only\n */\nbool ASFormatter::computeChecksumOut(const string &beautifiedLine)\n{\n\tfor (size_t i = 0; i < beautifiedLine.length(); i++)\n\t\tif (!isWhiteSpace(beautifiedLine[i]))\n\t\t\tchecksumOut += beautifiedLine[i];\n\treturn true;\n}\n\n/**\n * Return isLineReady for the final check at end of file.\n */\nbool ASFormatter::getIsLineReady() const\n{\n\treturn isLineReady;\n}\n\n/**\n * get the value of checksumOut for unit testing\n *\n * @return   checksumOut.\n */\nsize_t ASFormatter::getChecksumOut() const\n{\n\treturn checksumOut;\n}\n\n/**\n * Return the difference in checksums.\n * If zero all is okay.\n */\nint ASFormatter::getChecksumDiff() const\n{\n\treturn checksumOut - checksumIn;\n}\n\n// for unit testing\nint ASFormatter::getFormatterFileType() const\n{\n\treturn formatterFileType;\n}\n\n// Check if an operator follows the next word.\n// The next word must be a legal name.\nconst string* ASFormatter::getFollowingOperator() const\n{\n\t// find next word\n\tsize_t nextNum = currentLine.find_first_not_of(\" \\t\", charNum + 1);\n\tif (nextNum == string::npos)\n\t\treturn NULL;\n\n\tif (!isLegalNameChar(currentLine[nextNum]))\n\t\treturn NULL;\n\n\t// bypass next word and following spaces\n\twhile (nextNum < currentLine.length())\n\t{\n\t\tif (!isLegalNameChar(currentLine[nextNum])\n\t\t        && !isWhiteSpace(currentLine[nextNum]))\n\t\t\tbreak;\n\t\tnextNum++;\n\t}\n\n\tif (nextNum >= currentLine.length()\n\t        || !isCharPotentialOperator(currentLine[nextNum])\n\t        || currentLine[nextNum] == '/')\t\t// comment\n\t\treturn NULL;\n\n\tconst string* newOperator = ASBeautifier::findOperator(currentLine, nextNum, operators);\n\treturn newOperator;\n}\n\n// Check following data to determine if the current character is an array operator.\nbool ASFormatter::isArrayOperator() const\n{\n\tassert(currentChar == '*' || currentChar == '&' || currentChar == '^');\n\tassert(isBracketType(bracketTypeStack->back(), ARRAY_TYPE));\n\n\t// find next word\n\tsize_t nextNum = currentLine.find_first_not_of(\" \\t\", charNum + 1);\n\tif (nextNum == string::npos)\n\t\treturn false;\n\n\tif (!isLegalNameChar(currentLine[nextNum]))\n\t\treturn false;\n\n\t// bypass next word and following spaces\n\twhile (nextNum < currentLine.length())\n\t{\n\t\tif (!isLegalNameChar(currentLine[nextNum])\n\t\t        && !isWhiteSpace(currentLine[nextNum]))\n\t\t\tbreak;\n\t\tnextNum++;\n\t}\n\n\t// check for characters that indicate an operator\n\tif (currentLine[nextNum] == ','\n\t        || currentLine[nextNum] == '}'\n\t        || currentLine[nextNum] == ')'\n\t        || currentLine[nextNum] == '(')\n\t\treturn true;\n\treturn false;\n}\n\n// Reset the flags that indicate various statement information.\nvoid ASFormatter::resetEndOfStatement()\n{\n\tfoundQuestionMark = false;\n\tfoundNamespaceHeader = false;\n\tfoundClassHeader = false;\n\tfoundStructHeader = false;\n\tfoundInterfaceHeader = false;\n\tfoundPreDefinitionHeader = false;\n\tfoundPreCommandHeader = false;\n\tfoundPreCommandMacro = false;\n\tfoundCastOperator = false;\n\tisInPotentialCalculation = false;\n\tisSharpAccessor = false;\n\tisSharpDelegate = false;\n\tisInObjCMethodDefinition = false;\n\tisInObjCInterface = false;\n\tisInObjCSelector = false;\n\tisInEnum = false;\n\tisInExternC = false;\n\telseHeaderFollowsComments = false;\n\tnonInStatementBracket = 0;\n\twhile (!questionMarkStack->empty())\n\t\tquestionMarkStack->pop_back();\n}\n\n// pad an Objective-C method colon\nvoid ASFormatter::padObjCMethodColon()\n{\n\tassert(currentChar == ':');\n\tchar nextChar = peekNextChar();\n\tif (objCColonPadMode == COLON_PAD_NONE\n\t        || objCColonPadMode == COLON_PAD_AFTER\n\t        || nextChar == ')')\n\t{\n\t\t// remove spaces before\n\t\tfor (int i = formattedLine.length() - 1; (i > -1) && isWhiteSpace(formattedLine[i]); i--)\n\t\t\tformattedLine.erase(i);\n\t}\n\telse\n\t{\n\t\t// pad space before\n\t\tfor (int i = formattedLine.length() - 1; (i > 0) && isWhiteSpace(formattedLine[i]); i--)\n\t\t\tif (isWhiteSpace(formattedLine[i - 1]))\n\t\t\t\tformattedLine.erase(i);\n\t\tappendSpacePad();\n\t}\n\tif (objCColonPadMode == COLON_PAD_NONE\n\t        || objCColonPadMode == COLON_PAD_BEFORE\n\t        || nextChar == ')')\n\t{\n\t\t// remove spaces after\n\t\t// do not need to bump i since a char is erased\n\t\tsize_t i = charNum + 1;\n\t\twhile ((i < currentLine.length()) && isWhiteSpace(currentLine[i]))\n\t\t\tcurrentLine.erase(i, 1);\n\t}\n\telse\n\t{\n\t\t// pad space after\n\t\t// do not need to bump i since a char is erased\n\t\tsize_t i = charNum + 1;\n\t\twhile ((i + 1 < currentLine.length()) && isWhiteSpace(currentLine[i]))\n\t\t\tcurrentLine.erase(i, 1);\n\t\tif (((int) currentLine.length() > charNum + 1) && !isWhiteSpace(currentLine[charNum + 1]))\n\t\t\tcurrentLine.insert(charNum + 1, \" \");\n\t}\n}\n\n// Remove the leading '*' from a comment line and indent to the next tab.\nvoid ASFormatter::stripCommentPrefix()\n{\n\tint firstChar = formattedLine.find_first_not_of(\" \\t\");\n\tif (firstChar < 0)\n\t\treturn;\n\n\tif (isInCommentStartLine)\n\t{\n\t\t// comment opener must begin the line\n\t\tif (formattedLine.compare(firstChar, 2, \"/*\") != 0)\n\t\t\treturn;\n\t\tint commentOpener = firstChar;\n\t\t// ignore single line comments\n\t\tint commentEnd = formattedLine.find(\"*/\", firstChar + 2);\n\t\tif (commentEnd != -1)\n\t\t\treturn;\n\t\t// first char after the comment opener must be at least one indent\n\t\tint followingText = formattedLine.find_first_not_of(\" \\t\", commentOpener + 2);\n\t\tif (followingText < 0)\n\t\t\treturn;\n\t\tif (formattedLine[followingText] == '*' || formattedLine[followingText] == '!')\n\t\t\tfollowingText = formattedLine.find_first_not_of(\" \\t\", followingText + 1);\n\t\tif (followingText < 0)\n\t\t\treturn;\n\t\tif (formattedLine[followingText] == '*')\n\t\t\treturn;\n\t\tint indentLen = getIndentLength();\n\t\tint followingTextIndent = followingText - commentOpener;\n\t\tif (followingTextIndent < indentLen)\n\t\t{\n\t\t\tstring stringToInsert(indentLen - followingTextIndent, ' ');\n\t\t\tformattedLine.insert(followingText, stringToInsert);\n\t\t}\n\t\treturn;\n\t}\n\t// comment body including the closer\n\telse if (formattedLine[firstChar] == '*')\n\t{\n\t\tif (formattedLine.compare(firstChar, 2, \"*/\") == 0)\n\t\t{\n\t\t\t// line starts with an end comment\n\t\t\tformattedLine = \"*/\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// build a new line with one indent\n\t\t\tint secondChar = formattedLine.find_first_not_of(\" \\t\", firstChar + 1);\n\t\t\tif (secondChar < 0)\n\t\t\t{\n\t\t\t\tadjustChecksumIn(-'*');\n\t\t\t\tformattedLine.erase();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (formattedLine[secondChar] == '*')\n\t\t\t\treturn;\n\t\t\t// replace the leading '*'\n\t\t\tint indentLen = getIndentLength();\n\t\t\tadjustChecksumIn(-'*');\n\t\t\t// second char must be at least one indent\n\t\t\tif (formattedLine.substr(0, secondChar).find('\\t') != string::npos)\n\t\t\t{\n\t\t\t\tformattedLine.erase(firstChar, 1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint spacesToInsert = 0;\n\t\t\t\tif (secondChar >= indentLen)\n\t\t\t\t\tspacesToInsert = secondChar;\n\t\t\t\telse\n\t\t\t\t\tspacesToInsert = indentLen;\n\t\t\t\tformattedLine = string(spacesToInsert, ' ') + formattedLine.substr(secondChar);\n\t\t\t}\n\t\t\t// remove a trailing '*'\n\t\t\tint lastChar = formattedLine.find_last_not_of(\" \\t\");\n\t\t\tif (lastChar > -1 && formattedLine[lastChar] == '*')\n\t\t\t{\n\t\t\t\tadjustChecksumIn(-'*');\n\t\t\t\tformattedLine[lastChar] = ' ';\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\t// first char not a '*'\n\t\t// first char must be at least one indent\n\t\tif (formattedLine.substr(0, firstChar).find('\\t') == string::npos)\n\t\t{\n\t\t\tint indentLen = getIndentLength();\n\t\t\tif (firstChar < indentLen)\n\t\t\t{\n\t\t\t\tstring stringToInsert(indentLen, ' ');\n\t\t\t\tformattedLine = stringToInsert + formattedLine.substr(firstChar);\n\t\t\t}\n\t\t}\n\t}\n}\n\n}   // end namespace astyle\n"
  },
  {
    "path": "jni/highlight/core/astyle/ASResource.cpp",
    "content": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *   ASResource.cpp\n *\n *   Copyright (C) 2014 by Jim Pattee\n *   <http://www.gnu.org/licenses/lgpl-3.0.html>\n *\n *   This file is a part of Artistic Style - an indentation and\n *   reformatting tool for C, C++, C# and Java source files.\n *   <http://astyle.sourceforge.net>\n *\n *   Artistic Style is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU Lesser General Public License as published\n *   by the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   Artistic Style is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU Lesser General Public License for more details.\n *\n *   You should have received a copy of the GNU Lesser General Public License\n *   along with Artistic Style.  If not, see <http://www.gnu.org/licenses/>.\n *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n */\n\n#include \"astyle/astyle.h\"\n#include <algorithm>\n\n\nnamespace astyle {\n\nconst string ASResource::AS_IF = string(\"if\");\nconst string ASResource::AS_ELSE = string(\"else\");\nconst string ASResource::AS_FOR = string(\"for\");\nconst string ASResource::AS_DO = string(\"do\");\nconst string ASResource::AS_WHILE = string(\"while\");\nconst string ASResource::AS_SWITCH = string(\"switch\");\nconst string ASResource::AS_CASE = string(\"case\");\nconst string ASResource::AS_DEFAULT = string(\"default\");\nconst string ASResource::AS_CLASS = string(\"class\");\nconst string ASResource::AS_VOLATILE = string(\"volatile\");\nconst string ASResource::AS_INTERRUPT = string(\"interrupt\");\nconst string ASResource::AS_NOEXCEPT = string(\"noexcept\");\nconst string ASResource::AS_AUTORELEASEPOOL = string(\"autoreleasepool\");\nconst string ASResource::AS_STRUCT = string(\"struct\");\nconst string ASResource::AS_UNION = string(\"union\");\nconst string ASResource::AS_INTERFACE = string(\"interface\");\nconst string ASResource::AS_NAMESPACE = string(\"namespace\");\nconst string ASResource::AS_END = string(\"end\");\nconst string ASResource::AS_SELECTOR = string(\"selector\");\nconst string ASResource::AS_EXTERN = string(\"extern\");\nconst string ASResource::AS_ENUM = string(\"enum\");\nconst string ASResource::AS_PUBLIC = string(\"public\");\nconst string ASResource::AS_PROTECTED = string(\"protected\");\nconst string ASResource::AS_PRIVATE = string(\"private\");\nconst string ASResource::AS_STATIC = string(\"static\");\nconst string ASResource::AS_SYNCHRONIZED = string(\"synchronized\");\nconst string ASResource::AS_OPERATOR = string(\"operator\");\nconst string ASResource::AS_TEMPLATE = string(\"template\");\nconst string ASResource::AS_TRY = string(\"try\");\nconst string ASResource::AS_CATCH = string(\"catch\");\nconst string ASResource::AS_THROW = string(\"throw\");\nconst string ASResource::AS_FINALLY = string(\"finally\");\nconst string ASResource::_AS_TRY = string(\"__try\");\nconst string ASResource::_AS_FINALLY = string(\"__finally\");\nconst string ASResource::_AS_EXCEPT = string(\"__except\");\nconst string ASResource::AS_THROWS = string(\"throws\");\nconst string ASResource::AS_CONST = string(\"const\");\nconst string ASResource::AS_SEALED = string(\"sealed\");\nconst string ASResource::AS_OVERRIDE = string(\"override\");\nconst string ASResource::AS_WHERE = string(\"where\");\nconst string ASResource::AS_LET = string(\"let\");\nconst string ASResource::AS_NEW = string(\"new\");\n\nconst string ASResource::AS_ASM = string(\"asm\");\nconst string ASResource::AS__ASM__ = string(\"__asm__\");\nconst string ASResource::AS_MS_ASM = string(\"_asm\");\nconst string ASResource::AS_MS__ASM = string(\"__asm\");\n\nconst string ASResource::AS_BAR_DEFINE = string(\"#define\");\nconst string ASResource::AS_BAR_INCLUDE = string(\"#include\");\nconst string ASResource::AS_BAR_IF = string(\"#if\");\nconst string ASResource::AS_BAR_EL = string(\"#el\");\nconst string ASResource::AS_BAR_ENDIF = string(\"#endif\");\n\nconst string ASResource::AS_OPEN_BRACKET = string(\"{\");\nconst string ASResource::AS_CLOSE_BRACKET = string(\"}\");\nconst string ASResource::AS_OPEN_LINE_COMMENT = string(\"//\");\nconst string ASResource::AS_OPEN_COMMENT = string(\"/*\");\nconst string ASResource::AS_CLOSE_COMMENT = string(\"*/\");\n\nconst string ASResource::AS_ASSIGN = string(\"=\");\nconst string ASResource::AS_PLUS_ASSIGN = string(\"+=\");\nconst string ASResource::AS_MINUS_ASSIGN = string(\"-=\");\nconst string ASResource::AS_MULT_ASSIGN = string(\"*=\");\nconst string ASResource::AS_DIV_ASSIGN = string(\"/=\");\nconst string ASResource::AS_MOD_ASSIGN = string(\"%=\");\nconst string ASResource::AS_OR_ASSIGN = string(\"|=\");\nconst string ASResource::AS_AND_ASSIGN = string(\"&=\");\nconst string ASResource::AS_XOR_ASSIGN = string(\"^=\");\nconst string ASResource::AS_GR_GR_ASSIGN = string(\">>=\");\nconst string ASResource::AS_LS_LS_ASSIGN = string(\"<<=\");\nconst string ASResource::AS_GR_GR_GR_ASSIGN = string(\">>>=\");\nconst string ASResource::AS_LS_LS_LS_ASSIGN = string(\"<<<=\");\nconst string ASResource::AS_GCC_MIN_ASSIGN = string(\"<?\");\nconst string ASResource::AS_GCC_MAX_ASSIGN = string(\">?\");\n\nconst string ASResource::AS_RETURN = string(\"return\");\nconst string ASResource::AS_CIN = string(\"cin\");\nconst string ASResource::AS_COUT = string(\"cout\");\nconst string ASResource::AS_CERR = string(\"cerr\");\n\nconst string ASResource::AS_EQUAL = string(\"==\");\nconst string ASResource::AS_PLUS_PLUS = string(\"++\");\nconst string ASResource::AS_MINUS_MINUS = string(\"--\");\nconst string ASResource::AS_NOT_EQUAL = string(\"!=\");\nconst string ASResource::AS_GR_EQUAL = string(\">=\");\nconst string ASResource::AS_GR_GR = string(\">>\");\nconst string ASResource::AS_GR_GR_GR = string(\">>>\");\nconst string ASResource::AS_LS_EQUAL = string(\"<=\");\nconst string ASResource::AS_LS_LS = string(\"<<\");\nconst string ASResource::AS_LS_LS_LS = string(\"<<<\");\nconst string ASResource::AS_QUESTION_QUESTION = string(\"??\");\nconst string ASResource::AS_LAMBDA = string(\"=>\");            // C# lambda expression arrow\nconst string ASResource::AS_ARROW = string(\"->\");\nconst string ASResource::AS_AND = string(\"&&\");\nconst string ASResource::AS_OR = string(\"||\");\nconst string ASResource::AS_SCOPE_RESOLUTION = string(\"::\");\n\nconst string ASResource::AS_PLUS = string(\"+\");\nconst string ASResource::AS_MINUS = string(\"-\");\nconst string ASResource::AS_MULT = string(\"*\");\nconst string ASResource::AS_DIV = string(\"/\");\nconst string ASResource::AS_MOD = string(\"%\");\nconst string ASResource::AS_GR = string(\">\");\nconst string ASResource::AS_LS = string(\"<\");\nconst string ASResource::AS_NOT = string(\"!\");\nconst string ASResource::AS_BIT_OR = string(\"|\");\nconst string ASResource::AS_BIT_AND = string(\"&\");\nconst string ASResource::AS_BIT_NOT = string(\"~\");\nconst string ASResource::AS_BIT_XOR = string(\"^\");\nconst string ASResource::AS_QUESTION = string(\"?\");\nconst string ASResource::AS_COLON = string(\":\");\nconst string ASResource::AS_COMMA = string(\",\");\nconst string ASResource::AS_SEMICOLON = string(\";\");\n\nconst string ASResource::AS_QFOREACH = string(\"Q_FOREACH\");\nconst string ASResource::AS_QFOREVER = string(\"Q_FOREVER\");\nconst string ASResource::AS_FOREVER = string(\"forever\");\nconst string ASResource::AS_FOREACH = string(\"foreach\");\nconst string ASResource::AS_LOCK = string(\"lock\");\nconst string ASResource::AS_UNSAFE = string(\"unsafe\");\nconst string ASResource::AS_FIXED = string(\"fixed\");\nconst string ASResource::AS_GET = string(\"get\");\nconst string ASResource::AS_SET = string(\"set\");\nconst string ASResource::AS_ADD = string(\"add\");\nconst string ASResource::AS_REMOVE = string(\"remove\");\nconst string ASResource::AS_DELEGATE = string(\"delegate\");\nconst string ASResource::AS_UNCHECKED = string(\"unchecked\");\n\nconst string ASResource::AS_CONST_CAST = string(\"const_cast\");\nconst string ASResource::AS_DYNAMIC_CAST = string(\"dynamic_cast\");\nconst string ASResource::AS_REINTERPRET_CAST = string(\"reinterpret_cast\");\nconst string ASResource::AS_STATIC_CAST = string(\"static_cast\");\n\nconst string ASResource::AS_NS_DURING = string(\"NS_DURING\");\nconst string ASResource::AS_NS_HANDLER = string(\"NS_HANDLER\");\n\n/**\n * Sort comparison function.\n * Compares the length of the value of pointers in the vectors.\n * The LONGEST strings will be first in the vector.\n *\n * @param a and b, the string pointers to be compared.\n */\nbool sortOnLength(const string* a, const string* b)\n{\n\treturn (*a).length() > (*b).length();\n}\n\n/**\n * Sort comparison function.\n * Compares the value of pointers in the vectors.\n *\n * @param a and b, the string pointers to be compared.\n */\nbool sortOnName(const string* a, const string* b)\n{\n\treturn *a < *b;\n}\n\n/**\n * Build the vector of assignment operators.\n * Used by BOTH ASFormatter.cpp and ASBeautifier.cpp\n *\n * @param assignmentOperators   a reference to the vector to be built.\n */\nvoid ASResource::buildAssignmentOperators(vector<const string*>* assignmentOperators)\n{\n\tassignmentOperators->push_back(&AS_ASSIGN);\n\tassignmentOperators->push_back(&AS_PLUS_ASSIGN);\n\tassignmentOperators->push_back(&AS_MINUS_ASSIGN);\n\tassignmentOperators->push_back(&AS_MULT_ASSIGN);\n\tassignmentOperators->push_back(&AS_DIV_ASSIGN);\n\tassignmentOperators->push_back(&AS_MOD_ASSIGN);\n\tassignmentOperators->push_back(&AS_OR_ASSIGN);\n\tassignmentOperators->push_back(&AS_AND_ASSIGN);\n\tassignmentOperators->push_back(&AS_XOR_ASSIGN);\n\n\t// Java\n\tassignmentOperators->push_back(&AS_GR_GR_GR_ASSIGN);\n\tassignmentOperators->push_back(&AS_GR_GR_ASSIGN);\n\tassignmentOperators->push_back(&AS_LS_LS_ASSIGN);\n\n\t// Unknown\n\tassignmentOperators->push_back(&AS_LS_LS_LS_ASSIGN);\n\n\tsort(assignmentOperators->begin(), assignmentOperators->end(), sortOnLength);\n}\n\n/**\n * Build the vector of C++ cast operators.\n * Used by ONLY ASFormatter.cpp\n *\n * @param castOperators     a reference to the vector to be built.\n */\nvoid ASResource::buildCastOperators(vector<const string*>* castOperators)\n{\n\tcastOperators->push_back(&AS_CONST_CAST);\n\tcastOperators->push_back(&AS_DYNAMIC_CAST);\n\tcastOperators->push_back(&AS_REINTERPRET_CAST);\n\tcastOperators->push_back(&AS_STATIC_CAST);\n}\n\n/**\n * Build the vector of header words.\n * Used by BOTH ASFormatter.cpp and ASBeautifier.cpp\n *\n * @param headers       a reference to the vector to be built.\n */\nvoid ASResource::buildHeaders(vector<const string*>* headers, int fileType, bool beautifier)\n{\n\theaders->push_back(&AS_IF);\n\theaders->push_back(&AS_ELSE);\n\theaders->push_back(&AS_FOR);\n\theaders->push_back(&AS_WHILE);\n\theaders->push_back(&AS_DO);\n\theaders->push_back(&AS_SWITCH);\n\theaders->push_back(&AS_CASE);\n\theaders->push_back(&AS_DEFAULT);\n\theaders->push_back(&AS_TRY);\n\theaders->push_back(&AS_CATCH);\n\theaders->push_back(&AS_QFOREACH);\t\t// QT\n\theaders->push_back(&AS_QFOREVER);\t\t// QT\n\theaders->push_back(&AS_FOREACH);\t\t// QT & C#\n\theaders->push_back(&AS_FOREVER);\t\t// Qt & Boost\n\n\tif (fileType == C_TYPE)\n\t{\n\t\theaders->push_back(&_AS_TRY);\t\t// __try\n\t\theaders->push_back(&_AS_FINALLY);\t// __finally\n\t\theaders->push_back(&_AS_EXCEPT);\t// __except\n\t}\n\tif (fileType == JAVA_TYPE)\n\t{\n\t\theaders->push_back(&AS_FINALLY);\n\t\theaders->push_back(&AS_SYNCHRONIZED);\n\t}\n\n\tif (fileType == SHARP_TYPE)\n\t{\n\t\theaders->push_back(&AS_FINALLY);\n\t\theaders->push_back(&AS_LOCK);\n\t\theaders->push_back(&AS_FIXED);\n\t\theaders->push_back(&AS_GET);\n\t\theaders->push_back(&AS_SET);\n\t\theaders->push_back(&AS_ADD);\n\t\theaders->push_back(&AS_REMOVE);\n\t}\n\n\tif (beautifier)\n\t{\n\t\tif (fileType == C_TYPE)\n\t\t{\n\t\t\theaders->push_back(&AS_TEMPLATE);\n\t\t}\n\n\t\tif (fileType == JAVA_TYPE)\n\t\t{\n\t\t\theaders->push_back(&AS_STATIC);         // for static constructor\n\t\t}\n\t}\n\tsort(headers->begin(), headers->end(), sortOnName);\n}\n\n/**\n * Build the vector of indentable headers.\n * Used by ONLY ASBeautifier.cpp\n *\n * @param indentableHeaders     a reference to the vector to be built.\n */\nvoid ASResource::buildIndentableHeaders(vector<const string*>* indentableHeaders)\n{\n\tindentableHeaders->push_back(&AS_RETURN);\n\n\tsort(indentableHeaders->begin(), indentableHeaders->end(), sortOnName);\n}\n\n/**\n* Build the vector of indentable macros pairs.\n* Initialized by ASFormatter, used by ONLY ASEnhancer.cpp\n*\n* @param indentableMacros       a reference to the vector to be built.\n*/\nvoid ASResource::buildIndentableMacros(vector<const pair<const string, const string>* >* indentableMacros)\n{\n\t// the pairs must be retained in memory\n\tstatic const struct pair<const string, const string> macros[] =\n\t{\n\t\t// wxWidgets\n\t\tmake_pair(\"BEGIN_EVENT_TABLE\", \"END_EVENT_TABLE\"),\n\t\tmake_pair(\"wxBEGIN_EVENT_TABLE\", \"wxEND_EVENT_TABLE\"),\n\t\t// MFC\n\t\tmake_pair(\"BEGIN_DISPATCH_MAP\", \"END_DISPATCH_MAP\"),\n\t\tmake_pair(\"BEGIN_EVENT_MAP\", \"END_EVENT_MAP\"),\n\t\tmake_pair(\"BEGIN_MESSAGE_MAP\", \"END_MESSAGE_MAP\"),\n\t\tmake_pair(\"BEGIN_PROPPAGEIDS\", \"END_PROPPAGEIDS\"),\n\t};\n\n\tsize_t elements = sizeof(macros) / sizeof(macros[0]);\n\tfor (size_t i = 0; i < elements; i++)\n\t\tindentableMacros->push_back(&macros[i]);\n}\n\n/**\n * Build the vector of non-assignment operators.\n * Used by ONLY ASBeautifier.cpp\n *\n * @param nonAssignmentOperators       a reference to the vector to be built.\n */\nvoid ASResource::buildNonAssignmentOperators(vector<const string*>* nonAssignmentOperators)\n{\n\tnonAssignmentOperators->push_back(&AS_EQUAL);\n\tnonAssignmentOperators->push_back(&AS_PLUS_PLUS);\n\tnonAssignmentOperators->push_back(&AS_MINUS_MINUS);\n\tnonAssignmentOperators->push_back(&AS_NOT_EQUAL);\n\tnonAssignmentOperators->push_back(&AS_GR_EQUAL);\n\tnonAssignmentOperators->push_back(&AS_GR_GR_GR);\n\tnonAssignmentOperators->push_back(&AS_GR_GR);\n\tnonAssignmentOperators->push_back(&AS_LS_EQUAL);\n\tnonAssignmentOperators->push_back(&AS_LS_LS_LS);\n\tnonAssignmentOperators->push_back(&AS_LS_LS);\n\tnonAssignmentOperators->push_back(&AS_ARROW);\n\tnonAssignmentOperators->push_back(&AS_AND);\n\tnonAssignmentOperators->push_back(&AS_OR);\n\tnonAssignmentOperators->push_back(&AS_LAMBDA);\n\n\tsort(nonAssignmentOperators->begin(), nonAssignmentOperators->end(), sortOnLength);\n}\n\n/**\n * Build the vector of header non-paren headers.\n * Used by BOTH ASFormatter.cpp and ASBeautifier.cpp.\n * NOTE: Non-paren headers should also be included in the headers vector.\n *\n * @param nonParenHeaders       a reference to the vector to be built.\n */\nvoid ASResource::buildNonParenHeaders(vector<const string*>* nonParenHeaders, int fileType, bool beautifier)\n{\n\tnonParenHeaders->push_back(&AS_ELSE);\n\tnonParenHeaders->push_back(&AS_DO);\n\tnonParenHeaders->push_back(&AS_TRY);\n\tnonParenHeaders->push_back(&AS_CATCH);\t\t// can be paren or non-paren\n\tnonParenHeaders->push_back(&AS_CASE);\t\t// can be paren or non-paren\n\tnonParenHeaders->push_back(&AS_DEFAULT);\n\tnonParenHeaders->push_back(&AS_QFOREVER);\t// QT\n\tnonParenHeaders->push_back(&AS_FOREVER);\t// Boost\n\n\tif (fileType == C_TYPE)\n\t{\n\t\tnonParenHeaders->push_back(&_AS_TRY);\t\t// __try\n\t\tnonParenHeaders->push_back(&_AS_FINALLY);\t// __finally\n\t}\n\tif (fileType == JAVA_TYPE)\n\t{\n\t\tnonParenHeaders->push_back(&AS_FINALLY);\n\t}\n\n\tif (fileType == SHARP_TYPE)\n\t{\n\t\tnonParenHeaders->push_back(&AS_FINALLY);\n\t\tnonParenHeaders->push_back(&AS_GET);\n\t\tnonParenHeaders->push_back(&AS_SET);\n\t\tnonParenHeaders->push_back(&AS_ADD);\n\t\tnonParenHeaders->push_back(&AS_REMOVE);\n\t}\n\n\tif (beautifier)\n\t{\n\t\tif (fileType == C_TYPE)\n\t\t{\n\t\t\tnonParenHeaders->push_back(&AS_TEMPLATE);\n\t\t}\n\t\tif (fileType == JAVA_TYPE)\n\t\t{\n\t\t\tnonParenHeaders->push_back(&AS_STATIC);\n\t\t}\n\t}\n\tsort(nonParenHeaders->begin(), nonParenHeaders->end(), sortOnName);\n}\n\n/**\n * Build the vector of operators.\n * Used by ONLY ASFormatter.cpp\n *\n * @param operators             a reference to the vector to be built.\n */\nvoid ASResource::buildOperators(vector<const string*>* operators, int fileType)\n{\n\toperators->push_back(&AS_PLUS_ASSIGN);\n\toperators->push_back(&AS_MINUS_ASSIGN);\n\toperators->push_back(&AS_MULT_ASSIGN);\n\toperators->push_back(&AS_DIV_ASSIGN);\n\toperators->push_back(&AS_MOD_ASSIGN);\n\toperators->push_back(&AS_OR_ASSIGN);\n\toperators->push_back(&AS_AND_ASSIGN);\n\toperators->push_back(&AS_XOR_ASSIGN);\n\toperators->push_back(&AS_EQUAL);\n\toperators->push_back(&AS_PLUS_PLUS);\n\toperators->push_back(&AS_MINUS_MINUS);\n\toperators->push_back(&AS_NOT_EQUAL);\n\toperators->push_back(&AS_GR_EQUAL);\n\toperators->push_back(&AS_GR_GR_GR_ASSIGN);\n\toperators->push_back(&AS_GR_GR_ASSIGN);\n\toperators->push_back(&AS_GR_GR_GR);\n\toperators->push_back(&AS_GR_GR);\n\toperators->push_back(&AS_LS_EQUAL);\n\toperators->push_back(&AS_LS_LS_LS_ASSIGN);\n\toperators->push_back(&AS_LS_LS_ASSIGN);\n\toperators->push_back(&AS_LS_LS_LS);\n\toperators->push_back(&AS_LS_LS);\n\toperators->push_back(&AS_QUESTION_QUESTION);\n\toperators->push_back(&AS_LAMBDA);\n\toperators->push_back(&AS_ARROW);\n\toperators->push_back(&AS_AND);\n\toperators->push_back(&AS_OR);\n\toperators->push_back(&AS_SCOPE_RESOLUTION);\n\toperators->push_back(&AS_PLUS);\n\toperators->push_back(&AS_MINUS);\n\toperators->push_back(&AS_MULT);\n\toperators->push_back(&AS_DIV);\n\toperators->push_back(&AS_MOD);\n\toperators->push_back(&AS_QUESTION);\n\toperators->push_back(&AS_COLON);\n\toperators->push_back(&AS_ASSIGN);\n\toperators->push_back(&AS_LS);\n\toperators->push_back(&AS_GR);\n\toperators->push_back(&AS_NOT);\n\toperators->push_back(&AS_BIT_OR);\n\toperators->push_back(&AS_BIT_AND);\n\toperators->push_back(&AS_BIT_NOT);\n\toperators->push_back(&AS_BIT_XOR);\n\tif (fileType == C_TYPE)\n\t{\n\t\toperators->push_back(&AS_GCC_MIN_ASSIGN);\n\t\toperators->push_back(&AS_GCC_MAX_ASSIGN);\n\t}\n\tsort(operators->begin(), operators->end(), sortOnLength);\n}\n\n/**\n * Build the vector of pre-block statements.\n * Used by ONLY ASBeautifier.cpp\n * NOTE: Cannot be both a header and a preBlockStatement.\n *\n * @param preBlockStatements        a reference to the vector to be built.\n */\nvoid ASResource::buildPreBlockStatements(vector<const string*>* preBlockStatements, int fileType)\n{\n\tpreBlockStatements->push_back(&AS_CLASS);\n\tif (fileType == C_TYPE)\n\t{\n\t\tpreBlockStatements->push_back(&AS_STRUCT);\n\t\tpreBlockStatements->push_back(&AS_UNION);\n\t\tpreBlockStatements->push_back(&AS_NAMESPACE);\n\t}\n\tif (fileType == JAVA_TYPE)\n\t{\n\t\tpreBlockStatements->push_back(&AS_INTERFACE);\n\t\tpreBlockStatements->push_back(&AS_THROWS);\n\t}\n\tif (fileType == SHARP_TYPE)\n\t{\n\t\tpreBlockStatements->push_back(&AS_INTERFACE);\n\t\tpreBlockStatements->push_back(&AS_NAMESPACE);\n\t\tpreBlockStatements->push_back(&AS_WHERE);\n\t\tpreBlockStatements->push_back(&AS_STRUCT);\n\t}\n\tsort(preBlockStatements->begin(), preBlockStatements->end(), sortOnName);\n}\n\n/**\n * Build the vector of pre-command headers.\n * Used by BOTH ASFormatter.cpp and ASBeautifier.cpp.\n * NOTE: Cannot be both a header and a preCommandHeader.\n *\n * A preCommandHeader is in a function definition between\n * the closing paren and the opening bracket.\n * e.g. in \"void foo() const {}\", \"const\" is a preCommandHeader.\n */\nvoid ASResource::buildPreCommandHeaders(vector<const string*>* preCommandHeaders, int fileType)\n{\n\tif (fileType == C_TYPE)\n\t{\n\t\tpreCommandHeaders->push_back(&AS_CONST);\n\t\tpreCommandHeaders->push_back(&AS_VOLATILE);\n\t\tpreCommandHeaders->push_back(&AS_INTERRUPT);\n\t\tpreCommandHeaders->push_back(&AS_NOEXCEPT);\n\t\tpreCommandHeaders->push_back(&AS_OVERRIDE);\n\t\tpreCommandHeaders->push_back(&AS_SEALED);\t\t\t// Visual C only\n\t\tpreCommandHeaders->push_back(&AS_AUTORELEASEPOOL);\t// Obj-C only\n\t}\n\n\tif (fileType == JAVA_TYPE)\n\t{\n\t\tpreCommandHeaders->push_back(&AS_THROWS);\n\t}\n\n\tif (fileType == SHARP_TYPE)\n\t{\n\t\tpreCommandHeaders->push_back(&AS_WHERE);\n\t}\n\n\tsort(preCommandHeaders->begin(), preCommandHeaders->end(), sortOnName);\n}\n\n/**\n * Build the vector of pre-definition headers.\n * Used by ONLY ASFormatter.cpp\n * NOTE: Do NOT add 'enum' here. It is an array type bracket.\n * NOTE: Do NOT add 'extern' here. Do not want an extra indent.\n *\n * @param preDefinitionHeaders      a reference to the vector to be built.\n */\nvoid ASResource::buildPreDefinitionHeaders(vector<const string*>* preDefinitionHeaders, int fileType)\n{\n\tpreDefinitionHeaders->push_back(&AS_CLASS);\n\tif (fileType == C_TYPE)\n\t{\n\t\tpreDefinitionHeaders->push_back(&AS_STRUCT);\n\t\tpreDefinitionHeaders->push_back(&AS_UNION);\n\t\tpreDefinitionHeaders->push_back(&AS_NAMESPACE);\n\t}\n\tif (fileType == JAVA_TYPE)\n\t{\n\t\tpreDefinitionHeaders->push_back(&AS_INTERFACE);\n\t}\n\tif (fileType == SHARP_TYPE)\n\t{\n\t\tpreDefinitionHeaders->push_back(&AS_STRUCT);\n\t\tpreDefinitionHeaders->push_back(&AS_INTERFACE);\n\t\tpreDefinitionHeaders->push_back(&AS_NAMESPACE);\n\t}\n\tsort(preDefinitionHeaders->begin(), preDefinitionHeaders->end(), sortOnName);\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *                             ASBase Functions\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\n// check if a specific line position contains a keyword.\nbool ASBase::findKeyword(const string &line, int i, const string &keyword) const\n{\n\tassert(isCharPotentialHeader(line, i));\n\t// check the word\n\tconst size_t keywordLength = keyword.length();\n\tconst size_t wordEnd = i + keywordLength;\n\tif (wordEnd > line.length())\n\t\treturn false;\n\tif (line.compare(i, keywordLength, keyword) != 0)\n\t\treturn false;\n\t// check that this is not part of a longer word\n\tif (wordEnd == line.length())\n\t\treturn true;\n\tif (isLegalNameChar(line[wordEnd]))\n\t\treturn false;\n\t// is not a keyword if part of a definition\n\tconst char peekChar = peekNextChar(line, wordEnd - 1);\n\tif (peekChar == ',' || peekChar == ')')\n\t\treturn false;\n\treturn true;\n}\n\n// get the current word on a line\n// index must point to the beginning of the word\nstring ASBase::getCurrentWord(const string &line, size_t index) const\n{\n\tassert(isCharPotentialHeader(line, index));\n\tsize_t lineLength = line.length();\n\tsize_t i;\n\tfor (i = index; i < lineLength; i++)\n\t{\n\t\tif (!isLegalNameChar(line[i]))\n\t\t\tbreak;\n\t}\n\treturn line.substr(index, i - index);\n}\n\n}   // end namespace astyle\n"
  },
  {
    "path": "jni/highlight/core/astyle/ASStreamIterator.cpp",
    "content": "\n#include \"astyle/ASStreamIterator.h\"\n\nnamespace astyle\n{\n\n\nASStreamIterator::ASStreamIterator(istream *in)\n{\n\tinStream = in;\n\tbuffer.reserve(200);\n\teolWindows = eolLinux = eolMacOld = 0;\n\tpeekStart = 0;\n\tprevLineDeleted = false;\n\tcheckForEmptyLine = false;\n}\n\n\nASStreamIterator::~ASStreamIterator()\n{\n}\n\n// save the last input line after input has reached EOF\n\nvoid ASStreamIterator::saveLastInputLine()\n{\n\tassert(inStream->eof());\n\tprevBuffer = buffer;\n}\n\n/**\n * read the input stream, delete any end of line characters,\n *     and build a string that contains the input line.\n *\n * @return        string containing the next input line minus any end of line characters\n */\n//template<typename T>\nstring ASStreamIterator::nextLine(bool emptyLineWasDeleted)\n{\n\t// verify that the current position is correct\n\tassert (peekStart == 0);\n\n\t// a deleted line may be replaced if break-blocks is requested\n\t// this sets up the compare to check for a replaced empty line\n\tif (prevLineDeleted)\n\t{\n\t\tprevLineDeleted = false;\n\t\tcheckForEmptyLine = true;\n\t}\n\tif (!emptyLineWasDeleted)\n\t\tprevBuffer = buffer;\n\telse\n\t\tprevLineDeleted = true;\n\n\t// read the next record\n\tbuffer.clear();\n\tchar ch;\n\tinStream->get(ch);\n\n\twhile (!inStream->eof() && ch != '\\n' && ch != '\\r')\n\t{\n\t\tbuffer.append(1, ch);\n\t\tinStream->get(ch);\n\t}\n\n\tif (inStream->eof())\n\t{\n\t\treturn buffer;\n\t}\n\n\tint peekCh = inStream->peek();\n\n\t// find input end-of-line characters\n\tif (!inStream->eof())\n\t{\n\t\tif (ch == '\\r')         // CR+LF is windows otherwise Mac OS 9\n\t\t{\n\t\t\tif (peekCh == '\\n')\n\t\t\t{\n\t\t\t\tinStream->get(ch);\n\t\t\t\teolWindows++;\n\t\t\t}\n\t\t\telse\n\t\t\t\teolMacOld++;\n\t\t}\n\t\telse                    // LF is Linux, allow for improbable LF/CR\n\t\t{\n\t\t\tif (peekCh == '\\r')\n\t\t\t{\n\t\t\t\tinStream->get(ch);\n\t\t\t\teolWindows++;\n\t\t\t}\n\t\t\telse\n\t\t\t\teolLinux++;\n\t\t}\n\t}\n\telse\n\t{\n\t\tinStream->clear();\n\t}\n\n\t// set output end of line characters\n\tif (eolWindows >= eolLinux)\n\t{\n\t\tif (eolWindows >= eolMacOld)\n\t\t\tstrcpy(outputEOL, \"\\r\\n\");  // Windows (CR+LF)\n\t\telse\n\t\t\tstrcpy(outputEOL, \"\\r\");    // MacOld (CR)\n\t}\n\telse if (eolLinux >= eolMacOld)\n\t\tstrcpy(outputEOL, \"\\n\");    // Linux (LF)\n\telse\n\t\tstrcpy(outputEOL, \"\\r\");    // MacOld (CR)\n\n\treturn buffer;\n}\n\n// save the current position and get the next line\n// this can be called for multiple reads\n// when finished peeking you MUST call peekReset()\n// call this function from ASFormatter ONLY\n//template<typename T>\nstring ASStreamIterator::peekNextLine()\n{\n\tassert (hasMoreLines());\n\tstring nextLine;\n\tchar ch;\n\n\tif (peekStart == 0)\n\t\tpeekStart = inStream->tellg();\n\n\t// read the next record\n\tinStream->get(ch);\n\twhile (!inStream->eof() && ch != '\\n' && ch != '\\r')\n\t{\n\t\tnextLine.append(1, ch);\n\t\tinStream->get(ch);\n\t}\n\n\tif (inStream->eof())\n\t{\n\t\treturn nextLine;\n\t}\n\n\tint peekCh = inStream->peek();\n\n\t// remove end-of-line characters\n\tif (!inStream->eof())\n\t{\n\t\tif ((peekCh == '\\n' || peekCh == '\\r') && peekCh != ch)  /////////////  changed  //////////\n\t\t\tinStream->get(ch);\n\t}\n\n\treturn nextLine;\n}\n\n// reset current position and EOF for peekNextLine()\n//template<typename T>\nvoid ASStreamIterator::peekReset()\n{\n\tassert(peekStart != 0);\n\tinStream->clear();\n\tinStream->seekg(peekStart);\n\tpeekStart = 0;\n}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/bbcodegenerator.cpp",
    "content": "/***************************************************************************\n                    bbcodegenerator.cpp  -  description\n                             -------------------\n    begin                : Jul 21 2009\n    copyright            : (C) 2004-2009 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include <sstream>\n\n#include \"bbcodegenerator.h\"\n\nusing namespace std;\n\nnamespace highlight\n{\n\n\tBBCodeGenerator::BBCodeGenerator() : CodeGenerator ( BBCODE )\n\t{\n\t\tnewLineTag = \"\\n\";\n\t\tspacer = \" \";\n\t}\n\n\tBBCodeGenerator::~BBCodeGenerator() {}\n\n\tstring BBCodeGenerator::getHeader()\n\t{\n\t\treturn string();\n\t}\n\n\tvoid BBCodeGenerator::printBody()\n\t{\n                *out << \"[size=\"<<getBaseFontSize()<<\"]\"; // TODO hier pt?\n\t\tprocessRootState();\n\t\t*out << \"[/size]\";\n\t}\n\n\tstring BBCodeGenerator::getFooter()\n\t{\n\t\treturn string();\n\t}\n\n\tstring  BBCodeGenerator::getOpenTag (const ElementStyle & elem )\n\t{\n\t\tostringstream s;\n\n\t\ts << \"[color=#\";\n\t\ts  << elem.getColour().getRed ( HTML )\n\t\t   << elem.getColour().getGreen ( HTML )\n\t\t   << elem.getColour().getBlue ( HTML )\n\t\t   << \"]\";\n\n\t\tif ( elem.isBold() ) s << \"[b]\";\n\t\tif ( elem.isItalic() ) s << \"[i]\";\n\t\tif ( elem.isUnderline() ) s << \"[u]\";\n\t\treturn  s.str();\n\t}\n\n\tstring  BBCodeGenerator::getCloseTag ( const ElementStyle &elem )\n\t{\n\t\tostringstream s;\n\t\tif ( elem.isUnderline() ) s << \"[/u]\";\n\t\tif ( elem.isItalic() ) s << \"[/i]\";\n\t\tif ( elem.isBold() ) s << \"[/b]\";\n\t\ts << \"[/color]\";\n\t\treturn  s.str();\n\t}\n\n\tvoid BBCodeGenerator::initOutputTags ()\n\t{\n\t\topenTags.push_back ( \"\");\n\t\topenTags.push_back ( getOpenTag ( docStyle.getStringStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getNumberStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getSingleLineCommentStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getCommentStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getEscapeCharStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getPreProcessorStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getPreProcStringStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getLineStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getOperatorStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getInterpolationStyle() ) );\n\n\t\tcloseTags.push_back ( \"\" );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getStringStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getNumberStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getSingleLineCommentStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getCommentStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getEscapeCharStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getPreProcessorStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getPreProcStringStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getLineStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getOperatorStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getInterpolationStyle() ) );\n\t}\n\n\tstring BBCodeGenerator::maskCharacter ( unsigned char c )\n\t{\n\t\treturn string ( 1, c );\n\t}\n\n\tstring BBCodeGenerator::getKeywordOpenTag ( unsigned int styleID )\n\t{\n\t\treturn getOpenTag (docStyle.getKeywordStyle ( currentSyntax->getKeywordClasses() [styleID] ) );\n\t}\n\n\tstring BBCodeGenerator::getKeywordCloseTag ( unsigned int styleID )\n\t{\n\t\treturn getCloseTag ( docStyle.getKeywordStyle ( currentSyntax->getKeywordClasses() [styleID] ) );\n\t}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/codegenerator.cpp",
    "content": "/***************************************************************************\n                          codegenerator.cpp  -  description\n                             -------------------\n    begin                : Die Jul 9 2002\n    copyright            : (C) 2002-2012 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include <climits>\n#include <memory>\n#include <boost/xpressive/xpressive_dynamic.hpp>\n\n#include \"codegenerator.h\"\n#include \"objectgenerator.h\"\n\n#include \"htmlgenerator.h\"\n#include \"xhtmlgenerator.h\"\n#include \"rtfgenerator.h\"\n#include \"latexgenerator.h\"\n#include \"texgenerator.h\"\n#include \"svggenerator.h\"\n#include \"bbcodegenerator.h\"\n#include \"pangogenerator.h\"\n#include \"odtgenerator.h\"\n#include \"astyle/astyle.h\"\n#include \"astyle/ASStreamIterator.h\"\n\n#if !defined (QT)\n\n#include \"ansigenerator.h\"\n#include \"xterm256generator.h\"\n\n#endif\n\n\n#if ANDROID\n#include <android/log.h>\n#ifndef TAG_NAME\n    #define TAG_NAME \"highliter\"\n#endif\n#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, TAG_NAME, __VA_ARGS__))\n#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, TAG_NAME, __VA_ARGS__))\n#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, TAG_NAME, __VA_ARGS__))\n#define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, TAG_NAME, __VA_ARGS__))\n#else\n#define LOGI(...)\n#define LOGW(...)\n#define LOGE(...)\n#endif\n\nusing namespace std;\n\nnamespace highlight {\n    const unsigned int CodeGenerator::NUMBER_BUILTIN_STATES = highlight::KEYWORD;\n\n    const string CodeGenerator::STY_NAME_STD = \"std\";\n    const string CodeGenerator::STY_NAME_STR = \"str\";\n    const string CodeGenerator::STY_NAME_NUM = \"num\";\n    const string CodeGenerator::STY_NAME_SLC = \"slc\";\n    const string CodeGenerator::STY_NAME_COM = \"com\";\n    const string CodeGenerator::STY_NAME_ESC = \"esc\";\n    const string CodeGenerator::STY_NAME_DIR = \"ppc\"; //preprocessor\n    const string CodeGenerator::STY_NAME_DST = \"pps\"; //preprocessor string\n    const string CodeGenerator::STY_NAME_LIN = \"lin\";\n    const string CodeGenerator::STY_NAME_SYM = \"opt\"; //operator\n    const string CodeGenerator::STY_NAME_IPL = \"ipl\"; //interpolation\n\n    CodeGenerator *CodeGenerator::getInstance(OutputType type) {\n        CodeGenerator *generator = NULL;\n        switch (type) {\n\n            case OBJECT:\n                generator = new ObjectGenerator();\n                break;\n            case HTML:\n                generator = new HtmlGenerator();\n                break;\n            case XHTML:\n                generator = new XHtmlGenerator();\n                break;\n            case TEX:\n                generator = new TexGenerator();\n                break;\n            case LATEX:\n                generator = new LatexGenerator();\n                break;\n            case RTF:\n                generator = new RtfGenerator();\n                break;\n            case SVG:\n                generator = new SVGGenerator();\n                break;\n            case BBCODE:\n                generator = new BBCodeGenerator();\n                break;\n            case PANGO:\n                generator = new PangoGenerator();\n                break;\n            case ODTFLAT:\n                generator = new ODTGenerator();\n                break;\n#if !defined (QT)\n            case ANSI:\n                generator = new AnsiGenerator();\n                break;\n            case XTERM256:\n                generator = new Xterm256Generator();\n                break;\n#endif\n            default:\n                break;\n        }\n        return generator;\n    }\n\n\n    CodeGenerator::CodeGenerator(highlight::OutputType type)\n            : currentSyntax(NULL),\n              in(NULL),\n              out(NULL),\n              encoding(\"none\"),\n              docTitle(\"Source file\"),\n              maskWs(false),\n              excludeWs(false),\n              fragmentOutput(false),\n              showLineNumbers(false),\n              lineNumberFillZeroes(false),\n              printNewLines(true),\n              baseFontSize(\"10\"),\n              lineNumber(0),\n              lineNumberOffset(0),\n              includeStyleDef(false),\n              lineIndex(0),\n              lineNumberWidth(5),\n              maxLineCnt(UINT_MAX),\n              terminatingChar('\\0'),\n              formatter(NULL),\n              formattingEnabled(false),\n              formattingPossible(false),\n              validateInput(false),\n              numberWrappedLines(\n                      true),    //until now, wrapped lines were always numbered, so this remains the default.\n              noTrailingNewLine(false),\n              resultOfHook(false),\n              keywordCase(StringTools::CASE_UNCHANGED),\n              eolDelimiter('\\n'),\n              outputType(type) {\n    }\n\n\n    CodeGenerator::~CodeGenerator() {\n        delete formatter;\n\n        for (map<string, SyntaxReader *>::iterator it = syntaxReaders.begin();\n             it != syntaxReaders.end(); it++) {\n            delete it->second;\n        }\n    }\n\n\n    bool CodeGenerator::initTheme(const string &themePath) {\n        this->themePath = themePath;\n        bool loadOK = docStyle.load(themePath, outputType);\n        initOutputTags();\n        return loadOK;\n    }\n\n    const string &CodeGenerator::getStyleName() {\n        return themePath;\n    }\n\n    void CodeGenerator::setLineNumberWidth(int w) {\n        lineNumberWidth = w;\n    }\n\n    int CodeGenerator::getLineNumberWidth() {\n        return lineNumberWidth;\n    }\n\n    void CodeGenerator::setPrintLineNumbers(bool flag, unsigned int startCnt) {\n        showLineNumbers = flag;\n        lineNumberOffset = startCnt - 1;\n    }\n\n    bool CodeGenerator::getPrintLineNumbers() {\n        return showLineNumbers;\n    }\n\n    void CodeGenerator::setPrintZeroes(bool flag) {\n        lineNumberFillZeroes = flag;\n    }\n\n    bool CodeGenerator::getPrintZeroes() {\n        return lineNumberFillZeroes;\n    }\n\n    void CodeGenerator::setIncludeStyle(bool flag) {\n        includeStyleDef = flag;\n    }\n\n    void CodeGenerator::disableTrailingNL(bool flag) {\n        noTrailingNewLine = flag;\n    }\n\n    void CodeGenerator::setStyleInputPath(const string &path) {\n        styleInputPath = path;\n    }\n\n    void CodeGenerator::setStyleOutputPath(const string &path) {\n        styleOutputPath = path;\n    }\n\n    void CodeGenerator::setPluginReadFile(const string &path) {\n        pluginReadFile = path;\n    }\n\n    const string &CodeGenerator::getStyleInputPath() {\n        return styleInputPath;\n    }\n\n    const string &CodeGenerator::getStyleOutputPath() {\n        return styleOutputPath;\n    }\n\n    void CodeGenerator::setFragmentCode(bool flag) {\n        fragmentOutput = flag;\n    }\n\n    bool CodeGenerator::getFragmentCode() {\n        return fragmentOutput;\n    }\n\n    void CodeGenerator::setValidateInput(bool flag) {\n        validateInput = flag;\n    }\n\n    bool CodeGenerator::getValidateInput() {\n        return validateInput;\n    }\n\n\n    void CodeGenerator::setNumberWrappedLines(bool flag) {\n        numberWrappedLines = flag;\n    }\n\n    bool CodeGenerator::getNumberWrappedLines() {\n        return numberWrappedLines;\n    }\n\n    void CodeGenerator::setBaseFont(const string &s) {\n        baseFont = s;\n    }\n\n    void CodeGenerator::setBaseFontSize(const string &s) {\n        baseFontSize = s;\n    }\n\n    void CodeGenerator::setStartingNestedLang(const string &langName) {\n        embedLangStart = langName;\n    }\n\n    const string CodeGenerator::getBaseFont() const {\n        if (!baseFont.empty()) return baseFont;\n        switch (outputType) {\n            case HTML:\n            case XHTML:\n                return \"'Courier New',monospace\";\n                break;\n            case LATEX:\n                return \"ttfamily\";\n                break;\n            case TEX:\n                return \"tt\";\n                break;\n            case ODTFLAT:\n                return \"FreeMono\";\n                break;\n            default:\n                return \"Courier New\";\n        }\n    }\n\n    const string CodeGenerator::getBaseFontSize() {\n        return baseFontSize;\n    }\n\n    void CodeGenerator::setTitle(const string &title) {\n        if (!title.empty()) docTitle = title;\n    }\n\n    string CodeGenerator::getTitle() {\n        return docTitle;\n    }\n\n    void CodeGenerator::setEncoding(const string &encodingName) {\n        encoding = encodingName;\n    }\n\n    bool CodeGenerator::formattingDisabled() {\n        return !formattingEnabled;\n    }\n\n    void CodeGenerator::setMaxInputLineCnt(unsigned int cnt) {\n        maxLineCnt = cnt;\n    }\n\n    bool CodeGenerator::formattingIsPossible() {\n        return formattingPossible;\n    }\n\n    void CodeGenerator::setPreformatting(WrapMode lineWrappingStyle,\n                                         unsigned int lineLength,\n                                         int numberSpaces) {\n        bool enableWrap = lineWrappingStyle != WRAP_DISABLED;\n        bool replaceTabs = numberSpaces > 0;\n\n        if (enableWrap || replaceTabs) {\n            preFormatter.setWrap(enableWrap);\n            preFormatter.setWrapIndentBraces(lineWrappingStyle == WRAP_DEFAULT);\n            preFormatter.setWrapLineLength(lineLength);\n            preFormatter.setReplaceTabs(replaceTabs);\n            preFormatter.setNumberSpaces(numberSpaces);\n        }\n    }\n\n    void CodeGenerator::setKeyWordCase(StringTools::KeywordCase keyCase) {\n        keywordCase = keyCase;\n    }\n\n    void CodeGenerator::setEOLDelimiter(char delim) {\n        eolDelimiter = delim;\n    }\n\n    void CodeGenerator::reset() {\n        lineIndex = 0;\n        lineNumber = 0;\n        line.clear();\n        preFormatter.reset();\n        inFile.clear();\n        outFile.clear();\n        hostLangDefPath.clear();\n        embedLangDefPath.clear();\n        printNewLines = true;\n    }\n\n    string CodeGenerator::getThemeInitError() {\n        return docStyle.getErrorMessage();\n    }\n\n    string CodeGenerator::getPluginScriptError() {\n        return userScriptError;\n    }\n\n    string CodeGenerator::getSyntaxRegexError() {\n        return (currentSyntax) ? currentSyntax->getFailedRegex() : \"syntax undef\";\n    }\n\n    string CodeGenerator::getSyntaxLuaError() {\n        return (currentSyntax) ? currentSyntax->getLuaErrorText() : \"syntax undef\";\n\n    }\n\n    string CodeGenerator::getSyntaxDescription() {\n        return (currentSyntax) ? currentSyntax->getDescription() : \"syntax undef\";\n\n    }\n\n    unsigned int CodeGenerator::getLineNumber() {\n        return lineNumber;\n    }\n\n    bool CodeGenerator::readNewLine(string & newLine) {\n        bool eof;\n        if (lineIndex) terminatingChar = newLine[lineIndex - 1];\n        if (formattingPossible && formattingEnabled) {\n            eof = !formatter->hasMoreLines();\n            if (!eof) {\n                newLine = formatter->nextLine();\n            }\n        }\n        else {\n            eof = !getline(*in, newLine, eolDelimiter);\n        }\n\n#ifndef _WIN32\n        // drop CR of CRLF files\n        if (!newLine.empty() && newLine[newLine.size() - 1] == '\\r')\n            newLine.erase(newLine.size() - 1);\n#endif\n\n        return eof || (lineNumber == maxLineCnt);\n    }\n\n    void CodeGenerator::matchRegex(const string &line) {\n        regexGroups.clear();\n        int matchBegin = 0;\n        int groupID = 0;\n\n        // cycle through all regex, save the start and ending indices of matches to report them later\n        for (unsigned int i = 0; i < currentSyntax->getRegexElements().size(); i++) {\n            RegexElement *regexElem = currentSyntax->getRegexElements()[i];\n\n            boost::xpressive::sregex_iterator cur(line.begin(), line.end(), regexElem->rex);\n            boost::xpressive::sregex_iterator end;\n\n            for (; cur != end; ++cur) {\n                groupID = (regexElem->capturingGroup < 0) ? cur->size() - 1\n                                                          : regexElem->capturingGroup;\n                matchBegin = cur->position(groupID);\n                regexGroups.insert(\n                        make_pair(matchBegin + 1,\n                                  ReGroup(regexElem->open, cur->length(groupID), regexElem->kwClass,\n                                          regexElem->langName)));\n            }\n        }\n    }\n\n    unsigned char CodeGenerator::getInputChar() {\n        bool eol = lineIndex == line.length();\n\n        if (eol) {\n            bool eof = false;\n            if (preFormatter.isEnabled()) {\n                if (!preFormatter.hasMoreLines()) {\n                    eof = readNewLine(line);\n                    preFormatter.setLine(line);\n                    ++lineNumber;\n                    numberCurrentLine = true;\n                } else {\n                    if (numberWrappedLines)\n                        ++lineNumber;\n                    numberCurrentLine = numberWrappedLines;\n                }\n\n                line = preFormatter.getNextLine();\n            }\n            else {\n                eof = readNewLine(line);\n                ++lineNumber;\n\n                numberCurrentLine = true;\n            }\n            lineIndex = 0;\n            matchRegex(line);\n\n            return (eof) ? '\\0' : '\\n';\n        }\n\n        return line[lineIndex++];\n    }\n\n    State CodeGenerator::getCurrentState(State oldState) {\n\n        unsigned char c = '\\0';\n\n        if (token.length() == 0) {\n            c = getInputChar();\n        }\n        else {\n            lineIndex -= (token.length() - 1);\n            c = token[0];\n        }\n        if (c == '\\n') {\n            return _EOL;   // End of line\n        }\n\n        if (c == '\\0') {\n            return _EOF;   // End of file\n        }\n\n        if (c == ' ' || c == '\\t') {\n            token = c;\n            return _WS;\n        }\n\n        // Test if a regular expression was found at the current position\n        if (!regexGroups.empty()) {\n            if (regexGroups.count(lineIndex)) {\n                token = line.substr(lineIndex - 1, regexGroups[lineIndex].length);\n                unsigned int oldIndex = lineIndex;\n                if (regexGroups[oldIndex].length > 1) lineIndex += regexGroups[oldIndex].length - 1;\n\n\n                if (regexGroups[oldIndex].state == EMBEDDED_CODE_BEGIN) {\n                    embedLangDefPath = currentSyntax->getNewPath(regexGroups[oldIndex].name);\n                }\n\n                if (regexGroups[oldIndex].state == IDENTIFIER_BEGIN ||\n                    regexGroups[oldIndex].state == KEYWORD) {\n                    string reservedWord = (currentSyntax->isIgnoreCase())\n                                          ? StringTools::change_case(token) : token;\n                    currentKeywordClass = currentSyntax->isKeyword(reservedWord);\n                    if (!currentKeywordClass && regexGroups[oldIndex].state == KEYWORD)\n                        currentKeywordClass = regexGroups[oldIndex].kwClass;\n                    return validateState((currentKeywordClass) ? KEYWORD : STANDARD, oldState,\n                                         currentKeywordClass);\n                }\n                else {\n                    return validateState(regexGroups[oldIndex].state, oldState, 0);\n                }\n            }\n        }\n\n        // Character not referring to any state\n        token = c;\n        return STANDARD;\n    }\n\n\n    State CodeGenerator::validateState(State newState, State oldState, unsigned int kwClass) {\n\n        if (currentSyntax->getValidateStateChangeFct()) {\n\n            Diluculum::LuaValueList params;\n            params.push_back(Diluculum::LuaValue(oldState));\n            params.push_back(Diluculum::LuaValue(newState));\n            params.push_back(Diluculum::LuaValue(token));\n            params.push_back(Diluculum::LuaValue(kwClass));\n\n            Diluculum::LuaValueList res =\n                    currentSyntax->getLuaState()->call(*currentSyntax->getValidateStateChangeFct(),\n                                                       params, \"getValidateStateChangeFct call\");\n\n            resultOfHook = res.size() == 1;\n            if (resultOfHook) {\n                return (State) res[0].asNumber();\n            }\n        }\n        resultOfHook = false;\n        return newState;\n    }\n\n//it is faster to pass ostream reference\n    void CodeGenerator::maskString(ostream &ss, const string &s) {\n        for (unsigned int i = 0; i < s.length(); i++) {\n            ss << maskCharacter(s[i]);\n        }\n    }\n\n    void CodeGenerator::printMaskedToken( /*bool addMetaInfo,*/ bool flushWhiteSpace,\n                                                                StringTools::KeywordCase tcase) {\n        if (flushWhiteSpace)\n            flushWs();\n\n        if (currentSyntax->getDecorateFct()) {\n            Diluculum::LuaValueList params;\n            params.push_back(Diluculum::LuaValue(token));\n            params.push_back(Diluculum::LuaValue(currentState));\n            params.push_back(Diluculum::LuaValue(currentKeywordClass));\n\n            Diluculum::LuaValueList res =\n                    currentSyntax->getLuaState()->call(*currentSyntax->getDecorateFct(),\n                                                       params, \"getDecorateFct call\");\n            if (res.size() == 1) {\n                *out << res[0].asString();\n                //LOGI(\"printMaskedToken1=%s\", res[0].asString().c_str());\n            } else {\n                maskString(*out, StringTools::change_case(token, tcase));\n                //LOGI(\"printMaskedToken2=%s\", StringTools::change_case(token, tcase).c_str());\n\n            }\n        } else {\n            maskString(*out, StringTools::change_case(token, tcase));\n            //LOGI(\"printMaskedToken3=%s\", StringTools::change_case(token, tcase).c_str());\n\n        }\n\n        token.clear();\n    }\n\n    bool CodeGenerator::styleFound() {\n        return docStyle.found();\n    }\n\n    bool CodeGenerator::printIndexFile(const vector <string> &fileList,\n                                       const string &outPath) {\n        return true;\n    }\n\n    bool CodeGenerator::initIndentationScheme(const string &indentScheme) {\n\n        if (formatter != NULL) {\n            return true;\n        }\n\n        if (!indentScheme.size()) return false;\n\n        formatter = new astyle::ASFormatter();\n\n        formatter->setParensHeaderPaddingMode(true);\n\n        if (indentScheme == \"allman\" || indentScheme == \"bsd\" || indentScheme == \"ansi\") {\n            formatter->setFormattingStyle(astyle::STYLE_ALLMAN);\n        }\n        else if (indentScheme == \"kr\" || indentScheme == \"k&r\" || indentScheme == \"k/r\") {\n            formatter->setFormattingStyle(astyle::STYLE_KR);\n        }\n        else if (indentScheme == \"java\") {\n            formatter->setFormattingStyle(astyle::STYLE_JAVA);\n        }\n        else if (indentScheme == \"stroustrup\") {\n            formatter->setFormattingStyle(astyle::STYLE_STROUSTRUP);\n        }\n        else if (indentScheme == \"whitesmith\") {\n            formatter->setFormattingStyle(astyle::STYLE_WHITESMITH);\n        }\n        else if (indentScheme == \"banner\") {\n            formatter->setFormattingStyle(astyle::STYLE_BANNER);\n        }\n        else if (indentScheme == \"gnu\") {\n            formatter->setFormattingStyle(astyle::STYLE_GNU);\n        }\n        else if (indentScheme == \"linux\") {\n            formatter->setFormattingStyle(astyle::STYLE_LINUX);\n        }\n        else if (indentScheme == \"horstmann\") {\n            formatter->setFormattingStyle(astyle::STYLE_HORSTMANN);\n        }\n        else if (indentScheme == \"otbs\" || indentScheme == \"1tbs\") {\n            formatter->setFormattingStyle(astyle::STYLE_1TBS);\n        }\n        else if (indentScheme == \"google\") {\n            formatter->setFormattingStyle(astyle::STYLE_GOOGLE);\n        }\n        else if (indentScheme == \"pico\" || indentScheme == \"a11\") {\n            formatter->setFormattingStyle(astyle::STYLE_PICO);\n        }\n        else if (indentScheme == \"lisp\" || indentScheme == \"python\" || indentScheme == \"a12\") {\n            formatter->setFormattingStyle(astyle::STYLE_LISP);\n        }\n        else if (indentScheme == \"vtk\") {\n            formatter->setFormattingStyle(astyle::STYLE_VTK);\n        }\n        else {\n            return false;\n        }\n        return formattingEnabled = true;\n    }\n\n    LoadResult CodeGenerator::loadLanguage(const string &langDefPath) {\n\n        bool reloadNecessary = currentSyntax ? currentSyntax->needsReload(langDefPath) : true;\n        LoadResult result = LOAD_OK;\n\n        if (reloadNecessary) {\n            if (syntaxReaders.count(langDefPath)) {\n                currentSyntax = syntaxReaders[langDefPath];\n                result = LOAD_OK;\n            } else {\n                currentSyntax = new SyntaxReader();\n                result = currentSyntax->load(langDefPath, pluginReadFile, outputType);\n                syntaxReaders[langDefPath] = currentSyntax;\n            }\n\n            if (result == LOAD_OK) {\n                formattingPossible = currentSyntax->enableReformatting();\n\n                if (openTags.size() > NUMBER_BUILTIN_STATES) {\n                    // remove dynamic keyword tag delimiters of the old language definition\n                    vector<string>::iterator keyStyleOpenBegin =\n                            openTags.begin() + NUMBER_BUILTIN_STATES;\n                    vector<string>::iterator keyStyleCloseBegin =\n                            closeTags.begin() + NUMBER_BUILTIN_STATES;\n                    openTags.erase(keyStyleOpenBegin, openTags.end());\n                    closeTags.erase(keyStyleCloseBegin, closeTags.end());\n                }\n                // add new keyword tag delimiters\n                for (unsigned int i = 0; i < currentSyntax->getKeywordClasses().size(); i++) {\n                    openTags.push_back(getKeywordOpenTag(i));\n                    closeTags.push_back(getKeywordCloseTag(i));\n                }\n            }\n        }\n        return result;\n    }\n\n    bool CodeGenerator::validateInputStream() {\n        if (!in) return false;\n\n        // it is not possible to move stream pointer back with stdin\n        if ((int) in->tellg() == -1) // -1 : stdin\n            return true;\n\n        // Sources: http://en.wikipedia.org/wiki/Magic_number_(programming)\n        // Magic configuration of \"file\"\n        // This is intended for web plugins - only check filetypes often found in the net\n        char magic_gif[] = {'G', 'I', 'F', '8', 0};\n        char magic_png[] = {'\\x89', 'P', 'N', 'G', 0};\n        char magic_java[] = {'\\xCA', '\\xFE', '\\xBA', '\\xBE', 0};\n        char magic_jpeg[] = {'\\xFF', '\\xD8', '\\xFF', 0};\n        char magic_bmp[] = {'B', 'M', 0};\n        char magic_pdf[] = {'%', 'P', 'D', 'F', 0};\n        char magic_utf8[] = {'\\xEF', '\\xBB', '\\xBF', 0};\n        char magic_rar[] = {'R', 'a', 'r', '!', 0};\n        char magic_zip[] = {'P', 'K', '\\x03', '\\x04', 0};\n        char magic_ace[] = {'*', '*', 'A', 'C', 'E', '*', '*', 0};\n        char magic_tgz[] = {'\\x8b', '\\x1f', '\\x00', '\\x08', 0};\n        char magic_bzip[] = {'B', 'Z', 0};\n\n        char *magic_table[] = {magic_utf8,\n                               magic_gif, magic_png, magic_jpeg, magic_bmp, magic_pdf,\n                               magic_java,\n                               magic_rar, magic_zip, magic_ace, magic_tgz, magic_bzip,\n                               0\n        };\n\n        char buffer[10] = {0};\n        in->read(buffer, 8);  //only read the first 8 bytes of input stream\n\n        int magic_index = 0;\n        while (magic_table[magic_index]) {\n            if (!strncmp(buffer, magic_table[magic_index], strlen(magic_table[magic_index]))) {\n                break;\n            }\n            magic_index++;\n        }\n        int streamReadPos = 0;\n        if (magic_table[magic_index] == magic_utf8) {\n            //setEncoding(\"utf-8\");\n            streamReadPos = 3; // remove UTF-8 magic number from output\n        }\n\n        in->seekg(streamReadPos, ios::beg);\n        in->clear();  // clear fail bit to continue reading\n\n        return !magic_table[magic_index] // points to 0 if no pattern was found\n               || magic_table[magic_index] == magic_utf8;\n    }\n\n    ParseError CodeGenerator::generateFile(const string &inFileName,\n                                           const string &outFileName) {\n        if (!docStyle.found()) {\n            return BAD_STYLE;\n        }\n\n        reset();\n\n        ParseError error = PARSE_OK;\n\n        inFile = inFileName;\n        outFile = outFileName;\n        in = (inFileName.empty() ? &cin : new ifstream(inFileName.c_str()));\n\n        if (validateInput) if (!validateInputStream()) error = BAD_INPUT;\n\n        if (!in->fail() && error == PARSE_OK) {\n            out = (outFileName.empty() ? &cout : new ofstream(outFileName.c_str()));\n            if (out->fail()) {\n                error = BAD_OUTPUT;\n            }\n        }\n\n        if (in->fail()) {\n            error = BAD_INPUT;\n        }\n\n        if (error == PARSE_OK) {\n            if (formatter != NULL) {\n                formatter->init(new astyle::ASStreamIterator(in));\n            }\n            if (!fragmentOutput) {\n                *out << getHeader();\n                *out << currentSyntax->getHeaderInjection();\n            }\n\n            printBody();\n\n            if (!fragmentOutput) {\n                *out << currentSyntax->getFooterInjection();\n                *out << getFooter();\n            }\n        }\n\n        if (!outFileName.empty()) {\n            delete out;\n            out = NULL;\n        }\n        if (!inFileName.empty()) {\n            delete in;\n            in = NULL;\n        }\n        return error;\n    }\n\n    vector<Object> CodeGenerator::generateObject(const string &input){\n        if (!docStyle.found()) {\n            return objects;\n        }\n\n        reset();\n\n        in = new istringstream(input);\n        out = new ostringstream();\n\n        if (in->fail() || out->fail()) {\n            return objects;\n        }\n\n        if (formatter != NULL) {\n            formatter->init(new astyle::ASStreamIterator(in));\n        }\n        if (!fragmentOutput) {\n            *out << getHeader();\n            *out << currentSyntax->getHeaderInjection();\n        }\n\n        printBody();\n\n        if (!fragmentOutput) {\n            *out << currentSyntax->getFooterInjection();\n            *out << getFooter();\n        }\n\n\n\n        delete out;\n        out = NULL;\n        delete in;\n        in = NULL;\n\n        return objects;\n    }\n\n    string CodeGenerator::generateString(const string &input) {\n\n        if (!docStyle.found()) {\n            return \"\";\n        }\n\n        reset();\n\n        in = new istringstream(input);\n        out = new ostringstream();\n\n        if (in->fail() || out->fail()) {\n            return \"\";\n        }\n\n        if (formatter != NULL) {\n            formatter->init(new astyle::ASStreamIterator(in));\n        }\n        if (!fragmentOutput) {\n            *out << getHeader();\n            *out << currentSyntax->getHeaderInjection();\n        }\n\n        printBody();\n\n        if (!fragmentOutput) {\n            *out << currentSyntax->getFooterInjection();\n            *out << getFooter();\n        }\n\n        string result = static_cast<ostringstream *> ( out )->str();\n\n        delete out;\n        out = NULL;\n        delete in;\n        in = NULL;\n\n        return result;\n    }\n\n    string CodeGenerator::generateStringFromFile(const string &inFileName) {\n\n        if (!docStyle.found()) {\n            return \"\";\n        }\n\n        reset();\n\n        inFile = inFileName;\n        in = new ifstream(inFileName.c_str());\n        out = new ostringstream();\n\n        if (in->fail() || out->fail()) {\n            return \"\";\n        }\n\n        if (validateInput && !validateInputStream()) {\n            return \"ERROR: detected binary input\";\n        }\n\n        if (formatter != NULL) {\n            formatter->init(new astyle::ASStreamIterator(in));\n        }\n        if (!fragmentOutput) {\n            *out << getHeader();\n            *out << currentSyntax->getHeaderInjection();\n        }\n\n        printBody();\n\n        if (!fragmentOutput) {\n            *out << currentSyntax->getFooterInjection();\n            *out << getFooter();\n        }\n\n        string result = static_cast<ostringstream *> ( out )->str();\n\n        delete out;\n        out = NULL;\n        delete in;\n        in = NULL;\n\n        return result;\n    }\n\n    unsigned int CodeGenerator::getStyleID(State s, unsigned int kwClassID) {\n        if (s == KEYWORD && kwClassID) {\n            return NUMBER_BUILTIN_STATES + kwClassID - 1;\n        }\n        return (unsigned int) s;\n    }\n\n    void CodeGenerator::openTag(State s) {\n        if (outputType == OBJECT) {\n            //LOGI(\"===openTag %s\", openTags[(unsigned int) s].c_str());\n            static_cast<ostringstream *> ( out )->str(\"\");\n        } else {\n            *out << openTags[(unsigned int) s];\n        }\n        currentState = s;\n    }\n\n    void CodeGenerator::closeTag(State s) {\n        if (outputType == OBJECT) {\n            //LOGI(\"===closeTag %s\", closeTags[(unsigned int) s].c_str());\n            Object obj;\n            obj.state=s;\n            string str = static_cast<ostringstream *> ( out )->str();\n            obj.str=str;\n            obj.style=openTags[(unsigned int) s];\n            objects.push_back(obj);\n        } else {\n            *out << closeTags[(unsigned int) s];\n            flushWs();\n        }\n        currentState = _UNKNOWN;\n    }\n\n    void CodeGenerator::openKWTag(unsigned int kwClassID) {\n        if (outputType == OBJECT) {\n            //LOGI(\"===openKWTag %s\", openTags.at(getStyleID(KEYWORD, kwClassID)).c_str());\n            static_cast<ostringstream *> ( out )->str(\"\");\n\n        } else {\n            *out << openTags.at(getStyleID(KEYWORD, kwClassID));\n        }\n\n        currentState = KEYWORD;\n    }\n\n    void CodeGenerator::closeKWTag(unsigned int kwClassID) {\n\n        if (outputType == OBJECT) {\n            //LOGI(\"===closeKWTag %s\", closeTags.at(getStyleID(KEYWORD, kwClassID)).c_str());\n\n            Object obj;\n            obj.state=KEYWORD;\n            string str = static_cast<ostringstream *> ( out )->str();\n            obj.str=str;\n            obj.style=openTags.at(getStyleID(KEYWORD, kwClassID)) ;\n            objects.push_back(obj);\n            (*out).clear();\n        } else {\n            *out << closeTags.at(getStyleID(KEYWORD, kwClassID));\n            flushWs();\n        }\n        currentState = _UNKNOWN;\n    }\n\n    bool CodeGenerator::loadEmbeddedLang(const string &embedLangDefPath) {\n        //save path of host language\n        if (hostLangDefPath.empty()) {\n            hostLangDefPath = currentSyntax->getCurrentPath();\n        }\n        //load syntax of embedded langage\n        LoadResult res = loadLanguage(embedLangDefPath);\n        //pass end delimiter regex to syntax description\n        currentSyntax->restoreLangEndDelim(embedLangDefPath);\n        return res == LOAD_OK;\n    }\n\n///////////////////////////////////////////////////////////////////////////////\n\n    void CodeGenerator::processRootState() {\n        bool eof = false,\n                firstLine = true; // avoid newline before printing the first output line\n\n        if (currentSyntax->highlightingDisabled()) {\n            string line;\n            while (getline(*in, line)) {\n                ++lineNumber;\n                insertLineNumber(!firstLine);\n                flushWs();\n                firstLine = false;\n                maskString(*out, line);\n            }\n            *out << flush;\n            return;\n        }\n\n        if (!embedLangStart.empty()) {\n            if (!loadEmbeddedLang(currentSyntax->getNewPath(embedLangStart))) return;\n        }\n\n        State state = STANDARD;\n\n        openTag(STANDARD);\n        do {\n            // determine next state\n            state = getCurrentState(STANDARD);\n\n            // handle current state\n            switch (state) {\n                case KEYWORD:\n                    closeTag(STANDARD);\n                    eof = processKeywordState(state);\n                    openTag(STANDARD);\n                    break;\n                case NUMBER:\n                    closeTag(STANDARD);\n                    eof = processNumberState();\n                    openTag(STANDARD);\n                    break;\n                case ML_COMMENT:\n                    closeTag(STANDARD);\n                    eof = processMultiLineCommentState();\n                    openTag(STANDARD);\n                    break;\n                case SL_COMMENT:\n                    closeTag(STANDARD);\n                    eof = processSingleLineCommentState();\n                    openTag(STANDARD);\n                    break;\n                case STRING:\n                    closeTag(STANDARD);\n                    eof = processStringState(STANDARD);\n                    openTag(STANDARD);\n                    break;\n                case DIRECTIVE:\n                    closeTag(STANDARD);\n                    eof = processDirectiveState();\n                    openTag(STANDARD);\n                    break;\n                case ESC_CHAR:\n                    closeTag(STANDARD);\n                    eof = processEscapeCharState();\n                    openTag(STANDARD);\n                    break;\n                case SYMBOL:\n                    closeTag(STANDARD);\n                    eof = processSymbolState();\n                    openTag(STANDARD);\n                    break;\n                case EMBEDDED_CODE_BEGIN:\n                case EMBEDDED_CODE_END:\n                    closeTag(STANDARD);\n                    eof = processSyntaxChangeState(state);\n                    openTag(STANDARD);\n                    break;\n                case _EOL:\n                    insertLineNumber(!firstLine);\n                    firstLine = false;\n                    break;\n                case _EOF:\n                    eof = true;\n                    break;\n                case _WS:\n                    processWsState();\n                    break;\n                default:\n                    printMaskedToken();\n                    break;\n            }\n        }\n        while (!eof);\n        closeTag(STANDARD);\n        printNewLines = !noTrailingNewLine;\n        *out << getNewLine();\n        *out << flush;\n    }\n\n    bool CodeGenerator::processSyntaxChangeState(State myState) {\n        State newState = STANDARD;\n        bool eof = false,\n                exitState = false;\n        openTag(KEYWORD);\n        do {\n            if (myState == EMBEDDED_CODE_BEGIN) {\n                if (!loadEmbeddedLang(embedLangDefPath)) {\n                    // exit or segfault\n                    return true;\n                }\n                //test current line again to match tokens of the embedded language\n                matchRegex(line);\n            }\n            else if (myState == EMBEDDED_CODE_END) {\n                // load host language syntax\n                loadLanguage(hostLangDefPath);\n                //test current line again to match tokens of the host language\n                matchRegex(line);\n            }\n\n            printMaskedToken(newState != _WS);\n            newState = getCurrentState(myState);\n            switch (newState) {\n                case _WS:\n                    processWsState();\n                    break;\n                case _EOL:\n                    insertLineNumber();\n                    exitState = true;\n                    break;\n                case _EOF:\n                    eof = true;\n                    break;\n                default:\n                    exitState = true;\n                    break;\n            }\n        }\n        while ((!exitState) && (!eof));\n\n        closeTag(KEYWORD);\n        return eof;\n    }\n\n    bool CodeGenerator::processKeywordState(State myState) {\n        State newState = STANDARD;\n        unsigned int myClassID = currentKeywordClass;\n        bool eof = false,\n                exitState = false;\n\n        openKWTag(myClassID);\n        do {\n            printMaskedToken(newState != _WS,\n                             (currentSyntax->isIgnoreCase()) ? keywordCase\n                                                             : StringTools::CASE_UNCHANGED);\n            newState = getCurrentState(myState);\n            switch (newState) {\n                case _WS:\n                    processWsState();\n                    break;\n                case _EOL:\n                    insertLineNumber();\n                    exitState = true;\n                    break;\n                case _EOF:\n                    eof = true;\n                    break;\n                case KEYWORD_END:\n                    exitState = true;\n                    break;\n                default:\n                    exitState = (myClassID != currentKeywordClass) || (myState != newState);\n                    break;\n            }\n        }\n        while ((!exitState) && (!eof));\n\n        closeKWTag(myClassID);\n\n        currentKeywordClass = 0;\n        return eof;\n    }\n\n    bool CodeGenerator::processNumberState() {\n        State newState = STANDARD;\n        bool eof = false,\n                exitState = false;\n        openTag(NUMBER);\n        do {\n            printMaskedToken(newState != _WS);\n            newState = getCurrentState(NUMBER);\n            switch (newState) {\n                case _WS:\n                    processWsState();\n                    break;\n                case _EOL:\n                    insertLineNumber();\n                    exitState = true;\n                    break;\n                case _EOF:\n                    eof = true;\n                    break;\n                default:\n                    exitState = newState != NUMBER;\n                    break;\n            }\n        }\n        while ((!exitState) && (!eof));\n\n        closeTag(NUMBER);\n        return eof;\n    }\n\n    bool CodeGenerator::processMultiLineCommentState() {\n        int commentCount = 1;\n        int openDelimID = currentSyntax->getOpenDelimiterID(token, ML_COMMENT);\n        State newState = STANDARD;\n        bool eof = false, exitState = false;\n        openTag(ML_COMMENT);\n        do {\n            printMaskedToken(newState != _WS);\n            newState = getCurrentState(ML_COMMENT);\n\n            switch (newState) {\n                case _WS:\n                    processWsState();\n                    break;\n                case _EOL:\n                    wsBuffer += closeTags[ML_COMMENT];\n                    insertLineNumber();\n                    wsBuffer += openTags[ML_COMMENT];\n                    break;\n                case _EOF:\n                    eof = true;\n                    break;\n                case ML_COMMENT:\n\n                    if (currentSyntax->allowNestedMLComments()) {\n                        ++commentCount;\n                    }\n                    // if delimiters are equal, close the comment by continueing to\n                    // ML_COMMENT_END section\n                    if (currentSyntax->delimiterIsDistinct(\n                            currentSyntax->getOpenDelimiterID(token, ML_COMMENT)))\n                        break;\n\n                case ML_COMMENT_END:\n\n                    if (!currentSyntax->matchesOpenDelimiter(token, ML_COMMENT_END, openDelimID)) {\n                        break;\n                    }\n                    commentCount--;\n                    if (!commentCount) {\n                        printMaskedToken();\n                        exitState = true;\n                    }\n                    break;\n                default:\n                    break;\n            }\n        }\n        while ((!exitState) && (!eof));\n\n        closeTag(ML_COMMENT);\n        return eof;\n    }\n\n\n    bool CodeGenerator::processSingleLineCommentState() {\n        if (checkSpecialCmd()) {\n            return in->bad(); // if input stream is bad, report eof to calling method\n        }\n\n        State newState = STANDARD;\n        bool eof = false, exitState = false;\n\n        openTag(SL_COMMENT);\n        do {\n            printMaskedToken(newState != _WS);\n            newState = getCurrentState(SL_COMMENT);\n\n            switch (newState) {\n                case _WS:\n                    processWsState();\n                    break;\n                case _EOL:\n                    printMaskedToken();\n                    if (preFormatter.isEnabled() && preFormatter.isWrappedLine(lineNumber - 1)) {\n                        exitState = false;\n                    }\n                    else {\n                        exitState = true;\n                    }\n                    if (!exitState) wsBuffer += closeTags[SL_COMMENT];\n                    insertLineNumber();\n                    if (!exitState) wsBuffer += openTags[SL_COMMENT];\n\n                    break;\n                case _EOF:\n                    eof = true;\n                    break;\n                default:\n                    break;\n            }\n        }\n        while ((!exitState) && (!eof));\n\n        closeTag(SL_COMMENT);\n        return eof;\n    }\n\n    bool CodeGenerator::processDirectiveState() {\n        State newState = STANDARD;\n        bool eof = false, exitState = false;\n\n        openTag(DIRECTIVE);\n        do {\n            printMaskedToken(newState != _WS);\n            newState = getCurrentState(DIRECTIVE);\n            switch (newState) {\n                case _WS:\n                    processWsState();\n                    break;\n                case DIRECTIVE_END:\n                    printMaskedToken();\n                    exitState = true;\n                    break;\n                case _EOL:\n                    printMaskedToken();\n                    if (preFormatter.isEnabled() && preFormatter.isWrappedLine(lineNumber - 1)) {\n                        exitState = false;\n                    }\n                    else {\n                        exitState = (terminatingChar != currentSyntax->getContinuationChar());\n                    }\n                    if (!exitState) wsBuffer += closeTags[DIRECTIVE];\n                    insertLineNumber();\n                    if (!exitState) wsBuffer += openTags[DIRECTIVE];\n                    break;\n                case ML_COMMENT:\n                    closeTag(DIRECTIVE);\n                    eof = processMultiLineCommentState();\n                    openTag(DIRECTIVE);\n                    break;\n                case SL_COMMENT:\n                    closeTag(DIRECTIVE);\n                    eof = processSingleLineCommentState();\n                    openTag(DIRECTIVE);\n                    exitState = true;\n                    break;\n                case STRING:\n                    closeTag(DIRECTIVE);\n                    eof = processStringState(DIRECTIVE);\n                    openTag(DIRECTIVE);\n                    break;\n                case _EOF:\n                    eof = true;\n                    break;\n                default:\n                    break;\n            }\n        }\n        while ((!exitState) && (!eof));\n\n        closeTag(DIRECTIVE);\n        return eof;\n    }\n\n    bool CodeGenerator::processStringState(State oldState) {\n        State newState = STANDARD;\n        bool eof = false, exitState = false;\n        bool returnedFromOtherState = false;\n\n        State myState = (oldState == DIRECTIVE) ? DIRECTIVE_STRING : STRING;\n\n        int openDelimID = currentSyntax->getOpenDelimiterID(token, myState);\n        string openDelim = token;\n\n\n        //Raw String by definition:\n        bool isRawString = currentSyntax->delimiterIsRawString(openDelimID);\n\n        // Test if character before string open delimiter token equals to the\n        // raw string prefix (Example: r\" \", r\"\"\" \"\"\" in Python)\n\n        //Raw String Prefix:\n        if (lineIndex > token.length() &&\n            line[lineIndex - token.length() - 1] == currentSyntax->getRawStringPrefix()) {\n            isRawString = true;\n        }\n\n        openTag(myState);\n        do {\n            // true if last token was an escape char\n            if (!returnedFromOtherState) {\n                printMaskedToken(newState != _WS);\n            }\n            returnedFromOtherState = false;\n            newState = getCurrentState(myState);\n\n            switch (newState) {\n                case _WS:\n                    processWsState();\n                    break;\n                case _EOL:\n                    wsBuffer += closeTags[myState];\n                    insertLineNumber();\n                    wsBuffer += openTags[myState];\n                    break;\n                case STRING_END:\n                    if (resultOfHook ||\n                        currentSyntax->matchesOpenDelimiter(token, STRING_END, openDelimID)) {\n                        exitState = true;\n                        printMaskedToken();\n                    }\n                    break;\n                case STRING:\n                    // if there exist multiple string delimiters, close string if\n                    // current delimiters is equal to the opening delimiter\n                    exitState = currentSyntax->delimiterIsDistinct(\n                            currentSyntax->getOpenDelimiterID(token, STRING)) && token == openDelim;\n                    printMaskedToken();\n                    break;\n                case ESC_CHAR:\n                    if (!isRawString) {\n                        closeTag(myState);\n                        eof = processEscapeCharState();\n                        openTag(myState);\n                        returnedFromOtherState = true;\n                    } else {\n                        // FIXME not a fix for Python r\"\"\"\\\"\"\"\n                        //exitState=(openDelim==\"\\\"\" && token==\"\\\\\\\"\"); // C# raw string that ends with '\\'\n                        exitState = token.size() > 1 && token[1] == openDelim[0];\n                        printMaskedToken();\n                    }\n                    break;\n                case STRING_INTERPOLATION:\n                    closeTag(myState);\n                    eof = processInterpolationState();\n                    openTag(myState);\n                    returnedFromOtherState = true;\n                    break;\n                case _EOF:\n                    eof = true;\n                    break;\n                default:\n                    printMaskedToken();\n                    break;\n            }\n        }\n        while ((!exitState) && (!eof));\n\n        closeTag(myState);\n        return eof;\n    }\n\n    bool CodeGenerator::processSymbolState() {\n\n        State newState = STANDARD;\n        bool eof = false,\n                exitState = false;\n\n        openTag(SYMBOL);\n        do {\n            printMaskedToken(newState != _WS);\n            newState = getCurrentState(SYMBOL);\n            switch (newState) {\n                case _WS:\n                    processWsState();\n                    break;\n                case _EOL:\n                    insertLineNumber();\n                    exitState = true;\n                    break;\n                case _EOF:\n                    eof = true;\n                    break;\n                default:\n                    exitState = newState != SYMBOL;\n                    break;\n            }\n        }\n        while ((!exitState) && (!eof));\n\n        closeTag(SYMBOL);\n        return eof;\n    }\n\n    bool CodeGenerator::processEscapeCharState() {\n        State newState = STANDARD;\n        bool eof = false, exitState = false;\n        openTag(ESC_CHAR);\n        do {\n            printMaskedToken(newState != _WS);\n            newState = getCurrentState(ESC_CHAR);\n            switch (newState) {\n                case _EOL:\n                    insertLineNumber();\n                    exitState = true;\n                    break;\n                case _WS:\n                    processWsState();\n                    break;\n                case _EOF:\n                    eof = true;\n                    break;\n                default:\n                    exitState = newState != ESC_CHAR;\n                    break;\n            }\n        }\n        while ((!exitState) && (!eof));\n\n        closeTag(ESC_CHAR);\n        return eof;\n    }\n\n    bool CodeGenerator::processInterpolationState() {\n        State newState = STANDARD;\n        bool eof = false, exitState = false;\n        openTag(STRING_INTERPOLATION);\n        do {\n            printMaskedToken(newState != _WS);\n            newState = getCurrentState(STRING_INTERPOLATION);\n            switch (newState) {\n                case _EOL:\n                    insertLineNumber();\n                    exitState = true;\n                    break;\n                case _WS:\n                    processWsState();\n                    break;\n                case _EOF:\n                    eof = true;\n                    break;\n                default:\n                    exitState = newState != STRING_INTERPOLATION;\n                    break;\n            }\n        }\n        while ((!exitState) && (!eof));\n\n        closeTag(STRING_INTERPOLATION);\n        return eof;\n    }\n\n    void CodeGenerator::processWsState() {\n        if (!maskWs) {\n            wsBuffer += token;\n            token.clear();\n            return;\n        }\n        flushWs();\n        int cntWs = 0;\n        lineIndex--;\n\n        // while (iswspace(line[lineIndex])  ) {\n        while (line[lineIndex] == ' ' || line[lineIndex] == '\\t') {\n            ++cntWs;\n            ++lineIndex;\n        }\n\n        if (cntWs > 1) {\n            unsigned int styleID = getStyleID(currentState, currentKeywordClass);\n            if (excludeWs && styleID != _UNKNOWN) {\n                *out << closeTags[styleID];\n            }\n            *out << maskWsBegin;\n            for (int i = 0; i < cntWs; i++) {\n                *out << spacer;\n            }\n            *out << maskWsEnd;\n            if (excludeWs && styleID != _UNKNOWN) {\n                *out << openTags[styleID];\n            }\n        }\n        else {\n            *out << spacer; //Bugfix fehlender Space nach Strings\n        }\n        token.clear();\n    }\n\n    void CodeGenerator::flushWs() {\n        *out << wsBuffer;\n        wsBuffer.clear();\n    }\n\n    string CodeGenerator::getNewLine() {\n        return (printNewLines) ? newLineTag : \"\";\n    }\n\n    void CodeGenerator::insertLineNumber(bool insertNewLine) {\n        if (insertNewLine) {\n            wsBuffer += getNewLine();\n        }\n\n        if (showLineNumbers) {\n            ostringstream os;\n            ostringstream numberPrefix;\n\n            os << setw(getLineNumberWidth()) << right;\n            if (numberCurrentLine) {\n                if (lineNumberFillZeroes) {\n                    os.fill('0');\n                }\n                os << lineNumber + lineNumberOffset;\n            } else {\n                os << \"\";\n            }\n\n            numberPrefix << openTags[LINENUMBER];\n            maskString(numberPrefix, os.str());\n            numberPrefix << spacer << closeTags[LINENUMBER];\n\n            wsBuffer += numberPrefix.str();\n        }\n    }\n\n    unsigned int CodeGenerator::getLineIndex() {\n        return lineIndex;\n    }\n\n    bool CodeGenerator::printExternalStyle(const string &outFile) {\n        if (!includeStyleDef) {\n            ostream *cssOutFile = (outFile.empty() ? &cout : new ofstream(outFile.c_str()));\n            if (!cssOutFile->fail()) {\n                *cssOutFile << styleCommentOpen\n                << \" Style definition file generated by highlight \"\n                << HIGHLIGHT_VERSION << \", \" << HIGHLIGHT_URL\n                << \" \" << styleCommentClose << \"\\n\";\n\n                *cssOutFile << \"\\n\" << styleCommentOpen\n                << \" Highlighting theme: \"\n                << docStyle.getDescription() << \" \"\n                << styleCommentClose << \"\\n\\n\"\n                << getStyleDefinition()\n                << \"\\n\";\n                *cssOutFile << readUserStyleDef();\n                if (!outFile.empty()) delete cssOutFile;\n            }\n            else {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    string CodeGenerator::readUserStyleDef() {\n        ostringstream ostr;\n        if (!styleInputPath.empty()) {\n            ifstream userStyleDef(styleInputPath.c_str());\n            if (userStyleDef) {\n                ostr << \"\\n\" << styleCommentOpen\n                << \" Content of \" << styleInputPath\n                << \": \" << styleCommentClose << \"\\n\";\n                string line;\n                while (getline(userStyleDef, line)) {\n                    ostr << line << \"\\n\";\n                }\n                userStyleDef.close();\n            }\n            else {\n                ostr << styleCommentOpen\n                << \" ERROR: Could not include \" << styleInputPath\n                << \".\" << styleCommentClose << \"\\n\";\n            }\n        }\n\n        string injections = docStyle.getInjections();\n        if (!injections.empty()) {\n            ostr << \"\\n\" << styleCommentOpen\n            << \" Plug-in theme injections: \" << styleCommentClose << \"\\n\";\n            ostr << injections << \"\\n\";\n        }\n        return ostr.str();\n    }\n\n    bool CodeGenerator::initPluginScript(const string &script) {\n\n        if (script.empty()) return true;\n\n        try {\n            userScriptError = \"\";\n\n            Diluculum::LuaState ls;\n\n\n#ifdef NACL_BUILD\n            ls.doString(script);\n#else\n            ls.doFile(script);\n#endif\n\n            int listIdx = 1;\n\n            while (ls[\"Plugins\"][listIdx].value() != Diluculum::Nil) {\n\n                // Theme plugins\n                if (ls[\"Plugins\"][listIdx][\"Type\"].value().asString() == \"theme\") {\n                    if (ls[\"Plugins\"][listIdx][\"Chunk\"].value().type() == LUA_TFUNCTION) {\n                        docStyle.addUserChunk(ls[\"Plugins\"][listIdx][\"Chunk\"].value().asFunction());\n                    }\n                }\n                    // Syntax plugins\n                else if (ls[\"Plugins\"][listIdx][\"Type\"].value().asString() == \"lang\") {\n                    if (ls[\"Plugins\"][listIdx][\"Chunk\"].value().type() == LUA_TFUNCTION) {\n                        currentSyntax->addUserChunk(\n                                ls[\"Plugins\"][listIdx][\"Chunk\"].value().asFunction());\n                    }\n                }\n\n                listIdx++;\n            }\n        } catch (Diluculum::LuaError err) {\n            userScriptError = err.what();\n            return false;\n        }\n        return true;\n    }\n\n    bool CodeGenerator::checkSpecialCmd() {\n\n        string noParseCmd = \"@highlight\";\n\n        size_t cmdPos = line.find(noParseCmd);\n\n        if (cmdPos != string::npos) {\n            *out << line.substr(noParseCmd.size() + cmdPos + 1);\n\n            // hide comment line from output\n            token.clear();\n            lineIndex = line.length();\n            getInputChar();\n            lineNumber--;\n            // end hide\n\n            return true; // do not parse line as comment\n        }\n\n        return false; //parse comment as usual\n    }\n\n}\n"
  },
  {
    "path": "jni/highlight/core/datadir.cpp",
    "content": "/***************************************************************************\n                          dataDir.cpp  -  description\n                             -------------------\n    begin                : Sam March 1 2003\n    copyright            : (C) 2003-2013 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include <string>\n#include <fstream>\n#include <vector>\n#include \"platform_fs.h\"\n\n#include \"datadir.h\"\n\nusing namespace std;\n\nstring DataDir::LSB_DATA_DIR=\"/usr/share/highlight/\";\nstring DataDir::LSB_CFG_DIR=\"/etc/highlight/\";\nstring DataDir::LSB_DOC_DIR=\"/usr/share/doc/highlight/\";\n\n\nvoid DataDir::initSearchDirectories ( const string &userDefinedDir )\n{\n\n#ifndef WIN32\n\n  possibleDirs.push_back ( Platform::getHomePath() + \"/.highlight/\" );\n  if ( !userDefinedDir.empty() ) possibleDirs.push_back ( userDefinedDir );\n\n  #ifdef HL_DATA_DIR\n\t  possibleDirs.push_back ( HL_DATA_DIR );\n  #else\n\t  possibleDirs.push_back ( LSB_DATA_DIR );\n  #endif\n\t  \n  #ifdef HL_CONFIG_DIR\n\t  possibleDirs.push_back ( HL_CONFIG_DIR);\n  #else\n\t  possibleDirs.push_back ( LSB_CFG_DIR);\n  #endif\n\t\n#else\n    possibleDirs.push_back(Platform::getAppPath()); //not needed because of fallback in searchFile\n#endif\n}\n\nvoid DataDir:: searchDataDir( const string &userDefinedDir ){\n    initSearchDirectories(userDefinedDir);\n}\n\nconst string DataDir::searchFile(const string path){\n\tfor ( unsigned int i=0;i<possibleDirs.size();i++ )\n\t{\n\t // cerr << \"searching \"<<possibleDirs[i]<< path<<\"\\n\";\n\t\tLOGI(\"searching:%s\",(possibleDirs[i] + path ).c_str() );\n\t\tif ( Platform::fileExists ( possibleDirs[i] + path ) ){\n\t\t\tLOGI(\"searching true ret\");\n\t\t\treturn possibleDirs[i]+ path;\n\t\t}\n\t\t\n\t}\n\treturn path;\n}\n\nconst void DataDir::printConfigPaths(){\n\tfor ( unsigned int i=0;i<possibleDirs.size();i++ )\n\t{\n\t\tif ( Platform::fileExists ( possibleDirs[i] ) )\n\t\t\tcout <<possibleDirs[i]<<\"\\n\";\n\t\t\n\t}\n}\n\nconst string DataDir::getLangPath ( const string & file )\n{\n\treturn searchFile(string(\"langDefs\")+Platform::pathSeparator+file);\n}\n\nconst string DataDir::getThemePath ( const string & file)\n{\n\treturn searchFile(string(\"themes\")+Platform::pathSeparator+file);\n}\n\nconst string DataDir::getPluginPath ( const string & file)\n{\n\treturn searchFile(string(\"plugins\")+Platform::pathSeparator+file);\n}\n\nconst string DataDir::getFiletypesConfPath (const string & file)\n{\n\treturn searchFile(file + \".conf\");\n}\n\nconst string DataDir::getThemePath ( ) {\n  return getSystemDataPath()+\"themes\"+Platform::pathSeparator;\n}\n\nconst string DataDir::getLangPath ( ) {\n  return getSystemDataPath()+\"langDefs\"+Platform::pathSeparator;\n}\n\nconst string DataDir::getPluginPath ( ) {\n  return getSystemDataPath()+\"plugins\"+Platform::pathSeparator;\n}\n\nconst string DataDir::getSystemDataPath ( ) {\n #ifndef WIN32\n  #ifdef HL_DATA_DIR\n\treturn HL_DATA_DIR;\n  #else\n\treturn LSB_DATA_DIR;\n  #endif\t\n#else\n    return Platform::getAppPath();\n#endif \n}\n\nconst string  DataDir::getI18nDir()\n{\n\treturn getSystemDataPath()+\"gui_files\"+Platform::pathSeparator+\"i18n\"+Platform::pathSeparator;\n}\n\nconst string  DataDir::getExtDir()\n{\n\treturn getSystemDataPath() +\"gui_files\"+Platform::pathSeparator+\"ext\"+Platform::pathSeparator;\n}\n\nconst string DataDir::getDocDir()\n{\n  return getSystemDataPath() ;\n}\n"
  },
  {
    "path": "jni/highlight/core/elementstyle.cpp",
    "content": "/***************************************************************************\n                          elementstyle.cpp  -  description\n                             -------------------\n    begin                : Son Nov 10 2002\n    copyright            : (C) 2002-2007 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n#include <sstream>\n#include \"elementstyle.h\"\n\nnamespace highlight\n{\n\n\tElementStyle::ElementStyle (const Colour &col, bool b, bool i, bool u )\n\t\t\t: colour ( col ) , bold ( b ), italic ( i ), underline ( u )\n\t{}\n\n\tElementStyle:: ElementStyle ( const string & elementStyleString )\n\t\t\t: bold ( false ), italic ( false ), underline ( false )\n\t{\n\t\tset ( elementStyleString );\n\t}\n\n\tElementStyle::ElementStyle()\n\t\t\t: bold ( false ), italic ( false ), underline ( false )\n\t{}\n\n\tvoid ElementStyle::set ( const string & elementStyleString )\n\t{\n\t\tistringstream valueStream ( elementStyleString );\n\t\tstring r, g, b, attr;\n\n\t\tchar c='\\0';\n\t\tvalueStream >> c;\n\n\t\tif ( c=='#' )\n\t\t{\n\t\t\tstring htmlNotation;\n\t\t\tvalueStream >> htmlNotation;\n\t\t\tif ( htmlNotation.size() < 6 ) return;\n\t\t\tr = htmlNotation.substr ( 0, 2 );\n\t\t\tg = htmlNotation.substr ( 2, 2 );\n\t\t\tb = htmlNotation.substr ( 4, 2 );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvalueStream.putback ( c );\n\t\t\tvalueStream >> r;\n\t\t\tvalueStream >> g;\n\t\t\tvalueStream >> b;\n\t\t}\n\n\t\tcolour.setRed ( r );\n\t\tcolour.setGreen ( g );\n\t\tcolour.setBlue ( b );\n\t\twhile ( valueStream >> attr )\n\t\t{\n\t\t\tif ( attr==\"italic\" )\n\t\t\t{\n\t\t\t\titalic = true;\n\t\t\t}\n\t\t\telse if ( attr==\"bold\" )\n\t\t\t{\n\t\t\t\tbold = true;\n\t\t\t}\n\t\t\telse if ( attr==\"underline\" )\n\t\t\t{\n\t\t\t\tunderline = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tElementStyle::~ElementStyle()\n\t{}\n\n\tbool ElementStyle::isItalic() const\n\t{\n\t\treturn italic;\n\t}\n\tbool ElementStyle::isBold() const\n\t{\n\t\treturn bold;\n\t}\n\tbool ElementStyle::isUnderline() const\n\t{\n\t\treturn underline;\n\t}\n\tColour ElementStyle::getColour() const\n\t{\n\t\treturn colour;\n\t}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/htmlgenerator.cpp",
    "content": "/***************************************************************************\n                     htmlgenerator.cpp  -  description\n                             -------------------\n    begin                : Wed Nov 28 2001\n    copyright            : (C) 2001-2012 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n#include <fstream>\n#include <iostream>\n#include <sstream>\n#include <algorithm>\n\n#include \"htmlgenerator.h\"\n#include \"version.h\"\n\nusing namespace std;\n\nnamespace highlight\n{\n\nHtmlGenerator::HtmlGenerator () :\n    CodeGenerator ( HTML ),\n    brTag ( \"<br>\" ),\n    hrTag ( \"<hr>\" ),\n    idAttr ( \"name\" ),\n    fileSuffix ( \".html\" ),\n    cssClassName ( \"hl\" ),\n    orderedList ( false ),\n    useInlineCSS ( false ),\n    enclosePreTag ( false ),\n    attachAnchors ( false ),\n    anchorPrefix ( \"l\" )\n{\n    spacer = \" \";\n    styleCommentOpen=\"/*\";\n    styleCommentClose=\"*/\";\n}\n\n\nstring HtmlGenerator::getHeaderStart ( const string &title )\n{\n    ostringstream header;\n    header<<  \"<!DOCTYPE html>\\n<html>\\n<head>\\n\";\n    if ( encodingDefined() )\n    {\n        header << \"<meta charset=\\\"\"\n               << encoding\n               << \"\\\">\\n\";\n    }\n    header << \"<title>\" << title << \"</title>\\n\";\n    return header.str();\n}\n\nstring HtmlGenerator::getHeader()\n{\n    ostringstream os;\n    os << getHeaderStart ( docTitle );\n    if ( !useInlineCSS )\n    {\n        if ( includeStyleDef )\n        {\n            os << \"<style type=\\\"text/css\\\">\\n\";\n            os << getStyleDefinition();\n            os << CodeGenerator::readUserStyleDef();\n            os << \"</style>\\n\";\n        }\n        else\n        {\n            os << \"<link rel=\\\"stylesheet\\\" type=\\\"text/css\\\" href=\\\"\"\n               << getStyleOutputPath()\n               << \"\\\">\\n\";\n        }\n        os << \"</head>\\n<body\";\n        if (!cssClassName.empty())\n            os << \" class=\\\"\"<<cssClassName<<\"\\\"\";\n        os << \">\\n\";\n    }\n    else\n    {\n        os << \"</head>\\n<body style=\\\"\"\n           << \"background-color:#\"\n           << ( docStyle.getBgColour().getRed ( HTML ) )\n           << ( docStyle.getBgColour().getGreen ( HTML ) )\n           << ( docStyle.getBgColour().getBlue ( HTML ) )\n           << \"\\\">\\n\";\n    }\n\n    return os.str();\n}\n\nstring HtmlGenerator::getFooter()\n{\n    return getGeneratorComment();\n}\n\nvoid HtmlGenerator::printBody()\n{\n    if ( (!(showLineNumbers && orderedList) && !fragmentOutput) || enclosePreTag )\n    {\n        if ( !useInlineCSS )\n        {\n            *out << \"<pre\";\n            if (!cssClassName.empty())\n                *out<<\" class=\\\"\" << cssClassName << \"\\\"\";\n            *out<< \">\";\n        }\n        else\n        {\n            bool quoteFont=getBaseFont().find_first_of(\",'\")==string::npos;\n            *out << \"<pre style=\\\"\"\n                 << \"color:#\"\n                 << ( docStyle.getDefaultStyle().getColour().getRed ( HTML ) )\n                 << ( docStyle.getDefaultStyle().getColour().getGreen ( HTML ) )\n                 << ( docStyle.getDefaultStyle().getColour().getBlue ( HTML ) )\n                 << \"; background-color:#\"\n                 << ( docStyle.getBgColour().getRed ( HTML ) )\n                 << ( docStyle.getBgColour().getGreen ( HTML ) )\n                 << ( docStyle.getBgColour().getBlue ( HTML ) )\n                 << \"; font-size:\" << this->getBaseFontSize()\n                 << \"pt; font-family:\"\n                 <<((quoteFont)?\"'\":\"\")\n                 << this->getBaseFont()\n                 <<((quoteFont)?\"'\":\"\")\n                 <<\";\\\">\";\n        }\n    }\n    if ( showLineNumbers && orderedList ) *out << \"<ol>\\n\";\n\n    processRootState();\n\n    if ( showLineNumbers && orderedList ) *out << \"</ol>\";\n\n    if ( (!(showLineNumbers && orderedList) && !fragmentOutput)  || enclosePreTag )  *out << \"</pre>\";\n}\n\n\nvoid HtmlGenerator::initOutputTags ()\n{\n    openTags.push_back ( \"\" );\n    if ( useInlineCSS )\n    {\n        openTags.push_back ( getOpenTag ( docStyle.getStringStyle() ) );\n        openTags.push_back ( getOpenTag ( docStyle.getNumberStyle() ) );\n        openTags.push_back ( getOpenTag ( docStyle.getSingleLineCommentStyle() ) );\n        openTags.push_back ( getOpenTag ( docStyle.getCommentStyle() ) );\n        openTags.push_back ( getOpenTag ( docStyle.getEscapeCharStyle() ) );\n        openTags.push_back ( getOpenTag ( docStyle.getPreProcessorStyle() ) );\n        openTags.push_back ( getOpenTag ( docStyle.getPreProcStringStyle() ) );\n        openTags.push_back ( getOpenTag ( docStyle.getLineStyle() ) );\n        openTags.push_back ( getOpenTag ( docStyle.getOperatorStyle() ) );\n        openTags.push_back ( getOpenTag ( docStyle.getInterpolationStyle() ) );\n    }\n    else\n    {\n        openTags.push_back ( getOpenTag ( STY_NAME_STR ) );\n        openTags.push_back ( getOpenTag ( STY_NAME_NUM ) );\n        openTags.push_back ( getOpenTag ( STY_NAME_SLC ) );\n        openTags.push_back ( getOpenTag ( STY_NAME_COM ) );\n        openTags.push_back ( getOpenTag ( STY_NAME_ESC ) );\n        openTags.push_back ( getOpenTag ( STY_NAME_DIR ) );\n        openTags.push_back ( getOpenTag ( STY_NAME_DST ) );\n        openTags.push_back ( getOpenTag ( STY_NAME_LIN ) );\n        openTags.push_back ( getOpenTag ( STY_NAME_SYM ) );\n        openTags.push_back ( getOpenTag ( STY_NAME_IPL ) );\n    }\n\n    closeTags.push_back ( \"\" );\n    for (unsigned int i=1; i<NUMBER_BUILTIN_STATES; i++ )\n    {\n        closeTags.push_back ( \"</span>\" );\n    }\n\n}\n\nstring  HtmlGenerator::getAttributes ( const string & elemName, const ElementStyle & elem )\n{\n    ostringstream s;\n    if ( !elemName.empty() )\n    {\n        if (!cssClassName.empty())\n            s << \".\"<<cssClassName;\n        s <<\".\"<<elemName<<\" { \";\n    }\n    s << \"color:#\"\n      << ( elem.getColour().getRed ( HTML ) )\n      << ( elem.getColour().getGreen ( HTML ) )\n      << ( elem.getColour().getBlue ( HTML ) )\n      << ( elem.isBold() ?     \"; font-weight:bold\" :\"\" )\n      << ( elem.isItalic() ?   \"; font-style:italic\" :\"\" )\n      << ( elem.isUnderline() ? \"; text-decoration:underline\" :\"\" );\n    if ( !elemName.empty() )\n    {\n        s << \"; }\\n\" ;\n    }\n    return s.str();\n}\n\nstring  HtmlGenerator::getOpenTag ( const string& styleName )\n{\n    return \"<span class=\\\"\" + (cssClassName.empty() ? \"\":cssClassName+ \" \")  + styleName + \"\\\">\";\n}\n\nstring  HtmlGenerator::getOpenTag ( const ElementStyle & elem )\n{\n    return \"<span style=\\\"\"+getAttributes ( \"\",elem ) + \"\\\">\";\n}\n\nstring HtmlGenerator::getGeneratorComment()\n{\n    ostringstream s;\n    s <<\"\\n</body>\\n</html>\\n<!--HTML generated by highlight \"\n      << HIGHLIGHT_VERSION << \", \" <<  HIGHLIGHT_URL <<\"-->\\n\";\n\n    return s.str();\n}\n\nstring HtmlGenerator::getStyleDefinition()\n{\n    if ( styleDefinitionCache.empty() )\n    {\n        bool quoteFont=getBaseFont().find_first_of(\",'\")==string::npos;\n        ostringstream os;\n        os  << \"body\";\n        if (!cssClassName.empty())\n            os<<\".\"<<cssClassName;\n        os  <<\"\\t{ background-color:#\"\n            << ( docStyle.getBgColour().getRed ( HTML ) )\n            << ( docStyle.getBgColour().getGreen ( HTML ) )\n            << ( docStyle.getBgColour().getBlue ( HTML ) )\n            << \"; }\\n\";\n        os << (orderedList ? \"li\" : \"pre\");\n        if (!cssClassName.empty())\n            os<<\".\"<<cssClassName;\n        os << \"\\t{ color:#\"\n           << ( docStyle.getDefaultStyle().getColour().getRed ( HTML ) )\n           << ( docStyle.getDefaultStyle().getColour().getGreen ( HTML ) )\n           << ( docStyle.getDefaultStyle().getColour().getBlue ( HTML ) )\n           << \"; background-color:#\"\n           << ( docStyle.getBgColour().getRed ( HTML ) )\n           << ( docStyle.getBgColour().getGreen ( HTML ) )\n           << ( docStyle.getBgColour().getBlue ( HTML ) )\n           << \"; font-size:\" << this->getBaseFontSize();\n\n        os << \"pt; font-family:\"<<((quoteFont)?\"'\":\"\") << getBaseFont() << ((quoteFont)?\"'\":\"\")\n           << \";}\\n\";\n\n        os  << getAttributes ( STY_NAME_NUM, docStyle.getNumberStyle() )\n            << getAttributes ( STY_NAME_ESC, docStyle.getEscapeCharStyle() )\n            << getAttributes ( STY_NAME_STR, docStyle.getStringStyle() )\n            << getAttributes ( STY_NAME_DST, docStyle.getPreProcStringStyle() )\n            << getAttributes ( STY_NAME_SLC, docStyle.getSingleLineCommentStyle() )\n            << getAttributes ( STY_NAME_COM, docStyle.getCommentStyle() )\n            << getAttributes ( STY_NAME_DIR, docStyle.getPreProcessorStyle() )\n            << getAttributes ( STY_NAME_SYM, docStyle.getOperatorStyle() )\n            << getAttributes ( STY_NAME_IPL, docStyle.getInterpolationStyle() )\n            << getAttributes ( STY_NAME_LIN, docStyle.getLineStyle() );\n\n        KeywordStyles styles = docStyle.getKeywordStyles();\n        for ( KSIterator it=styles.begin(); it!=styles.end(); it++ )\n        {\n            os << getAttributes ( it->first, it->second );\n        }\n        styleDefinitionCache=os.str();\n    }\n    return styleDefinitionCache;\n}\n\nstring HtmlGenerator::maskCharacter ( unsigned char c )\n{\n    switch ( c )\n    {\n    case '<' :\n        return \"&lt;\";\n        break;\n    case '>' :\n        return \"&gt;\";\n        break;\n    case '&' :\n        return \"&amp;\";\n        break;\n    case '\\\"' :\n        return \"&quot;\";\n        break;\n\n    case '@' :\n        return \"&#64;\";\n        break;\n\n    default :\n        return string ( 1, c );\n    }\n}\n\nstring HtmlGenerator::getNewLine()\n{\n    string nlStr;\n    if ( showLineNumbers && orderedList ) nlStr +=\"</li>\";\n    if (printNewLines) nlStr+=\"\\n\";\n    return nlStr;\n}\n\nvoid HtmlGenerator::insertLineNumber ( bool insertNewLine )\n{\n    if ( insertNewLine )\n    {\n        wsBuffer += getNewLine();\n    }\n    if ( showLineNumbers )\n    {\n        ostringstream numberPrefix;\n        int lineNo = lineNumber+lineNumberOffset;\n        if ( orderedList )\n        {\n            if ( useInlineCSS )\n            {\n                bool quoteFont=getBaseFont().find_first_of(\",'\")==string::npos;\n                numberPrefix<< \"<li style=\\\"\"\n                            << getAttributes ( \"\", docStyle.getLineStyle() )\n                            << \"; font-size:\" << this->getBaseFontSize()\n                            << \"pt; font-family:\"<<((quoteFont)?\"'\":\"\")\n                            << getBaseFont() << ((quoteFont)?\"'\":\"\")\n                            << \";\\\">\";\n            }\n            else\n            {\n                if (!cssClassName.empty())\n                    numberPrefix<<\"<li class=\\\"\"<<cssClassName<<\"\\\">\";\n                else\n                    numberPrefix<<\"<li>\";\n            }\n            // Opera 8 ignores empty list items -> add &nbsp;\n            //if ( line.empty() ) numberPrefix<<\"&nbsp;\";\n        }\n\n        //attach Anchor only if we're in a new line.\n        if ( attachAnchors && numberCurrentLine )\n        {\n            numberPrefix << \"<a \"\n                         << idAttr\n                         << \"=\\\"\"\n                         << anchorPrefix\n                         << \"_\"\n                         << lineNo\n                         << \"\\\"></a>\";\n        }\n\n        if ( !orderedList )\n        {\n            //if we're in a wrapped line, don't fill with zeroes.\n            ostringstream os;\n            if ( lineNumberFillZeroes && numberCurrentLine )\n            {\n                os.fill ( '0' );\n            }\n\n            os << setw ( getLineNumberWidth() ) << right;\n            //if we're in a wrapped line, don't attach lineNo.\n            if ( numberCurrentLine )\n            {\n                os << lineNo;\n            } else {\n                os << \"\";\n            }\n\n            numberPrefix << openTags[LINENUMBER]\n                         << os.str()\n                         << spacer\n                         << closeTags[LINENUMBER];\n        }\n        wsBuffer += numberPrefix.str();\n    }\n\n}\n\n\nbool HtmlGenerator::printIndexFile ( const vector<string> &fileList,\n                                     const string &outPath )\n{\n    string suffix = fileSuffix;\n    string outFilePath = outPath + \"index\" + suffix;\n    ofstream indexfile ( outFilePath.c_str() );\n\n    if ( !indexfile.fail() )\n    {\n        string inFileName;\n        string inFilePath, newInFilePath;\n        std::set<string> usedFileNames;\n        indexfile << getHeaderStart ( \"Source Index\" );\n        indexfile << \"</head>\\n<body>\\n<h1> Source Index</h1>\\n\"\n                  << hrTag\n                  <<  \"\\n<ul>\\n\";\n        string::size_type pos;\n        for ( unsigned int i=0; i < fileList.size();  i++ )\n        {\n            pos= ( fileList[i] ).find_last_of ( Platform::pathSeparator );\n            if ( pos!=string::npos )\n            {\n                newInFilePath = ( fileList[i] ).substr ( 0, pos+1 );\n            }\n            else\n            {\n                newInFilePath=Platform::pathSeparator;\n            }\n            if ( newInFilePath!=inFilePath )\n            {\n                indexfile << \"</ul>\\n<h2>\";\n                indexfile << newInFilePath;\n                indexfile << \"</h2>\\n<ul>\\n\";\n                inFilePath=newInFilePath;\n            }\n            inFileName = ( fileList[i] ).substr ( pos+1 );\n\n            if (usedFileNames.count(inFileName)) {\n                string prefix=fileList[i].substr (0, pos+1 );\n                replace (prefix.begin(), prefix.end(), Platform::pathSeparator, '_');\n                inFileName.insert(0, prefix);\n            } else {\n                usedFileNames.insert(inFileName);\n            }\n\n            indexfile << \"<li><a href=\\\"\" << inFileName << suffix << \"\\\">\";\n            indexfile << inFileName << suffix <<\"</a></li>\\n\";\n        }\n\n        indexfile << \"</ul>\\n\"\n                  << hrTag << brTag\n                  << \"<small>Generated by highlight \"\n                  << HIGHLIGHT_VERSION\n                  << \", <a href=\\\"\" << HIGHLIGHT_URL << \"\\\" target=\\\"new\\\">\"\n                  << HIGHLIGHT_URL << \"</a></small>\";\n        indexfile << getGeneratorComment();\n    }\n    else\n    {\n        return false;\n    }\n    return true;\n}\n\nstring HtmlGenerator::getKeywordOpenTag ( unsigned int styleID )\n{\n    if ( useInlineCSS )\n    {\n        return getOpenTag ( docStyle.getKeywordStyle ( currentSyntax->getKeywordClasses() [styleID] ) );\n    }\n    return getOpenTag ( currentSyntax->getKeywordClasses() [styleID] );\n}\n\nstring HtmlGenerator::getKeywordCloseTag ( unsigned int styleID )\n{\n    return \"</span>\";\n}\n\nvoid HtmlGenerator::setHTMLOrderedList ( bool b ) {\n    orderedList = b;\n    spacer = b ? \"&nbsp;\": \" \";\n    maskWs = b;\n\n    if (b && !preFormatter.getReplaceTabs()) {\n        preFormatter.setReplaceTabs ( true );\n        preFormatter.setNumberSpaces ( 4 );\n    }\n}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/latexgenerator.cpp",
    "content": "/***************************************************************************\n                          LatexCode.cpp  -  description\n                             -------------------\n    begin                : Mit Jul 24 2002\n    copyright            : (C) 2002 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include \"latexgenerator.h\"\n\nnamespace highlight\n{\n\n\tLatexGenerator::LatexGenerator()\n\t\t\t: CodeGenerator ( LATEX ),\n\t\t\treplaceQuotes ( false ),\n\t\t\tdisableBabelShortHand ( false ),\n\t\t\tprettySymbols ( false )\n\t{\n\t\t// avoid \"Underfull \\hbox (badness 10000)\" warnings\n\t\tnewLineTag = \"\\\\\\\\\\n\";\n\t\tlongLineTag = \"\\\\hspace*{\\\\fill}\" + newLineTag;\n\t\tspacer = \"\\\\ \";\n\t\tmaskWs=true;\n\t\tmaskWsBegin = \"\\\\hlstd{\";\n\t\tmaskWsEnd = \"}\";\n\t\texcludeWs=true;\n\t\tstyleCommentOpen=\"%\";\n\t}\n\n\tLatexGenerator::~LatexGenerator()\n\t{}\n\n\tvoid LatexGenerator::printBody()\n\t{\n\t\t*out << \"\\\\noindent\\n\" ;\n\t\tif ( ! this->getBaseFont().empty() )\n\t\t\t*out << \"\\\\\" << this->getBaseFont() << \"\\n\" ;\n\t\telse\n\t\t\t*out << \"\\\\ttfamily\\n\";\n\t\tif ( ! this->getBaseFontSize().empty() && this->getBaseFontSize()!=\"10\")\n\t\t\t*out << \"\\\\\" << this->getBaseFontSize() << \"\\n\" ;\n\t\tif ( disableBabelShortHand )\n\t\t\t*out << \"\\\\shorthandoff{\\\"}\\n\";\n\n\t\tprocessRootState();\n\n\t\t*out << \"\\\\mbox{}\\n\"\n\t\t<< \"\\\\normalfont\\n\";\n\t\tif ( ! this->getBaseFontSize().empty() )\n\t\t\t*out << \"\\\\normalsize\\n\" ;\n\t\tif ( disableBabelShortHand )\n\t\t\t*out << \"\\\\shorthandon{\\\"}\\n\";\n\t}\n\n\tstring LatexGenerator::getHeader()\n\t{\n\t\tostringstream os;\n\n\t\tos << \"\\\\documentclass{article}\\n\"\n\t\t    << \"\\\\usepackage{color}\\n\"\n\t\t    << \"\\\\usepackage{alltt}\\n\"\n\t\t    << \"\\\\usepackage[T1]{fontenc}\\n\";\n\n\t\tif ( StringTools::change_case ( encoding ) ==\"utf-8\" )\n\t\t{\n\t\t\tos << \"\\\\usepackage{ucs}\\n\\\\usepackage[utf8x]{inputenc}\\n\";\n\t\t}\n\t\telse if ( encodingDefined() )\n\t\t{\n\t\t\tos << \"\\\\usepackage[latin1]{inputenc}\\n\";\n\t\t}\n\n\t\t//needed for Righttorque symbol\n\t\tif ( preFormatter.isEnabled() )\n\t\t{\n\t\t\tos << \"\\\\usepackage{marvosym}\\n\";\n\t\t}\n\n\t\tif ( currentSyntax->highlightingEnabled() )\n\t\t{\n\t\t\tif ( includeStyleDef )\n\t\t\t{\n\t\t\t\tos << \"\\n\"<<getStyleDefinition();\n\t\t\t\tos << CodeGenerator::readUserStyleDef();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tos << \"\\n\\\\input {\"\n\t\t\t\t<< getStyleOutputPath()\n\t\t\t\t<< \"}\\n\";\n\t\t\t}\n\t\t}\n\n\t\tos << \"\\n\\\\title{\" << docTitle << \"}\\n\"\n\t\t<< \"\\\\begin{document}\\n\"\n\t\t<< \"\\\\pagecolor{bgcolor}\\n\";\n\n\t\tif ( prettySymbols )\n\t\t{\n\t\t\tos<<\"\\\\newsavebox{\\\\hlboxopenbrace}\\n\"\n\t\t\t<<\"\\\\newsavebox{\\\\hlboxclosebrace}\\n\"\n\t\t\t<<\"\\\\newsavebox{\\\\hlboxlessthan}\\n\"\n\t\t\t<<\"\\\\newsavebox{\\\\hlboxgreaterthan}\\n\"\n\t\t\t<<\"\\\\newsavebox{\\\\hlboxdollar}\\n\"\n\t\t\t<<\"\\\\newsavebox{\\\\hlboxunderscore}\\n\"\n\t\t\t<<\"\\\\newsavebox{\\\\hlboxand}\\n\"\n\t\t\t<<\"\\\\newsavebox{\\\\hlboxhash}\\n\"\n\t\t\t<<\"\\\\newsavebox{\\\\hlboxat}\\n\"\n\t\t\t<<\"\\\\newsavebox{\\\\hlboxbackslash}\\n\"\n\t\t\t<<\"\\\\newsavebox{\\\\hlboxpercent}\\n\"\n\t\t\t<<\"\\\\newsavebox{\\\\hlboxhat}\\n\"\n\n\t\t\t<<\"\\\\setbox\\\\hlboxopenbrace=\\\\hbox{\\\\verb.{.}\\n\"\n\t\t\t<<\"\\\\setbox\\\\hlboxclosebrace=\\\\hbox{\\\\verb.}.}\\n\"\n\t\t\t<<\"\\\\setbox\\\\hlboxlessthan=\\\\hbox{\\\\verb.<.}\\n\"\n\t\t\t<<\"\\\\setbox\\\\hlboxgreaterthan=\\\\hbox{\\\\verb.>.}\\n\"\n\n\t\t\t<<\"\\\\setbox\\\\hlboxdollar=\\\\hbox{\\\\verb.$.}\\n\"\n\t\t\t<<\"\\\\setbox\\\\hlboxunderscore=\\\\hbox{\\\\verb._.}\\n\"\n\t\t\t<<\"\\\\setbox\\\\hlboxand=\\\\hbox{\\\\verb.&.}\\n\"\n\t\t\t<<\"\\\\setbox\\\\hlboxhash=\\\\hbox{\\\\verb.#.}\\n\"\n\t\t\t<<\"\\\\setbox\\\\hlboxat=\\\\hbox{\\\\verb.@.}\\n\"\n\t\t\t<<\"\\\\setbox\\\\hlboxbackslash=\\\\hbox{\\\\verb.\\\\.}\\n\"\n\t\t\t<<\"\\\\setbox\\\\hlboxpercent=\\\\hbox{\\\\verb.\\\\%.}\\n\"\n\t\t\t<<\"\\\\setbox\\\\hlboxhat=\\\\hbox{\\\\verb.^.}\\n\"\n\n\t\t\t<<\"\\\\def\\\\urltilda{\\\\kern -.15em\\\\lower .7ex\\\\hbox{\\\\~{}}\\\\kern .04em}\\n\";\n\t\t}\n\n\t\treturn os.str();\n\t}\n\n\tstring LatexGenerator::getFooter()\n\t{\n\t\tostringstream os;\n\t\tos << \"\\\\end {document}\\n\"\n\t\t<< \"(* LaTeX generated by highlight \"\n\t\t<< HIGHLIGHT_VERSION\n\t\t<< \", \"\n\t\t<< HIGHLIGHT_URL\n\t\t<< \" *)\\n\";\n\t\treturn os.str();\n\t}\n\n\n\tvoid LatexGenerator::initOutputTags(){\n\n\t\topenTags.push_back ( \"\\\\hl\"+STY_NAME_STD+\"{\" );\n\t\topenTags.push_back ( \"\\\\hl\"+STY_NAME_STR+\"{\" );\n\t\topenTags.push_back ( \"\\\\hl\"+STY_NAME_NUM+\"{\" );\n\t\topenTags.push_back ( \"\\\\hl\"+STY_NAME_SLC+\"{\" );\n\t\topenTags.push_back ( \"\\\\hl\"+STY_NAME_COM+\"{\" );\n\t\topenTags.push_back ( \"\\\\hl\"+STY_NAME_ESC+\"{\" );\n\t\topenTags.push_back ( \"\\\\hl\"+STY_NAME_DIR+\"{\" );\n\t\topenTags.push_back ( \"\\\\hl\"+STY_NAME_DST+\"{\" );\n\t\topenTags.push_back ( \"\\\\hl\"+STY_NAME_LIN+\"{\" );\n\t\topenTags.push_back ( \"\\\\hl\"+STY_NAME_SYM+\"{\" );\n\t\topenTags.push_back ( \"\\\\hl\"+STY_NAME_IPL+\"{\" );\n\n\t\tfor (unsigned int i=0;i<NUMBER_BUILTIN_STATES; i++ )\n\t\t{\n\t\t\tcloseTags.push_back ( \"}\" );\n\t\t}\n\t}\n\n\tstring LatexGenerator::getAttributes ( const string & elemName,\n\t                                       const ElementStyle &elem )\n\t{\n\t\tostringstream s;\n\t\ts  << \"\\\\newcommand{\\\\hl\"\n\t\t<< elemName\n\t\t<< \"}[1]{\\\\textcolor[rgb]{\"\n\t\t<< elem.getColour().getRed ( LATEX ) << \",\"\n\t\t<< elem.getColour().getGreen ( LATEX ) << \",\"\n\t\t<< elem.getColour().getBlue ( LATEX )\n\t\t<< \"}{\";\n\n\t\tif ( elem.isBold() )\n\t\t\ts << \"\\\\bf{\";\n\t\tif ( elem.isItalic() )\n\t\t\ts << \"\\\\it{\";\n\n\t\ts  <<\"#1\";\n\n\t\tif ( elem.isBold() )\n\t\t\ts << \"}\";\n\t\tif ( elem.isItalic() )\n\t\t\ts << \"}\";\n\n\t\ts  <<\"}}\\n\";\n\t\treturn s.str();\n\t}\n\n\n\tstring LatexGenerator::getNewLine()\n\t{\n\t\tstring nl;\n\n\t\t// set wrapping arrow if previous line was wrapped\n\t\tif ( preFormatter.isWrappedLine ( lineNumber-1 ) )\n\t\t{\n\t\t\tnl = \"\\\\Righttorque\";\n\t\t}\n\t\tnl += ( showLineNumbers ) ? newLineTag:longLineTag;\n\t\treturn nl;\n\t}\n\n\tstring LatexGenerator::maskCharacter ( unsigned char c )\n\t{\n\t\tswitch ( c )\n\t\t{\n\t\t\tcase ' ':\n\t\t\t\treturn spacer;\n\t\t\t\tbreak;\n\n\t\t\tcase '<' :\n\t\t\t\treturn prettySymbols ? \"\\\\usebox{\\\\hlboxlessthan}\" : \"$<$\";\n\t\t\t\tbreak;\n\t\t\tcase '>' :\n\t\t\t\treturn prettySymbols ? \"\\\\usebox{\\\\hlboxgreaterthan}\" : \"$>$\";\n\t\t\t\tbreak;\n\t\t\tcase '{':\n\t\t\t\treturn prettySymbols ? \"\\\\usebox{\\\\hlboxopenbrace}\" : \"\\\\{\";\n\t\t\t\tbreak;\n\t\t\tcase '}':\n\t\t\t\treturn prettySymbols ? \"\\\\usebox{\\\\hlboxclosebrace}\" : \"\\\\}\";\n\t\t\t\tbreak;\n\n\t\t\tcase '&':\n\t\t\tcase '$':\n\t\t\tcase '#':\n\t\t\tcase '%':\n\t\t\t{\n\t\t\t\tstring m ( \"\\\\\" );\n\t\t\t\tm += c;\n\t\t\t\treturn m;\n\t\t\t}\n\t\t\tbreak;\n\t\t\tcase '\\\"':\n\t\t\t\treturn ( replaceQuotes ) ?\"\\\\dq{}\":\"\\\"\";\n\t\t\t\tbreak;\n\t\t\tcase '_':\n\t\t\t\treturn \"\\\\textunderscore \";\n\t\t\t\tbreak;\n\t\t\tcase '^':\n\t\t\t\treturn \"\\\\textasciicircum \";\n\t\t\t\tbreak;\n\t\t\tcase '\\\\':\n\t\t\t\treturn \"$\\\\backslash$\";\n\t\t\t\tbreak;\n\t\t\tcase '~':\n\t\t\t\treturn prettySymbols ? \"\\\\urltilda \" : \"$\\\\sim$\";\n\t\t\t\tbreak;\n\t\t\tcase '|':\n\t\t\t\treturn \"\\\\textbar \";\n\t\t\t\tbreak;\n\t\t\t\t// avoid latex compilation failure if [ or * follows a line break (\\\\)\n\t\t\tcase '*':\n\t\t\tcase '[':\n\t\t\tcase ']':\n\t\t\t\t// avoid \"merging\" of consecutive '-' chars when included in bold font ( \\bf )\n\t\t\tcase '-':\n\t\t\t{\n\t\t\t\tstring m ( 1, '{' );\n\t\t\t\tm += c;\n\t\t\t\tm += '}';\n\t\t\t\treturn m;\n\t\t\t}\n\t\t\tbreak;\n\t\t\tdefault :\n\t\t\t\treturn string ( 1, c );\n\t\t}\n\t}\n\n\tstring LatexGenerator::getKeywordOpenTag ( unsigned int styleID )\n\t{\n\t\treturn \"\\\\hl\"+currentSyntax->getKeywordClasses() [styleID]+\"{\";\n\t}\n\n\tstring LatexGenerator::getKeywordCloseTag ( unsigned int styleID )\n\t{\n\t\treturn \"}\";\n\t}\n\n\tstring LatexGenerator::getStyleDefinition()\n\t{\n\t\tif ( styleDefinitionCache.empty() )\n\t\t{\n\t\t\tostringstream os;\n\t\t\tos << getAttributes ( STY_NAME_STD, docStyle.getDefaultStyle() );\n\t\t\tos << getAttributes ( STY_NAME_NUM, docStyle.getNumberStyle() );\n\t\t\tos << getAttributes ( STY_NAME_ESC, docStyle.getEscapeCharStyle() );\n\t\t\tos << getAttributes ( STY_NAME_STR, docStyle.getStringStyle() );\n\t\t\tos << getAttributes ( STY_NAME_DST, docStyle.getPreProcStringStyle() );\n\t\t\tos << getAttributes ( STY_NAME_SLC, docStyle.getSingleLineCommentStyle() );\n\t\t\tos << getAttributes ( STY_NAME_COM, docStyle.getCommentStyle() );\n\t\t\tos << getAttributes ( STY_NAME_DIR, docStyle.getPreProcessorStyle() );\n\t\t\tos << getAttributes ( STY_NAME_SYM, docStyle.getOperatorStyle() );\n\t\t\tos << getAttributes ( STY_NAME_IPL, docStyle.getInterpolationStyle() );\n\t\t\tos << getAttributes ( STY_NAME_LIN, docStyle.getLineStyle() );\n\n\t\t\tKeywordStyles styles = docStyle.getKeywordStyles();\n\t\t\tfor ( KSIterator it=styles.begin(); it!=styles.end(); it++ )\n\t\t\t{\n\t\t\t\tos << getAttributes ( it->first, it->second );\n\t\t\t}\n\t\t\tos << \"\\\\definecolor{bgcolor}{rgb}{\"\n\t\t\t<< docStyle.getBgColour().getRed ( LATEX ) << \",\"\n\t\t\t<< docStyle.getBgColour().getGreen ( LATEX ) << \",\"\n\t\t\t<< docStyle.getBgColour().getBlue ( LATEX )\n\t\t\t<< \"}\\n\";\n\n\t\t\tstyleDefinitionCache=os.str();\n\t\t}\n\t\treturn styleDefinitionCache;\n\t}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/objectgenerator.cpp",
    "content": "/***************************************************************************\n                     objectgenerator.cpp  -  description\n                             -------------------\n    begin                : Wed Nov 28 2015\n    copyright            : (C) 20015-2020 by evilbianry\n    email                : rootdebug@163.com\n ***************************************************************************/\n\n\n#include <fstream>\n#include <iostream>\n#include <sstream>\n#include <algorithm>\n\n#include \"ObjectGenerator.h\"\n#include \"version.h\"\n\n#if ANDROID\n#include <android/log.h>\n#ifndef TAG_NAME\n    #define TAG_NAME \"highliter\"\n#endif\n#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, TAG_NAME, __VA_ARGS__))\n#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, TAG_NAME, __VA_ARGS__))\n#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, TAG_NAME, __VA_ARGS__))\n#define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, TAG_NAME, __VA_ARGS__))\n#else\n#define LOGI(...)\n#define LOGW(...)\n#define LOGE(...)\n#endif\n\nusing namespace std;\n\nnamespace highlight {\n\n    ObjectGenerator::ObjectGenerator() :\n            CodeGenerator(OBJECT),\n            brTag(\"<br>\"),\n            hrTag(\"<hr>\"),\n            idAttr(\"name\"),\n            fileSuffix(\".obj\"),\n            cssClassName(\"hl\"),\n            orderedList(false),\n            useInlineCSS(false),\n            enclosePreTag(false),\n            attachAnchors(false),\n            anchorPrefix(\"l\") {\n        spacer = \" \";\n        styleCommentOpen = \"/*\";\n        styleCommentClose = \"*/\";\n\n        LOGI(\"ObjectGenerator\");\n\n    }\n\n\n    string ObjectGenerator::getHeaderStart(const string &title) {\n        //LOGI(\"getHeaderStart\");\n\n        ostringstream header;\n        header << \"<!DOCTYPE html>\\n<html>\\n<head>\\n\";\n        if (encodingDefined()) {\n            header << \"<meta charset=\\\"\"\n            << encoding\n            << \"\\\">\\n\";\n        }\n        header << \"<title>\" << title << \"</title>\\n\";\n        return header.str();\n    }\n\n    string ObjectGenerator::getHeader() {\n        LOGI(\"getHeader\");\n        ostringstream os;\n        os << getHeaderStart(docTitle);\n        if (!useInlineCSS) {\n            if (includeStyleDef) {\n                os << \"<style type=\\\"text/css\\\">\\n\";\n                os << getStyleDefinition();\n                os << CodeGenerator::readUserStyleDef();\n                os << \"</style>\\n\";\n            }\n            else {\n                os << \"<link rel=\\\"stylesheet\\\" type=\\\"text/css\\\" href=\\\"\"\n                << getStyleOutputPath()\n                << \"\\\">\\n\";\n            }\n            os << \"</head>\\n<body\";\n            if (!cssClassName.empty())\n                os << \" class=\\\"\" << cssClassName << \"\\\"\";\n            os << \">\\n\";\n        }\n        else {\n            os << \"</head>\\n<body style=\\\"\"\n            << \"background-color:#\"\n            << (docStyle.getBgColour().getRed(HTML))\n            << (docStyle.getBgColour().getGreen(HTML))\n            << (docStyle.getBgColour().getBlue(HTML))\n            << \"\\\">\\n\";\n        }\n\n        return os.str();\n    }\n\n    string ObjectGenerator::getFooter() {\n        LOGI(\"getFooter\");\n        return getGeneratorComment();\n    }\n\n    void ObjectGenerator::printBody() {\n        LOGI(\"printBody\");\n\n        if ((!(showLineNumbers && orderedList) && !fragmentOutput) || enclosePreTag) {\n            if (!useInlineCSS) {\n                *out << \"<pre\";\n                if (!cssClassName.empty())\n                    *out << \" class=\\\"\" << cssClassName << \"\\\"\";\n                *out << \">\";\n            }\n            else {\n                bool quoteFont = getBaseFont().find_first_of(\",'\") == string::npos;\n                *out << \"<pre style=\\\"\"\n                << \"color:#\"\n                << (docStyle.getDefaultStyle().getColour().getRed(HTML))\n                << (docStyle.getDefaultStyle().getColour().getGreen(HTML))\n                << (docStyle.getDefaultStyle().getColour().getBlue(HTML))\n                << \"; background-color:#\"\n                << (docStyle.getBgColour().getRed(HTML))\n                << (docStyle.getBgColour().getGreen(HTML))\n                << (docStyle.getBgColour().getBlue(HTML))\n                << \"; font-size:\" << this->getBaseFontSize()\n                << \"pt; font-family:\"\n                << ((quoteFont) ? \"'\" : \"\")\n                << this->getBaseFont()\n                << ((quoteFont) ? \"'\" : \"\")\n                << \";\\\">\";\n            }\n        }\n        if (showLineNumbers && orderedList) *out << \"<ol>\\n\";\n\n        processRootState();\n\n        if (showLineNumbers && orderedList) *out << \"</ol>\";\n\n        if ((!(showLineNumbers && orderedList) && !fragmentOutput) || enclosePreTag)\n            *out << \"</pre>\";\n    }\n\n\n    void ObjectGenerator::initOutputTags() {\n        //LOGI(\"initOutputTags\");\n\n        openTags.push_back(\"\");\n        if (useInlineCSS) {\n            openTags.push_back(getOpenTag(docStyle.getStringStyle()));\n            openTags.push_back(getOpenTag(docStyle.getNumberStyle()));\n            openTags.push_back(getOpenTag(docStyle.getSingleLineCommentStyle()));\n            openTags.push_back(getOpenTag(docStyle.getCommentStyle()));\n            openTags.push_back(getOpenTag(docStyle.getEscapeCharStyle()));\n            openTags.push_back(getOpenTag(docStyle.getPreProcessorStyle()));\n            openTags.push_back(getOpenTag(docStyle.getPreProcStringStyle()));\n            openTags.push_back(getOpenTag(docStyle.getLineStyle()));\n            openTags.push_back(getOpenTag(docStyle.getOperatorStyle()));\n            openTags.push_back(getOpenTag(docStyle.getInterpolationStyle()));\n        }\n        else {\n            openTags.push_back(getOpenTag(STY_NAME_STR));\n            openTags.push_back(getOpenTag(STY_NAME_NUM));\n            openTags.push_back(getOpenTag(STY_NAME_SLC));\n            openTags.push_back(getOpenTag(STY_NAME_COM));\n            openTags.push_back(getOpenTag(STY_NAME_ESC));\n            openTags.push_back(getOpenTag(STY_NAME_DIR));\n            openTags.push_back(getOpenTag(STY_NAME_DST));\n            openTags.push_back(getOpenTag(STY_NAME_LIN));\n            openTags.push_back(getOpenTag(STY_NAME_SYM));\n            openTags.push_back(getOpenTag(STY_NAME_IPL));\n        }\n\n        closeTags.push_back(\"\");\n        for (unsigned int i = 1; i < NUMBER_BUILTIN_STATES; i++) {\n            closeTags.push_back(\"</span>\");\n        }\n\n    }\n\n    string  ObjectGenerator::getAttributes(const string &elemName, const ElementStyle &elem) {\n\n        //LOGI(\"getAttributes\");\n\n        ostringstream s;\n        if (!elemName.empty()) {\n            if (!cssClassName.empty())\n                s << \".\" << cssClassName;\n            s << \".\" << elemName << \" { \";\n        }\n        s << \"color:#\"\n        << (elem.getColour().getRed(HTML))\n        << (elem.getColour().getGreen(HTML))\n        << (elem.getColour().getBlue(HTML))\n        << (elem.isBold() ? \"; font-weight:bold\" : \"\")\n        << (elem.isItalic() ? \"; font-style:italic\" : \"\")\n        << (elem.isUnderline() ? \"; text-decoration:underline\" : \"\");\n        if (!elemName.empty()) {\n            s << \"; }\\n\";\n        }\n        return s.str();\n    }\n\n    string  ObjectGenerator::getOpenTag(const string &styleName) {\n        //LOGI(\"getOpenTag:%s\", styleName.c_str());\n        return \"\" + (cssClassName.empty() ? \"\" : cssClassName + \" \") + styleName +\n               \"\";\n    }\n\n    string  ObjectGenerator::getOpenTag(const ElementStyle &elem) {\n        //LOGI(\"getOpenTag2:%s\", getAttributes(\"\", elem).c_str());\n        return \"\" + getAttributes(\"\", elem) + \"\";\n    }\n\n    string ObjectGenerator::getGeneratorComment() {\n        LOGI(\"getGeneratorComment\");\n\n        ostringstream s;\n        s << \"\\n</body>\\n</html>\\n<!--HTML generated by highlight \"\n        << HIGHLIGHT_VERSION << \", \" << HIGHLIGHT_URL << \"-->\\n\";\n\n        return s.str();\n    }\n\n    string ObjectGenerator::getStyleDefinition() {\n        //LOGI(\"getStyleDefinition\");\n\n        if (styleDefinitionCache.empty()) {\n            bool quoteFont = getBaseFont().find_first_of(\",'\") == string::npos;\n            ostringstream os;\n            os << \"body\";\n            if (!cssClassName.empty())\n                os << \".\" << cssClassName;\n            os << \"\\t{ background-color:#\"\n            << (docStyle.getBgColour().getRed(HTML))\n            << (docStyle.getBgColour().getGreen(HTML))\n            << (docStyle.getBgColour().getBlue(HTML))\n            << \"; }\\n\";\n            os << (orderedList ? \"li\" : \"pre\");\n            if (!cssClassName.empty())\n                os << \".\" << cssClassName;\n            os << \"\\t{ color:#\"\n            << (docStyle.getDefaultStyle().getColour().getRed(HTML))\n            << (docStyle.getDefaultStyle().getColour().getGreen(HTML))\n            << (docStyle.getDefaultStyle().getColour().getBlue(HTML))\n            << \"; background-color:#\"\n            << (docStyle.getBgColour().getRed(HTML))\n            << (docStyle.getBgColour().getGreen(HTML))\n            << (docStyle.getBgColour().getBlue(HTML))\n            << \"; font-size:\" << this->getBaseFontSize();\n\n            os << \"pt; font-family:\" << ((quoteFont) ? \"'\" : \"\") << getBaseFont() <<\n            ((quoteFont) ? \"'\" : \"\")\n            << \";}\\n\";\n\n            os << getAttributes(STY_NAME_NUM, docStyle.getNumberStyle())\n            << getAttributes(STY_NAME_ESC, docStyle.getEscapeCharStyle())\n            << getAttributes(STY_NAME_STR, docStyle.getStringStyle())\n            << getAttributes(STY_NAME_DST, docStyle.getPreProcStringStyle())\n            << getAttributes(STY_NAME_SLC, docStyle.getSingleLineCommentStyle())\n            << getAttributes(STY_NAME_COM, docStyle.getCommentStyle())\n            << getAttributes(STY_NAME_DIR, docStyle.getPreProcessorStyle())\n            << getAttributes(STY_NAME_SYM, docStyle.getOperatorStyle())\n            << getAttributes(STY_NAME_IPL, docStyle.getInterpolationStyle())\n            << getAttributes(STY_NAME_LIN, docStyle.getLineStyle());\n\n            KeywordStyles styles = docStyle.getKeywordStyles();\n            for (KSIterator it = styles.begin(); it != styles.end(); it++) {\n                os << getAttributes(it->first, it->second);\n            }\n            styleDefinitionCache = os.str();\n        }\n        return styleDefinitionCache;\n    }\n\n    string ObjectGenerator::maskCharacter(unsigned char c) {\n        //LOGI(\"maskCharacter\");\n        return string(1, c);\n    }\n\n    string ObjectGenerator::getNewLine() {\n        //LOGI(\"getNewLine\");\n\n        string nlStr;\n        if (showLineNumbers && orderedList) nlStr += \"</li>\";\n        if (printNewLines) nlStr += \"\\n\";\n        return nlStr;\n    }\n\n    void ObjectGenerator::insertLineNumber(bool insertNewLine) {\n        //LOGI(\"insertLineNumber\");\n\n        if (insertNewLine) {\n            wsBuffer += getNewLine();\n        }\n        if (showLineNumbers) {\n            ostringstream numberPrefix;\n            int lineNo = lineNumber + lineNumberOffset;\n            if (orderedList) {\n                if (useInlineCSS) {\n                    bool quoteFont = getBaseFont().find_first_of(\",'\") == string::npos;\n                    numberPrefix << \"<li style=\\\"\"\n                    << getAttributes(\"\", docStyle.getLineStyle())\n                    << \"; font-size:\" << this->getBaseFontSize()\n                    << \"pt; font-family:\" << ((quoteFont) ? \"'\" : \"\")\n                    << getBaseFont() << ((quoteFont) ? \"'\" : \"\")\n                    << \";\\\">\";\n                }\n                else {\n                    if (!cssClassName.empty())\n                        numberPrefix << \"<li class=\\\"\" << cssClassName << \"\\\">\";\n                    else\n                        numberPrefix << \"<li>\";\n                }\n                // Opera 8 ignores empty list items -> add &nbsp;\n                //if ( line.empty() ) numberPrefix<<\"&nbsp;\";\n            }\n\n            //attach Anchor only if we're in a new line.\n            if (attachAnchors && numberCurrentLine) {\n                numberPrefix << \"<a \"\n                << idAttr\n                << \"=\\\"\"\n                << anchorPrefix\n                << \"_\"\n                << lineNo\n                << \"\\\"></a>\";\n            }\n\n            if (!orderedList) {\n                //if we're in a wrapped line, don't fill with zeroes.\n                ostringstream os;\n                if (lineNumberFillZeroes && numberCurrentLine) {\n                    os.fill('0');\n                }\n\n                os << setw(getLineNumberWidth()) << right;\n                //if we're in a wrapped line, don't attach lineNo.\n                if (numberCurrentLine) {\n                    os << lineNo;\n                } else {\n                    os << \"\";\n                }\n\n                numberPrefix << openTags[LINENUMBER]\n                << os.str()\n                << spacer\n                << closeTags[LINENUMBER];\n            }\n            wsBuffer += numberPrefix.str();\n        }\n\n    }\n\n\n    bool ObjectGenerator::printIndexFile(const vector <string> &fileList,\n                                         const string &outPath) {\n        string suffix = fileSuffix;\n        string outFilePath = outPath + \"index\" + suffix;\n        ofstream indexfile(outFilePath.c_str());\n\n        if (!indexfile.fail()) {\n            string inFileName;\n            string inFilePath, newInFilePath;\n            std::set <string> usedFileNames;\n            indexfile << getHeaderStart(\"Source Index\");\n            indexfile << \"</head>\\n<body>\\n<h1> Source Index</h1>\\n\"\n            << hrTag\n            << \"\\n<ul>\\n\";\n            string::size_type pos;\n            for (unsigned int i = 0; i < fileList.size(); i++) {\n                pos = (fileList[i]).find_last_of(Platform::pathSeparator);\n                if (pos != string::npos) {\n                    newInFilePath = (fileList[i]).substr(0, pos + 1);\n                }\n                else {\n                    newInFilePath = Platform::pathSeparator;\n                }\n                if (newInFilePath != inFilePath) {\n                    indexfile << \"</ul>\\n<h2>\";\n                    indexfile << newInFilePath;\n                    indexfile << \"</h2>\\n<ul>\\n\";\n                    inFilePath = newInFilePath;\n                }\n                inFileName = (fileList[i]).substr(pos + 1);\n\n                if (usedFileNames.count(inFileName)) {\n                    string prefix = fileList[i].substr(0, pos + 1);\n                    replace(prefix.begin(), prefix.end(), Platform::pathSeparator, '_');\n                    inFileName.insert(0, prefix);\n                } else {\n                    usedFileNames.insert(inFileName);\n                }\n\n                indexfile << \"<li><a href=\\\"\" << inFileName << suffix << \"\\\">\";\n                indexfile << inFileName << suffix << \"</a></li>\\n\";\n            }\n\n            indexfile << \"</ul>\\n\"\n            << hrTag << brTag\n            << \"<small>Generated by highlight \"\n            << HIGHLIGHT_VERSION\n            << \", <a href=\\\"\" << HIGHLIGHT_URL << \"\\\" target=\\\"new\\\">\"\n            << HIGHLIGHT_URL << \"</a></small>\";\n            indexfile << getGeneratorComment();\n        }\n        else {\n            return false;\n        }\n        return true;\n    }\n\n\n    string ObjectGenerator::getKeywordOpenTag(unsigned int styleID) {\n\n        //LOGI(\"getKeywordOpenTag:%d\", styleID);\n\n        if (useInlineCSS) {\n            return getOpenTag(\n                    docStyle.getKeywordStyle(currentSyntax->getKeywordClasses()[styleID]));\n        }\n        return getOpenTag(currentSyntax->getKeywordClasses()[styleID]);\n    }\n\n    string ObjectGenerator::getKeywordCloseTag(unsigned int styleID) {\n        //LOGI(\"getKeywordCloseTag:%d\", styleID);\n        return \"\";\n    }\n\n    void ObjectGenerator::setHTMLOrderedList(bool b) {\n        //LOGI(\"setHTMLOrderedList\");\n\n        orderedList = b;\n        spacer = b ? \"&nbsp;\" : \" \";\n        maskWs = b;\n\n        if (b && !preFormatter.getReplaceTabs()) {\n            preFormatter.setReplaceTabs(true);\n            preFormatter.setNumberSpaces(4);\n        }\n    }\n\n}\n"
  },
  {
    "path": "jni/highlight/core/odtgenerator.cpp",
    "content": "/***************************************************************************\n                    odtgenerator.cpp  -  description\n                             -------------------\n    begin                : Jul 19 2012\n    copyright            : (C) 2012 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n#include <sstream>\n#include \"odtgenerator.h\"\n\nusing namespace std;\n\nnamespace highlight\n{\n\nODTGenerator::ODTGenerator() : CodeGenerator ( ODTFLAT )\n{\n    newLineTag = \"</text:p>\\n<text:p text:style-name=\\\"Standard\\\">\";\n    spacer = \"<text:s text:c=\\\"1\\\"/>\"; // TODO insert number of spaces\n    maskWs=true;\n    if ( !preFormatter.getReplaceTabs()) { // TODO use <text:tab/>\n\n        preFormatter.setReplaceTabs ( true );\n        preFormatter.setNumberSpaces ( 4 );\n    }\n}\n\nODTGenerator::~ODTGenerator() {}\n\nstring ODTGenerator::getStyleDefinition()\n{\n    if ( styleDefinitionCache.empty() )\n    {\n        ostringstream os;\n\n        os  << \"<office:styles>\\n<style:style style:name=\\\"Standard\\\" style:family=\\\"paragraph\\\" style:class=\\\"text\\\">\\n\"\n            << \"  <style:text-properties style:font-name=\\\"\"<< getBaseFont()<<\"\\\" fo:font-size=\\\"\"<<getBaseFontSize()<<\"pt\\\"/>\"\n            << \"</style:style>\\n</office:styles>\"\n            << \"<office:automatic-styles>\\n\";\n\n        os << getAttributes ( STY_NAME_STD, docStyle.getDefaultStyle() )\n           << getAttributes ( STY_NAME_NUM, docStyle.getNumberStyle() )\n           << getAttributes ( STY_NAME_ESC, docStyle.getEscapeCharStyle() )\n           << getAttributes ( STY_NAME_STR, docStyle.getStringStyle() )\n           << getAttributes ( STY_NAME_DST, docStyle.getPreProcStringStyle() )\n           << getAttributes ( STY_NAME_SLC, docStyle.getSingleLineCommentStyle() )\n           << getAttributes ( STY_NAME_COM, docStyle.getCommentStyle() )\n           << getAttributes ( STY_NAME_DIR, docStyle.getPreProcessorStyle() )\n           << getAttributes ( STY_NAME_SYM, docStyle.getOperatorStyle() )\n\t   << getAttributes ( STY_NAME_IPL, docStyle.getInterpolationStyle() )\n           << getAttributes ( STY_NAME_LIN, docStyle.getLineStyle() );\n\n        KeywordStyles styles = docStyle.getKeywordStyles();\n        for ( KSIterator it=styles.begin(); it!=styles.end(); it++ )\n        {\n            os << getAttributes (it->first, it->second );\n        }\n\n        os << \"<style:page-layout style:name=\\\"pm1\\\">\"\n           << \"<style:page-layout-properties fo:page-width=\\\"21.001cm\\\" fo:page-height=\\\"29.7cm\\\" style:num-format=\\\"1\\\"\"\n           << \" style:print-orientation=\\\"portrait\\\" fo:margin=\\\"2cm\\\" fo:margin-top=\\\"2cm\\\" fo:margin-bottom=\\\"2cm\\\" fo:margin-left=\\\"2cm\\\" fo:margin-right=\\\"2cm\\\" \"\n           << \"fo:background-color=\\\"#\"\n           << ( docStyle.getBgColour().getRed ( HTML ) )\n           << ( docStyle.getBgColour().getGreen ( HTML ) )\n           << ( docStyle.getBgColour().getBlue ( HTML ) )\n           << \"\\\" style:writing-mode=\\\"lr-tb\\\" style:footnote-max-height=\\\"0cm\\\">\\n\"\n           << \" <style:background-image/>\\n\"\n           << \" <style:footnote-sep style:width=\\\"0.018cm\\\" style:distance-before-sep=\\\"0.101cm\\\" style:distance-after-sep=\\\"0.101cm\\\" style:line-style=\\\"solid\\\"\"\n           << \" style:adjustment=\\\"left\\\" style:rel-width=\\\"25%\\\" style:color=\\\"#000000\\\"/>\"\n           << \"</style:page-layout-properties>\\n\"\n           << \"<style:header-style/>\\n\"\n           << \"<style:footer-style/>\\n\"\n           << \"</style:page-layout>\\n\"\n           << \"</office:automatic-styles>\\n\"\n           << \"<office:master-styles>\\n\"\n           << \" <style:master-page style:name=\\\"Standard\\\" style:page-layout-name=\\\"pm1\\\"/>\\n\"\n           << \"</office:master-styles>\\n\";\n\n        styleDefinitionCache=os.str();\n    }\n    return styleDefinitionCache;\n}\n\nstring ODTGenerator::getAttributes ( const string & elemName,\n                                     const ElementStyle & elem )\n{\n    ostringstream s;\n    s << \"<style:style style:name=\\\"\"<<elemName<<\"\\\" style:family=\\\"text\\\">\\n\"\n      << \"<style:text-properties fo:color=\\\"#\"\n      << ( elem.getColour().getRed ( HTML ) )\n      << ( elem.getColour().getGreen ( HTML ) )\n      << ( elem.getColour().getBlue ( HTML ) )\n      << \"\\\"\"\n      << ( elem.isBold() ?     \" fo:font-weight=\\\"bold\\\"\" :\"\" )\n      << ( elem.isItalic() ?   \" fo:font-style=\\\"italic\\\"\" :\"\" )\n      << ( elem.isUnderline() ? \" style:text-underline-style=\\\"solid\\\" style:text-underline-width=\\\"auto\\\" style:text-underline-color=\\\"font-color\\\"\" :\"\" )\n      <<\"/>\\n</style:style>\\n\" ;\n\n    return s.str();\n}\n\nstring ODTGenerator::getHeader()\n{\n    ostringstream header;\n    header << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"\\\n           \"<office:document xmlns:office=\\\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\\\" xmlns:style=\\\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\\\"\"\\\n           \" xmlns:text=\\\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\\\" xmlns:table=\\\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\\\"\"\\\n           \" xmlns:draw=\\\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\\\" xmlns:fo=\\\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\\\"\"\\\n           \" xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\" xmlns:meta=\\\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\\\"\"\\\n           \" xmlns:number=\\\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\\\" xmlns:svg=\\\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\\\"\"\\\n           \" xmlns:chart=\\\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\\\" xmlns:dr3d=\\\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\\\"\"\\\n           \" xmlns:math=\\\"http://www.w3.org/1998/Math/MathML\\\" xmlns:form=\\\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\\\" xmlns:script=\\\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\\\"\"\\\n           \" xmlns:config=\\\"urn:oasis:names:tc:opendocument:xmlns:config:1.0\\\" xmlns:ooo=\\\"http://openoffice.org/2004/office\\\" xmlns:ooow=\\\"http://openoffice.org/2004/writer\\\"\"\\\n           \" xmlns:oooc=\\\"http://openoffice.org/2004/calc\\\" xmlns:dom=\\\"http://www.w3.org/2001/xml-events\\\" xmlns:xforms=\\\"http://www.w3.org/2002/xforms\\\"\"\\\n           \" xmlns:xsd=\\\"http://www.w3.org/2001/XMLSchema\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\" xmlns:rpt=\\\"http://openoffice.org/2005/report\\\"\"\\\n           \" xmlns:of=\\\"urn:oasis:names:tc:opendocument:xmlns:of:1.2\\\" xmlns:xhtml=\\\"http://www.w3.org/1999/xhtml\\\" xmlns:grddl=\\\"http://www.w3.org/2003/g/data-view#\\\"\"\\\n           \" xmlns:tableooo=\\\"http://openoffice.org/2009/table\\\" xmlns:field=\\\"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0\\\"\"\\\n           \" xmlns:formx=\\\"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0\\\" xmlns:css3t=\\\"http://www.w3.org/TR/css3-text/\\\" office:version=\\\"1.2\\\"\"\\\n           \" office:mimetype=\\\"application/vnd.oasis.opendocument.text\\\">\\n\"\\\n           \" <office:font-face-decls>\\n\"\\\n           \"  <style:font-face style:name=\\\"FreeMono\\\" svg:font-family=\\\"FreeMono\\\" style:font-family-generic=\\\"modern\\\" style:font-pitch=\\\"fixed\\\"/>\\n\"\\\n           \" </office:font-face-decls>\\n\";\n\n    header << getStyleDefinition();\n\n    header  << \" <office:body>\\n\"\n            << \"  <office:text>\\n\"\n            << \"<text:p text:style-name=\\\"Standard\\\">\";\n\n    return header.str();\n}\n\nvoid ODTGenerator::printBody()\n{\n    processRootState();\n}\n\nstring ODTGenerator::getFooter()\n{\n    return \"</text:p>\\n  </office:text>\\n </office:body>\\n</office:document>\";\n}\n\nstring  ODTGenerator::getOpenTag ( const string& styleName )\n{\n    return \"<text:span text:style-name=\\\"\"+styleName+\"\\\">\";\n}\n\nvoid ODTGenerator::initOutputTags ()\n{\n    openTags.push_back ( \"\" );\n    openTags.push_back ( getOpenTag ( STY_NAME_STR ) );\n    openTags.push_back ( getOpenTag ( STY_NAME_NUM ) );\n    openTags.push_back ( getOpenTag ( STY_NAME_SLC ) );\n    openTags.push_back ( getOpenTag ( STY_NAME_COM ) );\n    openTags.push_back ( getOpenTag ( STY_NAME_ESC ) );\n    openTags.push_back ( getOpenTag ( STY_NAME_DIR ) );\n    openTags.push_back ( getOpenTag ( STY_NAME_DST ) );\n    openTags.push_back ( getOpenTag ( STY_NAME_LIN ) );\n    openTags.push_back ( getOpenTag ( STY_NAME_SYM ) );\n    openTags.push_back ( getOpenTag ( STY_NAME_IPL ) );\n \n    closeTags.push_back ( \"\" );\n    for (unsigned int i=1; i<NUMBER_BUILTIN_STATES; i++ )\n    {\n        closeTags.push_back ( \"</text:span>\" );\n    }\n\n}\n\nstring ODTGenerator::maskCharacter ( unsigned char c )\n{\n    switch ( c )\n    {\n    case '<' :\n        return \"&lt;\";\n        break;\n    case '>' :\n        return \"&gt;\";\n        break;\n    case '&' :\n        return \"&amp;\";\n        break;\n    case '\\\"' :\n        return \"&quot;\";\n        break;\n    case ' ':\n        return spacer;\n        break;\n        //\tcase '\\t':\n        //\t\treturn \"<text:tab/>\";\n        //\t\tbreak;\n    default:\n        return string ( 1, c );\n    }\n}\n\nstring ODTGenerator::getKeywordOpenTag ( unsigned int styleID )\n{\n    return getOpenTag ( currentSyntax->getKeywordClasses() [styleID] );\n}\n\nstring ODTGenerator::getKeywordCloseTag ( unsigned int styleID )\n{\n    return \"</text:span>\";\n}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/pangogenerator.cpp",
    "content": "/***************************************************************************\n PangoGenerator.cpp  -  description\n                             -------------------\n    begin                : Sept 5 2014\n    copyright            : (C) 2014 by Dominik Schmidt\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include <sstream>\n\n#include \"pangogenerator.h\"\n\nusing namespace std;\n\nnamespace highlight\n{\n\n\tstring PangoGenerator::getOpenTag ( const ElementStyle & elem )\n\t{\n\t\treturn \"<span \"+getAttributes ( elem ) + \">\";\n\t}\n\t\n\tstring PangoGenerator::getAttributes ( const ElementStyle & elem )\n\t{\n\t\tostringstream s;\n\t\ts << \"foreground=\\\"#\"\n\t\t<< ( elem.getColour().getRed ( HTML ) )\n\t\t<< ( elem.getColour().getGreen ( HTML ) )\n\t\t<< ( elem.getColour().getBlue ( HTML ) )\n\t\t<< \"\\\"\"\n\t\t<< ( elem.isBold() ?     \" weight=\\\"bold\\\"\" :\"\" )\n\t\t<< ( elem.isItalic() ?   \" style=\\\"italic\\\"\" :\"\" )\n\t\t<< ( elem.isUnderline() ? \" underline=\\\"single\\\"\" :\"\" );\n\t\treturn s.str();\n\t}\n\n\tPangoGenerator::PangoGenerator() : CodeGenerator ( PANGO )\n\t{\n\n\t\tnewLineTag = \"\\n\";\n\t\tspacer = \" \";\n\t}\n\n\tPangoGenerator::~PangoGenerator() {}\n\n\tvoid PangoGenerator::initOutputTags(){\n\t\topenTags.push_back ( \"\" );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getStringStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getNumberStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getSingleLineCommentStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getCommentStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getEscapeCharStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getPreProcessorStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getPreProcStringStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getLineStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getOperatorStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getInterpolationStyle() ) );\n\n\t\tcloseTags.push_back ( \"\" );\n\t\tfor (unsigned int i=1;i<NUMBER_BUILTIN_STATES; i++ )\n\t\t{\n\t\t\tcloseTags.push_back ( \"</span>\" );\n\t\t}\n\t}\n\n\tstring PangoGenerator::getHeader()\n\t{\n\t\treturn string();\n\t}\n\n\tvoid PangoGenerator::printBody()\n\t{\n\t\tint fontSize=0;\n\t\tStringTools::str2num<int> ( fontSize, this->getBaseFontSize(), std::dec );\n\t\t\n\t\t*out << \"<span size=\\\"\"<<( ( fontSize ) ? fontSize*1024: 10*1024 ) << \"\\\" \"\n\t\t\t<< \"font_family=\\\"\" << getBaseFont() << \"\\\"\"\n\t\t\t<<\">\";\n\t\tprocessRootState();\n\t\t*out << \"</span>\";\n\t}\n\n\tstring PangoGenerator::getFooter()\n\t{\n\t\treturn string();\n\t}\n\n\tstring PangoGenerator::maskCharacter ( unsigned char c )\n\t{\n\t\tswitch ( c )\n\t\t{\n\t\tcase '<' :\n\t\t\treturn \"&lt;\";\n\t\t\tbreak;\n\t\tcase '>' :\n\t\t\treturn \"&gt;\";\n\t\t\tbreak;\n\t\tcase '&' :\n\t\t\treturn \"&amp;\";\n\t\t\tbreak;\n\t\tdefault :\n\t\t\treturn string ( 1, c );\n\t\t}\n\t}\n\n\tstring PangoGenerator::getKeywordOpenTag ( unsigned int styleID )\n\t{\n\t\treturn getOpenTag (docStyle.getKeywordStyle ( currentSyntax->getKeywordClasses() [styleID] ) );\n\t}\n\n\tstring PangoGenerator::getKeywordCloseTag ( unsigned int styleID )\n\t{\n\t\treturn \"</span>\";\n\t}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/platform_fs.cpp",
    "content": "\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include \"platform_fs.h\"\n\n// includes for recursive getFileNames() function\n#ifdef _WIN32\n#include <windows.h>\n#include <sys/stat.h>\n#else\n#include <dirent.h>\n#include <errno.h>\n#include <sys/stat.h>\n#ifdef __VMS\n#include <unixlib.h>\n#include <rms.h>\n#include <ssdef.h>\n#include <stsdef.h>\n#include <lib$routines.h>\n#include <starlet.h>\n#endif /* __VMS */\n#endif\n\n#include <algorithm>\n#include <iostream>\n#include <errno.h>\n\nusing namespace std;\n\nnamespace Platform\n{\n\n#ifdef WIN32\n#include <windows.h>\n\tconst char pathSeparator = '\\\\';\n\n\t#ifndef QT\n        std::string getAppPath()\n        {\n                char pathAndName[MAX_PATH], path[MAX_PATH], drive[3];\n                GetModuleFileName(NULL, pathAndName, MAX_PATH);\n                _splitpath(pathAndName, drive, path, 0, 0);\n                return std::string(drive)+path;\n        }\n\t#endif\n\t\n\tstd::string getHomePath()\n\t{\n\t\treturn \"\";\n\t}\n\n#else\n#include <unistd.h>\n#include <sys/types.h>\n#include <pwd.h>\n\tconst char pathSeparator = '/';\n\n\tstd::string getAppPath()\n\t{\n\t\treturn \"\";\n\t}\n\t\n\t\n\tstd::string getHomePath()\n\t{\n\t  struct passwd *pw = getpwuid(getuid());\n\t  return string(pw->pw_dir);\n\t}\n#endif\n\n\tbool getDirectoryEntries ( vector<string> &fileList,\n\t                           string wildcard,\n\t                           bool recursiveSearch )\n\t{\n\t\tif ( !wildcard.empty() )\n\t\t{\n\t\t\tstring directory_path;\n\t\t\tstring::size_type Pos = wildcard.find_last_of ( pathSeparator );\n\t\t\tif ( Pos == string::npos )\n\t\t\t{\n\t\t\t\tdirectory_path = \".\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tdirectory_path = wildcard.substr ( 0, Pos + 1 );\n\t\t\t\twildcard = wildcard.substr ( Pos + 1 );\n\t\t\t}\n\n\t\t\tgetFileNames ( directory_path, wildcard, fileList );\n\t\t}\n\t\treturn ! ( fileList.empty() );\n\t}\n\n\n#ifdef _WIN32  // Windows specific\n\n\t/**\n\t * WINDOWS function to resolve wildcards and recurse into sub directories.\n\t * The fileName vector is filled with the path and names of files to process.\n\t *\n\t * @param directory\t\tThe path of the directory to be processed.\n\t * @param wildcard\t\tThe wildcard to be processed (e.g. *.cpp).\n\t * @param filenam\t\tAn empty vector which will be filled with the path and names of files to process.\n\t */\n\tvoid getFileNames ( const string &directory,const string &wildcard, vector<string> &fileName )\n\t{\n\t\tvector<string> subDirectory;    // sub directories of directory\n\t\tWIN32_FIND_DATA FindFileData;   // for FindFirstFile and FindNextFile\n\n\t\t// Find the first file in the directory\n\t\tstring firstFile = directory + \"\\\\*\";\n\t\tHANDLE hFind = FindFirstFile ( firstFile.c_str(), &FindFileData );\n\n\t\tif ( hFind == INVALID_HANDLE_VALUE )\n\t\t\treturn;\n\n\t\t// save files and sub directories\n\t\tdo\n\t\t{\n\t\t\t// skip hidden or read only\n\t\t\tif ( FindFileData.cFileName[0] == '.'\n\t\t\t        || ( FindFileData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN )\n\t\t\t        || ( FindFileData.dwFileAttributes & FILE_ATTRIBUTE_READONLY ) )\n\t\t\t\tcontinue;\n\n\t\t\t// if a sub directory and recursive, save sub directory\n\t\t\tif ( ( FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) && true /*g_isRecursive*/ )\n\t\t\t{\n\t\t\t\tstring subDirectoryPath = directory + pathSeparator + FindFileData.cFileName;\n\t\t\t\tsubDirectory.push_back ( subDirectoryPath );\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// save the file name\n\t\t\tstring filePathName = directory + pathSeparator + FindFileData.cFileName;\n\n\t\t\t// save file name if wildcard match\n\t\t\tif ( wildcmp ( wildcard.c_str(), FindFileData.cFileName ) )\n\t\t\t{\n\t\t\t\tfileName.push_back ( filePathName );\n\t\t\t}\n\t\t}\n\t\twhile ( FindNextFile ( hFind, &FindFileData ) != 0 );\n\n\t\t// check for processing error\n\t\tFindClose ( hFind );\n\t\tDWORD dwError = GetLastError();\n\t\tif ( dwError != ERROR_NO_MORE_FILES )\n\t\t\treturn;\n\n\t\t// recurse into sub directories\n\t\t// if not doing recursive subDirectory is empty\n\t\tfor ( unsigned i = 0; i < subDirectory.size(); i++ )\n\t\t{\n\t\t\tgetFileNames ( subDirectory[i], wildcard, fileName );\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn;\n\t}\n\n#else  // not _WIN32\n\n\t/**\n\t* LINUX function to resolve wildcards and recurse into sub directories.\n\t* The fileName vector is filled with the path and names of files to process.\n\t*\n\t* @param directory\t\tThe path of the directory to be processed.\n\t* @param wildcard\t\tThe wildcard to be processed (e.g. *.cpp).\n\t* @param filenam\t\tAn empty vector which will be filled with the path and names of files to process.\n\t*/\n\tvoid getFileNames ( const string &directory,const string &wildcard, vector<string> &fileName )\n\t{\n\t\tstruct dirent *entry;           // entry from readdir()\n\t\tstruct stat statbuf;            // entry from stat()\n\t\tvector<string> subDirectory;    // sub directories of this directory\n\n\t\t// errno is defined in <errno.h> and is set for errors in opendir, readdir, or stat\n\t\terrno = 0;\n\n\t\tDIR *dp = opendir ( directory.c_str() );\n\t\tif ( errno ) return;\n\t\t\n\t\t// save the first fileName entry for this recursion\n\t\tconst unsigned firstEntry = fileName.size();\n\n\t\t// save files and sub directories\n\t\twhile ( ( entry = readdir ( dp ) ) != NULL )\n\t\t{\n\t\t\t// get file status\n\t\t\tstring entryFilepath = directory + pathSeparator + entry->d_name;\n\t\t\tstat ( entryFilepath.c_str(), &statbuf );\n\t\t\tif ( errno ) return;\n\n\t\t\t// skip hidden or read only\n\t\t\tif ( entry->d_name[0] == '.' || ! ( statbuf.st_mode & S_IWUSR ) )\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t// if a sub directory and recursive, save sub directory\n\t\t\tif ( S_ISDIR ( statbuf.st_mode ) && /*g_isRecursive*/ true ) ///TODO\n\t\t\t{\n\t\t\t\tsubDirectory.push_back ( entryFilepath );\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// if a file, save file name\n\t\t\tif ( S_ISREG ( statbuf.st_mode ) )\n\t\t\t{\n\t\t\t\t// save file name if wildcard match\n\t\t\t\tif ( wildcmp ( wildcard.c_str(), entry->d_name ) )\n\t\t\t\t{\n\t\t\t\t\tfileName.push_back ( entryFilepath );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tclosedir ( dp );\n\n\t\tif ( errno ) return;\n\n\t\t// sort the current entries for fileName\n\t\tif ( firstEntry < fileName.size() )\n\t\t\tsort ( &fileName[firstEntry], &fileName[fileName.size() ] );\n\n\t\t// recurse into sub directories\n\t\t// if not doing recursive, subDirectory is empty\n\t\tif ( subDirectory.size() > 1 )\n\t\t\tsort ( subDirectory.begin(), subDirectory.end() );\n\t\tfor ( unsigned i = 0; i < subDirectory.size(); i++ )\n\t\t{\n\t\t\tgetFileNames ( subDirectory[i], wildcard, fileName );\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn;\n\t}\n\n#endif\n\n// From The Code Project http://www.codeproject.com/string/wildcmp.asp\n// Written by Jack Handy - jakkhandy@hotmail.com\n// Modified to compare case insensitive for Windows (the LC macro)\n\tint wildcmp ( const char *wild, const char *data )\n\t{\n\t\tconst char *cp = NULL, *mp = NULL;\n\t\tbool cmpval;\n\n\t\twhile ( ( *data ) && ( *wild != '*' ) )\n\t\t{\n#ifdef _WIN32\n\t\t\tcmpval = ( tolower ( *wild ) != tolower ( *data ) ) && ( *wild != '?' );\n#else\n\t\t\tcmpval = ( *wild != *data ) && ( *wild != '?' );\n#endif\n\n\t\t\tif ( cmpval )\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\twild++;\n\t\t\tdata++;\n\t\t}\n\n\t\twhile ( *data )\n\t\t{\n\t\t\tif ( *wild == '*' )\n\t\t\t{\n\t\t\t\tif ( !*++wild )\n\t\t\t\t{\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\tmp = wild;\n\t\t\t\tcp = data+1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n#ifdef _WIN32\n\t\t\t\tcmpval = ( tolower ( *wild ) == tolower ( *data ) || ( *wild == '?' ) );\n#else\n\t\t\t\tcmpval = ( *wild == *data ) || ( *wild == '?' );\n#endif\n\n\t\t\t\tif ( cmpval )\n\t\t\t\t{\n\t\t\t\t\twild++;\n\t\t\t\t\tdata++;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\twild = mp;\n\t\t\t\t\tdata = cp++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\twhile ( *wild == '*' )\n\t\t{\n\t\t\twild++;\n\t\t}\n\t\treturn !*wild;\n\t}\n\t\n\t\n\tbool fileExists(const string &fName) { \n\t  struct stat fileInfo; \n\t  return !stat(fName.c_str(),&fileInfo); \n\t}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/preformatter.cpp",
    "content": "/***************************************************************************\n                        PreFormatter.cpp  -  description\n                             -------------------\n    begin                : Mo Jan 03 2005\n    copyright            : (C) 2005-2007 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include \"preformatter.h\"\n\n#include <iostream>\n#include \"stringtools.h\"\n\nnamespace highlight\n{\n\n\tconst std::string PreFormatter::LB_CHARS = \" \\t[](){}-+<>.:,;\";\n\tconst std::string PreFormatter::WS_CHARS = \" \\n\\r\\t\";\n\tconst std::string PreFormatter::INDENT_MARKERS = \"{(=\";\n\n\tPreFormatter::PreFormatter() :\n\t\tmaxLineLength ( 80 ),\n\t\tindex ( 0 ),\n\t\tnumberSpaces ( 0 ),\n\t\tlineNumber ( 0 ),\n\t\twsPrefixLength ( string::npos ),\n\t\thasMore ( false ),\n\t\tindentAfterOpenBraces ( true ),\n\t\tredefineWsPrefix ( false ),\n\t\twrapLines ( false ),\n\t\treplaceTabs ( false )\n\t{\n\t}\n\n\tPreFormatter::~PreFormatter()\n\t{\n\t}\n\n\tbool PreFormatter::hasMoreLines()\n\t{\n\t\treturn hasMore;\n\t}\n\n\tbool PreFormatter::indentCode()\n\t{\n\t\treturn indentAfterOpenBraces;\n\t}\n\n\tvoid PreFormatter::setLine ( const std::string& newLine )\n\t{\n\n\t\tline=newLine;\n\n\t\tif ( replaceTabs && numberSpaces )\n\t\t{\n\t\t\tsize_t tabPos=line.find ( '\\t' );\n\t\t\twhile ( tabPos!=string::npos )\n\t\t\t{\n\t\t\t\tline.replace ( tabPos , 1, numberSpaces - ( tabPos % numberSpaces ) , ' ' );\n\t\t\t\ttabPos = line.find ( '\\t', tabPos+1 );\n\t\t\t}\n\t\t}\n\n\t\tif ( wrapLines )\n\t\t{\n\t\t\twsPrefix.clear();\n\t\t\tindex=0;\n\t\t\twsPrefixLength=string::npos;\n\t\t\thasMore=true;\n\t\t\tredefineWsPrefix=false;\n\t\t}\n\t}\n\n\tstd::string PreFormatter::getNextLine()\n\t{\n\n\t\tif ( !wrapLines )\n\t\t{\n\t\t\thasMore = false;\n\t\t\treturn line;\n\t\t}\n\n\t\t++lineNumber;\n\n\t\tif ( !index && line.length() > maxLineLength )   // erster Durchlauf...\n\t\t{\n\t\t\t// wenn moeglich an oeffnender Klammer oder Geichheitszeichen ausrichten\n\t\t\tif ( indentAfterOpenBraces )\n\t\t\t{\n\t\t\t\twsPrefixLength=line.find_first_of ( INDENT_MARKERS );\n\t\t\t}\n\t\t\t// sonst die Einrckung der Originalzeile beibehalten\n\t\t\tif ( wsPrefixLength==string::npos || wsPrefixLength-index>maxLineLength )\n\t\t\t{\n\t\t\t\twsPrefixLength=line.find_first_not_of ( WS_CHARS );\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// wsPrefix in allen neu umgebrochenen Zeilen durch Spaces ersetzen\n\t\t\t\tredefineWsPrefix=true;\n\t\t\t\t//  Position hinter oeffnende Klammer springen\n\t\t\t\twsPrefixLength=line.find_first_not_of ( WS_CHARS,wsPrefixLength+1 );\n\t\t\t}\n\n\t\t\tif ( wsPrefixLength!=string::npos )\n\t\t\t{\n\t\t\t\tindex = wsPrefixLength;\n\t\t\t\t// Falls Anzahl der Whitespaces am beginn der ersten zeile groesser\n\t\t\t\t// als Max. Zeilenlaenge, Whitespaces verwerfen\n\t\t\t\tif ( wsPrefixLength>maxLineLength )\n\t\t\t\t{\n\t\t\t\t\twsPrefixLength=0;\n\t\t\t\t\treturn string();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\twsPrefix=line.substr ( 0, wsPrefixLength );\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Zeile enthaelt nur Whitespace; verwerfen\n\t\t\telse\n\t\t\t{\n\t\t\t\thasMore= false;\n\t\t\t\treturn string();\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( redefineWsPrefix )\n\t\t\t{\n\t\t\t\twsPrefix.clear();\n\t\t\t\twsPrefix.append ( wsPrefixLength, ' ' );\n\t\t\t}\n\t\t\tredefineWsPrefix=false;\n\t\t}\n\n\t\tstring resultString;\n\n\t\t// Position, ab der rueckwaerts nach Umbruchmglichkeit gesucht wird\n\t\tunsigned int searchEndPos = maxLineLength - wsPrefixLength;\n\n\t\t// letztes Teilstueck der Zeile ausgeben; Parsen beenden\n\t\tif ( line.length()-index < searchEndPos )\n\t\t{\n\t\t\thasMore=false;\n\t\t\tresultString= ( index>0 ) ? wsPrefix + line.substr ( index ) : line.substr ( index );\n\t\t\treturn resultString;\n\t\t}\n\n\t\t// Umbrechposition suchen\n\t\tsize_t lbPos = line.find_last_of ( LB_CHARS, index+searchEndPos );\n\t\tif ( lbPos <= index || lbPos == string::npos )\n\t\t{\n\t\t\t// nichts gefunden, hart umbrechen\n\t\t\tlbPos = index + searchEndPos;\n\t\t}\n\t\t// Einrckung der Originalzeile erhalten\n\t\tresultString+=wsPrefix;\n\t\t// Neue Zeile erzeugen\n\t\tresultString += line.substr ( index, lbPos-index+1 );\n\n\t\t// Whitespace am neuen Zeilenbeginn ignorieren, ausser beim ersten Durchlauf\n\t\tsize_t newIndex=line.find_first_not_of ( WS_CHARS, lbPos+1 );\n\t\tindex= ( newIndex!=string::npos ) ?newIndex:line.length();\n\n\t\thasMore=index!=line.length(); // unnoetigen Leerstring vermeiden\n\n\t\tif ( hasMore ) wrappedLines.insert ( lineNumber ); // diese Zeile wurde umgebrochen\n\n\t\treturn resultString;\n\t}\n\n\tvoid PreFormatter::setWrapLineLength ( unsigned int maxLineLength )\n\t{\n\t\tthis->maxLineLength = maxLineLength;\n\t}\n\tvoid PreFormatter::setWrapIndentBraces ( bool indentAfterOpenBraces )\n\t{\n\t\tthis->indentAfterOpenBraces = indentAfterOpenBraces;\n\t}\n\n\tvoid PreFormatter::setNumberSpaces ( unsigned int num )\n\t{\n\t\tnumberSpaces = num;\n\t}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/rtfgenerator.cpp",
    "content": "/***************************************************************************\n                          rtfcode.cpp  -  description\n                             -------------------\n    begin                : Die Jul 9 2002\n    copyright            : (C) 2002-2007 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include <sstream>\n\n#include \"charcodes.h\"\n#include \"version.h\"\n#include \"rtfgenerator.h\"\n\nusing namespace std;\n\nnamespace highlight\n{\n  \n  \tRtfGenerator::RtfGenerator()\n\t\t\t: CodeGenerator ( RTF ),\n\t\t\tpageSize ( \"a4\" ), // Default: DIN A4\n\t\t\taddCharStyles ( false )\n\t{\n\t\tnewLineTag = \"}\\\\par\\\\pard\\n\\\\cbpat1{\";\n\t\tspacer = \" \";\n\n\t\t// Page dimensions\n\t\tpsMap[\"a3\"] = PageSize ( 16837,23811 );\n\t\tpsMap[\"a4\"] = PageSize ( 11905,16837 );\n\t\tpsMap[\"a5\"] = PageSize ( 8390,11905 );\n\n\t\tpsMap[\"b4\"] = PageSize ( 14173,20012 );\n\t\tpsMap[\"b5\"] = PageSize ( 9977,14173 );\n\t\tpsMap[\"b6\"] = PageSize ( 7086,9977 );\n\n\t\tpsMap[\"letter\"] = PageSize ( 12240,15840 );\n\t\tpsMap[\"legal\"] = PageSize ( 12240,20163 );\n\t}\n\n\tRtfGenerator::~RtfGenerator()\n\t{}\n\n\tstring RtfGenerator::getHeader()\n\t{\n\t\treturn string();\n\t}\n\t\n\tstring RtfGenerator::getAttributes ( const ElementStyle & col )\n\t{\n\t\tstringstream s;\n\t\ts  << \"\\\\red\"<< col.getColour().getRed ( RTF )\n\t\t  << \"\\\\green\"<<col.getColour().getGreen ( RTF )\n\t\t  << \"\\\\blue\"<<col.getColour().getBlue ( RTF )\n\t\t  << \";\";\n\t\t return s.str();\n\t}\n\n\tstring  RtfGenerator::getOpenTag ( int styleNumber,const ElementStyle & elem )\n\t{\n\t\tostringstream s;\n\t\ts << \"{\";\n\t\tif ( addCharStyles )\n\t\t{\n\t\t\ts<<\"\\\\*\\\\cs\"<< ( styleNumber+2 );\n\t\t}\n\t\ts << \"\\\\cf\"<< ( styleNumber+2 ) <<\"{\";\n\n\t\tif ( elem.isBold() ) s << \"\\\\b \";\n\t\tif ( elem.isItalic() ) s << \"\\\\i \";\n\t\tif ( elem.isUnderline() ) s << \"\\\\ul \";\n\t\treturn  s.str();\n\t}\n\n\n\tstring RtfGenerator::getCharStyle ( int styleNumber,const ElementStyle &elem,\n\t                                    const string&styleName )\n\t{\n\t\tostringstream s;\n\t\ts << \"{\\\\*\\\\cs\"<< ( styleNumber+2 ) <<\"\\\\additive\\\\cf\"<< ( styleNumber+2 )\n\t\t  << \"\\\\f1\\\\fs\";\n\t\tint fontSize=0;\n\t\tStringTools::str2num<int> ( fontSize, this->getBaseFontSize(), std::dec );\n\t\ts << ( ( fontSize ) ? fontSize*2: 20 );  // RTF needs double amount\n\t\tif ( elem.isBold() ) s << \"\\\\b\";\n\t\tif ( elem.isItalic() ) s << \"\\\\i\";\n\t\tif ( elem.isUnderline() ) s << \"\\\\ul\";\n\t\ts << \"\\\\sbasedon222\\\\snext0 \"<< styleName << \";}\\n\";\n\t\treturn  s.str();\n\t}\n// {\\*\\cs2\\additive\\cf2\\f1\\fs20\\sbasedon222\\snext0 HL Default;}\n\n\tstring  RtfGenerator::getCloseTag ( const ElementStyle &elem )\n\t{\n\t\tostringstream s;\n\t\tif ( elem.isBold() ) s << \"\\\\b0 \";\n\t\tif ( elem.isItalic() ) s << \"\\\\i0 \";\n\t\tif ( elem.isUnderline() ) s << \"\\\\ul0 \";\n\t\ts << \"}}\";\n\t\treturn  s.str();\n\t}\n\n\n\n\tvoid RtfGenerator::printBody()\n\t{\n\t\t*out << \"{\\\\rtf1\\\\ansi\\\\uc0 \\\\deff1\"\n\t\t      << \"{\\\\fonttbl{\\\\f1\\\\fmodern\\\\fprq1\\\\fcharset0 \" ;\n\t\t*out << this->getBaseFont() ;\n\t\t*out << \";}}\"\n\t\t      << \"{\\\\colortbl;\";\n\n\t\t*out << \"\\\\red\"    << ( docStyle.getBgColour().getRed ( RTF ) );\n\t\t*out << \"\\\\green\"    << ( docStyle.getBgColour().getGreen ( RTF ) );\n\t\t*out << \"\\\\blue\"    << ( docStyle.getBgColour().getBlue ( RTF ) );\n\t\t*out << \";\";\n\n\t\t*out << getAttributes ( docStyle.getDefaultStyle() );\n\n\t\t*out << getAttributes ( docStyle.getStringStyle() );\n\t\t*out << getAttributes ( docStyle.getNumberStyle() );\n\t\t*out << getAttributes ( docStyle.getSingleLineCommentStyle() );\n\n\t\t*out << getAttributes ( docStyle.getCommentStyle() );\n\t\t*out << getAttributes ( docStyle.getEscapeCharStyle() );\n\t\t*out << getAttributes ( docStyle.getPreProcessorStyle() );\n\n\t\t*out << getAttributes ( docStyle.getPreProcStringStyle() );\n\t\t*out << getAttributes ( docStyle.getLineStyle() );\n\t\t*out << getAttributes ( docStyle.getOperatorStyle() );\n\t\t*out << getAttributes ( docStyle.getInterpolationStyle() );\n\n\t\t/* For output formats which can refer to external styles it is more safe\n\t\t   to use the colour theme's keyword class names, since the language\n\t\t   definitions (which may change during a batch conversion) do not have to define\n\t\t   all keyword classes, that are needed to highlight all input files correctly.\n\t\t   It is ok for RTF to use the language definition's class names, because RTF\n\t\t   does not refer to external styles.\n\t\t   We cannot use the theme's class names, because KSIterator returns an\n\t\t   alphabetically ordered list, which is not good because RTF is dependent\n\t\t   on the order. We access the keyword style with an ID, which is calculated\n\t\t   ignoring the alphabetic order.\n\t\t*/\n\t\tvector<string>  keywordClasses = currentSyntax->getKeywordClasses();\n\t\tfor ( unsigned int i=0;i<keywordClasses.size();i++ )\n\t\t{\n\t\t\t*out << getAttributes ( docStyle.getKeywordStyle ( keywordClasses[i] ) );\n\t\t}\n\n\t\t*out << \"}\\n\";\n\n\t\tif ( addCharStyles )\n\t\t{\n\t\t\t*out << \"{\\\\stylesheet{\\n\";\n\t\t\t*out << getCharStyle ( STANDARD, docStyle.getDefaultStyle(), \"HL Default\" );\n\t\t\t*out << getCharStyle ( STRING, docStyle.getStringStyle(), \"HL String\" );\n\t\t\t*out << getCharStyle ( NUMBER, docStyle.getNumberStyle(), \"HL Number\" );\n\t\t\t*out << getCharStyle ( SL_COMMENT, docStyle.getSingleLineCommentStyle(), \"HL SL Comment\" );\n\t\t\t*out << getCharStyle ( ML_COMMENT, docStyle.getCommentStyle(), \"HL ML Comment\" );\n\t\t\t*out << getCharStyle ( ESC_CHAR, docStyle.getEscapeCharStyle(), \"HL Escape Character\" );\n\t\t\t*out << getCharStyle ( DIRECTIVE, docStyle.getPreProcessorStyle(), \"HL Directive\" );\n\t\t\t*out << getCharStyle ( DIRECTIVE_STRING, docStyle.getPreProcStringStyle(), \"HL Directive String\" );\n\t\t\t*out << getCharStyle ( LINENUMBER, docStyle.getLineStyle(), \"HL Line\" );\n\t\t\t*out << getCharStyle ( SYMBOL, docStyle.getOperatorStyle(), \"HL Operator\" );\n\t\t\t*out << getCharStyle ( STRING_INTERPOLATION, docStyle.getInterpolationStyle(), \"HL Interpolation\" );\n\t\t\tchar styleName[20];\n\t\t\tfor ( unsigned int i=0;i<keywordClasses.size();i++ )\n\t\t\t{\n\t\t\t\tsprintf ( styleName, \"HL Keyword %c\", 'A'+i ); //maybe better simple numbering\n\t\t\t\t*out << getCharStyle ( KEYWORD+i, docStyle.getKeywordStyle ( keywordClasses[i] ), string ( styleName ) );\n\t\t\t}\n\t\t\t*out << \"}}\\n\";\n\t\t}\n\n\t\t*out  << \"\\\\paperw\"<< psMap[pageSize].width <<\"\\\\paperh\"<< psMap[pageSize].height\n\t\t      << \"\\\\margl1134\\\\margr1134\\\\margt1134\\\\margb1134\\\\sectd\" // page margins\n\t\t      << \"\\\\plain\\\\f1\\\\fs\" ;  // Font formatting\n\t\tint fontSize=0;\n\t\tStringTools::str2num<int> ( fontSize, this->getBaseFontSize(), std::dec );\n\t\t*out << ( ( fontSize ) ? fontSize*2: 20 );  // RTF needs double amount\n\t\t*out << \"\\n\\\\pard \\\\cbpat1{\";\n\n\t\tprocessRootState();\n\n\t\t*out << \"}}\"<<endl;\n\t}\n\n\tstring RtfGenerator::getFooter()\n\t{\n\t\treturn string();\n\t}\n\n\tvoid RtfGenerator::initOutputTags ( )\n\t{\n\t\topenTags.push_back ( getOpenTag ( STANDARD, docStyle.getDefaultStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( STRING, docStyle.getStringStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( NUMBER, docStyle.getNumberStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( SL_COMMENT, docStyle.getSingleLineCommentStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( ML_COMMENT,docStyle.getCommentStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( ESC_CHAR, docStyle.getEscapeCharStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( DIRECTIVE, docStyle.getPreProcessorStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( DIRECTIVE_STRING, docStyle.getPreProcStringStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( LINENUMBER, docStyle.getLineStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( SYMBOL, docStyle.getOperatorStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( STRING_INTERPOLATION, docStyle.getInterpolationStyle()) );\n\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getDefaultStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getStringStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getNumberStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getSingleLineCommentStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getCommentStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getEscapeCharStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getPreProcessorStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getPreProcStringStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getLineStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getOperatorStyle() ) );\n\t\tcloseTags.push_back ( getCloseTag ( docStyle.getInterpolationStyle() ) );\n\t}\n\n\tstring RtfGenerator::maskCharacter ( unsigned char c )\n\t{\n\t\tswitch ( c )\n\t\t{\n\t\t\tcase '}' :\n\t\t\tcase '{' :\n\t\t\tcase '\\\\' :\n\t\t\t{\n\t\t\t\tstring m ( \"\\\\\" );\n\t\t\t\treturn m += c;\n\t\t\t}\n\t\t\tbreak;\n\t\t\tcase '0':\n\t\t\tcase '1':\n\t\t\tcase '2':\n\t\t\tcase '3':\n\t\t\tcase '4':\n\t\t\tcase '5':\n\t\t\tcase '6':\n\t\t\tcase '7':\n\t\t\tcase '8':\n\t\t\tcase '9':\n\t\t\t{\n\t\t\t\tstring m ( 1, '{' );\n\t\t\t\tm += c;\n\t\t\t\tm += '}';\n\t\t\t\treturn m;\n\t\t\t}\n\t\t\tbreak;\n\n\t\t\tcase AUML_LC:\n\t\t\t\treturn \"\\\\'e4\";\n\t\t\t\tbreak;\n\t\t\tcase OUML_LC:\n\t\t\t\treturn \"\\\\'f6\";\n\t\t\t\tbreak;\n\t\t\tcase UUML_LC:\n\t\t\t\treturn \"\\\\'fc\";\n\t\t\t\tbreak;\n\t\t\tcase AUML_UC:\n\t\t\t\treturn \"\\\\'c4\";\n\t\t\t\tbreak;\n\t\t\tcase OUML_UC:\n\t\t\t\treturn \"\\\\'d6\";\n\t\t\t\tbreak;\n\t\t\tcase UUML_UC:\n\t\t\t\treturn \"\\\\'dc\";\n\t\t\t\tbreak;\n\n\t\t\tcase AACUTE_LC:\n\t\t\t\treturn \"\\\\'e1\";\n\t\t\t\tbreak;\n\t\t\tcase EACUTE_LC:\n\t\t\t\treturn \"\\\\'e9\";\n\t\t\t\tbreak;\n\t\t\tcase OACUTE_LC:\n\t\t\t\treturn \"\\\\'f3\";\n\t\t\t\tbreak;\n\t\t\tcase UACUTE_LC:\n\t\t\t\treturn \"\\\\'fa\";\n\t\t\t\tbreak;\n\n\t\t\tcase AGRAVE_LC:\n\t\t\t\treturn \"\\\\'e0\";\n\t\t\t\tbreak;\n\t\t\tcase EGRAVE_LC:\n\t\t\t\treturn \"\\\\'e8\";\n\t\t\t\tbreak;\n\t\t\tcase OGRAVE_LC:\n\t\t\t\treturn \"\\\\'f2\";\n\t\t\t\tbreak;\n\t\t\tcase UGRAVE_LC:\n\t\t\t\treturn \"\\\\'f9\";\n\t\t\t\tbreak;\n\n\t\t\tcase AACUTE_UC:\n\t\t\t\treturn \"\\\\'c1\";\n\t\t\t\tbreak;\n\t\t\tcase EACUTE_UC:\n\t\t\t\treturn \"\\\\'c9\";\n\t\t\t\tbreak;\n\t\t\tcase OACUTE_UC:\n\t\t\t\treturn \"\\\\'d3\";\n\t\t\t\tbreak;\n\t\t\tcase UACUTE_UC:\n\t\t\t\treturn \"\\\\'da\";\n\t\t\t\tbreak;\n\t\t\tcase AGRAVE_UC:\n\t\t\t\treturn \"\\\\'c0\";\n\t\t\t\tbreak;\n\t\t\tcase EGRAVE_UC:\n\t\t\t\treturn \"\\\\'c8\";\n\t\t\t\tbreak;\n\t\t\tcase OGRAVE_UC:\n\t\t\t\treturn \"\\\\'d2\";\n\t\t\t\tbreak;\n\t\t\tcase UGRAVE_UC:\n\t\t\t\treturn \"\\\\'d9\";\n\t\t\t\tbreak;\n\n\t\t\tcase SZLIG:\n\t\t\t\treturn \"\\\\'df\";\n\t\t\t\tbreak;\n\n\t\t\tdefault :\n\t\t\t\treturn string ( 1, c );\n\t\t}\n\t}\n\n\tstring RtfGenerator::getKeywordOpenTag ( unsigned int styleID )\n\t{\n\t\treturn getOpenTag ( KEYWORD+styleID,\n\t\t                    docStyle.getKeywordStyle ( currentSyntax->getKeywordClasses() [styleID] ) );\n\t}\n\n\tstring RtfGenerator::getKeywordCloseTag ( unsigned int styleID )\n\t{\n\t\treturn getCloseTag ( docStyle.getKeywordStyle ( currentSyntax->getKeywordClasses() [styleID] ) );\n\t}\n\n\tvoid RtfGenerator::setRTFPageSize ( const string & ps )\n\t{\n\t\tif ( psMap.count ( ps ) ) pageSize = ps;\n\t}\n\n\tvoid RtfGenerator::setRTFCharStyles ( bool cs )\n\t{\n\t\taddCharStyles = cs;\n\t}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/stringtools.cpp",
    "content": "/***************************************************************************\n                          stringtools.cpp  -  description\n                             -------------------\n    begin                : Mon Dec 10 2001\n    copyright            : (C) 2001-2010 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include \"stringtools.h\"\n\n// Avoid problems with isspace and UTF-8 characters, use iswspace\n//#include <wctype.h>\n\n\nusing namespace std;\n\nnamespace StringTools\n{\n\n\tstring change_case ( const string & s, const KeywordCase kcase ) throw()\n\t{\n\t\tstring r ( s );\n\t\tswitch ( kcase )\n\t\t{\n\t\t\tcase CASE_UNCHANGED:\n\t\t\t\tbreak;\n\t\t\tcase CASE_CAPITALIZE:\n\t\t\tcase CASE_LOWER:\n\t\t\t\tfor ( unsigned int i = 0; i < r.size(); ++i )\n\t\t\t\t\tr[i] = tolower ( r[i] );\n\t\t\t\tif ( kcase == CASE_CAPITALIZE && r.size() )\n\t\t\t\t\tr[0] = toupper ( r[0] );\n\t\t\t\tbreak;\n\t\t\tcase CASE_UPPER:\n\t\t\t\tfor ( unsigned int i = 0; i < r.size(); ++i )\n\t\t\t\t\tr[i] = toupper ( r[i] );\n\t\t\t\tbreak;\n\t\t}\n\t\treturn r;\n\t}\n\n\n\tstring trimRight ( const string &value )\n\t{\n\t\tstring::size_type where = value.find_last_not_of ( \" \\t\\r\" );\n\n\t\tif ( where == string::npos )\n\t\t\t// string has nothing but space\n\t\t\treturn string();\n\n\t\tif ( where == ( value.length() - 1 ) )\n\t\t\t// string has no trailing space, don't copy its contents\n\t\t\treturn value;\n\n\t\treturn value.substr ( 0, where + 1 );\n\t}\n\n\tstring trim(const string& s)\n\t{\n\t  string str(s);\n\t  string::size_type pos = str.find_last_not_of(' ');\n\t  if(pos != string::npos) {\n\t    str.erase(pos + 1);\n\t    pos = str.find_first_not_of(' ');\n\t    if(pos != string::npos) str.erase(0, pos);\n\t  }\n\t  else str.erase(str.begin(), str.end());\n\t  return str;\n\t}\n\n\tvector<string> splitString ( const string& s, unsigned char delim )\n\t{\n\t\tstring::size_type pos=s.find ( delim ), oldPos=0;\n\t\tvector <string> results;\n\n\t\tif ( pos ==string::npos )\n\t\t{\n\t\t\tif ( !s.empty() ) results.push_back ( s );\n\t\t\treturn results;\n\t\t}\n\n\t\tdo\n\t\t{\n\t\t\tif ( oldPos-pos ) results.push_back ( s.substr ( oldPos, pos-oldPos ) );\n\t\t\toldPos=pos+1;\n\t\t\tpos=s.find ( delim, pos+1 );\n\t\t}\n\t\twhile ( pos!=string::npos );\n\t\tresults.push_back ( s.substr ( oldPos ) );\n\n\t\treturn results;\n\t}\n\n        int calcWeight(const string&s){\n \t\tint sum=0;\n\t\tfor (unsigned int i=0; i<s.size();i++){\n\t\t\tsum+=(i%2)? int(s[i])*3 : int(s[i]);\n\t\t}\n\t\treturn sum;\n\t}\n\n\tstring getPathAcronym(const string&path, char delim) {\n\t  string acronym;\n\t  size_t pos=0;\n\t  while ((pos=path.find(delim, pos))!=string::npos){\n\t    pos++;\n\t    if (pos<path.size() && path[pos]!=delim) {\n\t      acronym+= path[pos];\n\t    }\n\t  }\n\t  if(!acronym.empty()) acronym.replace(acronym.end()-1, acronym.end(), \"_\");\n\t  return acronym;\n      }\n\n}\n"
  },
  {
    "path": "jni/highlight/core/stylecolour.cpp",
    "content": "/***************************************************************************\n                          stylecolour.cpp  -  description\n                             -------------------\n    begin                : Die Nov 5 2002\n    copyright            : (C) 2002 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include \"stylecolour.h\"\n#include \"stringtools.h\"\n\n\n#include <iostream>\n#include <sstream>\n#include <cmath>\n\nusing std::string;\n\nnamespace highlight\n{\n\n\tColour::Colour ( const string & red, const string & green, const string & blue )\n\t{\n\t\tostringstream rgbStream;\n\t\trgbStream << red << \" \" << green << \" \" << blue;\n\t\tsetRGB ( rgbStream.str() );\n\t}\n\n\tColour::Colour()\n\t{\n\t\trgb.iRed = rgb.iGreen = rgb.iBlue = 0;\n\t}\n\n\tColour::Colour ( const string & colourString )\n\t{\n\t\tsetRGB ( colourString );\n\t}\n\n\tvoid Colour::setRGB ( const string & colourString )\n\t{\n\t\tif ( colourString.empty() ) return;\n\n\t\tistringstream valueStream ( colourString.c_str() );\n\t\tstring r, g, b;\n\t\tchar c='\\0';\n\t\tvalueStream >> c;\n\n\t\tif ( c=='#' )\n\t\t{\n\t\t\tstring htmlNotation;\n\t\t\tvalueStream >> htmlNotation;\n\t\t\tif ( htmlNotation.size() < 6 ) return;\n\t\t\tr = htmlNotation.substr ( 0, 2 );\n\t\t\tg = htmlNotation.substr ( 2, 2 );\n\t\t\tb = htmlNotation.substr ( 4, 2 );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvalueStream.putback ( c );\n\t\t\tvalueStream >> r;\n\t\t\tvalueStream >> g;\n\t\t\tvalueStream >> b;\n\t\t}\n\n\t\tStringTools::str2num<int> ( rgb.iRed,   r, std::hex );\n\t\tStringTools::str2num<int> ( rgb.iGreen, g, std::hex );\n\t\tStringTools::str2num<int> ( rgb.iBlue,  b, std::hex );\n\t}\n\n\tvoid Colour::setRed ( const string & red )\n\t{\n\t\tStringTools::str2num<int> ( rgb.iRed, red, std::hex );\n\t}\n\n\tvoid Colour::setGreen ( const string & green )\n\t{\n\t\tStringTools::str2num<int> ( rgb.iGreen, green, std::hex );\n\t}\n\n\tvoid Colour::setBlue ( const string & blue )\n\t{\n\t\tStringTools::str2num<int> ( rgb.iBlue, blue, std::hex );\n\t}\n\n\tstring Colour::getRed ( OutputType type ) const\n\t{\n\t\tswitch ( type )\n\t\t{\n\t\t\tcase RTF:   return int2str ( rgb.iRed, std::dec );\n\t\t\tcase LATEX: return float2str ( ( float ) rgb.iRed / 255 );\n\t\t\tcase TEX:   return float2str ( 1 - ( float ) rgb.iRed / 255 );\n\t\t\tdefault:    return int2str ( rgb.iRed, std::hex );\n\t\t}\n\t}\n\n\tstring Colour::getGreen ( OutputType type ) const \n\t{\n\t\tswitch ( type )\n\t\t{\n\t\t\tcase RTF:   return int2str ( rgb.iGreen, std::dec );\n\t\t\tcase LATEX: return float2str ( ( float ) rgb.iGreen / 255 );\n\t\t\tcase TEX:   return float2str ( 1 - ( float ) rgb.iGreen / 255 );\n\t\t\tdefault:    return int2str ( rgb.iGreen, std::hex );\n\t\t}\n\t}\n\n\tstring Colour::getBlue ( OutputType type ) const\n\t{\n\t\tswitch ( type )\n\t\t{\n\t\t\tcase RTF:   return int2str ( rgb.iBlue, std::dec );\n\t\t\tcase LATEX: return float2str ( ( float ) rgb.iBlue / 255 );\n\t\t\tcase TEX:   return float2str ( 1 - ( float ) rgb.iBlue / 255 );\n\t\t\tdefault:    return int2str ( rgb.iBlue, std::hex );\n\t\t}\n\t}\n\n\n\tstring Colour::int2str ( const int num, std::ios_base& ( *f ) ( std::ios_base& ) ) const\n\t{\n\t\tstd::ostringstream outStream;\n\t\toutStream.width ( 2 );\n\t\toutStream.fill ( '0' );\n\t\toutStream << f << num;\n\n\t\treturn outStream.str();\n\t}\n\n\tstring Colour::float2str ( const double num ) const\n\t{\n\t\tstd::ostringstream outStream;\n\t\toutStream << ( floor ( num * 100 + .5 ) / 100 );\n\n\t\treturn outStream.str();\n\t}\n\n}\n\n"
  },
  {
    "path": "jni/highlight/core/svggenerator.cpp",
    "content": "/***************************************************************************\n                          xmlcode.cpp  -  description\n                             -------------------\n    begin                : Mo 23.06.2008\n    copyright            : (C) 2008 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include <string>\n#include <sstream>\n\n#include \"version.h\"\n#include \"svggenerator.h\"\n\nusing namespace std;\nnamespace highlight\n{\n\n\tSVGGenerator::SVGGenerator()\n\t\t\t: CodeGenerator ( SVG )\n\t{\n\t\tspacer = \" \";\n\t\tnewLineTag = \"\\n\";\n\t\tstyleCommentOpen=\"/*\";\n\t\tstyleCommentClose=\"*/\";\n\t}\n\n\tSVGGenerator::~SVGGenerator() {}\n\n\tvoid SVGGenerator::initOutputTags(){\n\t\topenTags.push_back ( \"\" );\n\t\topenTags.push_back ( getOpenTag ( STY_NAME_STR ) );\n\t\topenTags.push_back ( getOpenTag ( STY_NAME_NUM ) );\n\t\topenTags.push_back ( getOpenTag ( STY_NAME_SLC ) );\n\t\topenTags.push_back ( getOpenTag ( STY_NAME_COM ) );\n\t\topenTags.push_back ( getOpenTag ( STY_NAME_ESC ) );\n\t\topenTags.push_back ( getOpenTag ( STY_NAME_DIR ) );\n\t\topenTags.push_back ( getOpenTag ( STY_NAME_DST ) );\n\t\topenTags.push_back ( getOpenTag ( STY_NAME_LIN ) );\n\t\topenTags.push_back ( getOpenTag ( STY_NAME_SYM ) );\n\t\topenTags.push_back ( getOpenTag ( STY_NAME_IPL ) );\n\n\t\tcloseTags.push_back ( \"\" );\n\t\tfor (unsigned int i=1;i<NUMBER_BUILTIN_STATES; i++ )\n\t\t{\n\t\t\tcloseTags.push_back ( \"</tspan>\" );\n\t\t}\n\t}\n\n\tstring SVGGenerator::getStyleDefinition()\n\t{\n\t\tif ( styleDefinitionCache.empty() )\n\t\t{\n\t\t\tostringstream os;\n\t\t\tif ( includeStyleDef )\n\t\t\t{\n\t\t\t\tos << \"<style type=\\\"text/css\\\">\\n\"\n\t\t\t\t<< \"<![CDATA[\\n\";\n\t\t\t}\n\t\t\tos << \"rect { fill:#\"\n\t\t\t<< ( docStyle.getBgColour().getRed ( SVG ) )\n\t\t\t<< ( docStyle.getBgColour().getGreen ( SVG ) )\n\t\t\t<< ( docStyle.getBgColour().getBlue ( SVG ) )\n\t\t\t<< \"; } \\n\";\n\t\t\tos << \"g { font-size: \" << getBaseFontSize();\n\t\t\tos << \"; font-family: \\\"\" << getBaseFont() << \"\\\"; }\\n\";\n\t\t\tos << getAttributes ( \"text\", docStyle.getDefaultStyle() )\n\t\t\t<< getAttributes ( \"tspan.\"+STY_NAME_NUM, docStyle.getNumberStyle() )\n\t\t\t<< getAttributes ( \"tspan.\"+STY_NAME_ESC, docStyle.getEscapeCharStyle() )\n\t\t\t<< getAttributes ( \"tspan.\"+STY_NAME_STR, docStyle.getStringStyle() )\n\t\t\t<< getAttributes ( \"tspan.\"+STY_NAME_DST, docStyle.getPreProcStringStyle() )\n\t\t\t<< getAttributes ( \"tspan.\"+STY_NAME_SLC, docStyle.getSingleLineCommentStyle() )\n\t\t\t<< getAttributes ( \"tspan.\"+STY_NAME_COM, docStyle.getCommentStyle() )\n\t\t\t<< getAttributes ( \"tspan.\"+STY_NAME_DIR, docStyle.getPreProcessorStyle() )\n\t\t\t<< getAttributes ( \"tspan.\"+STY_NAME_SYM, docStyle.getOperatorStyle() )\n\t\t\t<< getAttributes ( \"tspan.\"+STY_NAME_IPL, docStyle.getInterpolationStyle() )\n\t\t\t<< getAttributes ( \"tspan.\"+STY_NAME_LIN, docStyle.getLineStyle() );\n\n\t\t\tKeywordStyles styles = docStyle.getKeywordStyles();\n\t\t\tfor ( KSIterator it=styles.begin(); it!=styles.end(); it++ )\n\t\t\t{\n\t\t\t\tos << getAttributes ( \"tspan.\"+it->first, it->second );\n\t\t\t}\n\t\t\tif ( includeStyleDef )\n\t\t\t{\n\t\t\t\tos << \"]]>\\n\"\n\t\t\t\t<< \"</style>\";\n\t\t\t}\n\t\t\tstyleDefinitionCache=os.str();\n\t\t}\n\t\treturn styleDefinitionCache;\n\t}\n\n\n\tstring SVGGenerator::getAttributes ( const string & elemName,\n\t                                     const ElementStyle & elem )\n\t{\n\t\tostringstream s;\n\t\tif ( !elemName.empty() )\n\t\t{\n\t\t\ts << /*cssClassName<<\".\"<<*/ elemName<<\" { \";\n\t\t}\n\t\ts << \"fill:#\"\n\t\t<< ( elem.getColour().getRed ( HTML ) )\n\t\t<< ( elem.getColour().getGreen ( HTML ) )\n\t\t<< ( elem.getColour().getBlue ( HTML ) )\n\t\t<< ( elem.isBold() ?     \"; font-weight:bold\" :\"\" )\n\t\t<< ( elem.isItalic() ?   \"; font-style:italic\" :\"\" )\n\t\t<< ( elem.isUnderline() ? \"; text-decoration:underline\" :\"\" );\n\t\tif ( !elemName.empty() )\n\t\t{\n\t\t\ts << \"; }\\n\" ;\n\t\t}\n\t\treturn s.str();\n\t}\n\n\tstring  SVGGenerator::getOpenTag ( const string& styleName )\n\t{\n\t\treturn \"<tspan class=\\\"\"+styleName+\"\\\">\";\n\t}\n\n\tstring SVGGenerator::getHeader()\n\t{\n\t\tostringstream header;\n\t\theader << \"<?xml version=\\\"1.0\\\"\";\n\t\tif ( encodingDefined() )\n\t\t{\n\t\t\theader << \" encoding=\\\"\" << encoding << \"\\\"\";\n\t\t}\n\t\theader << \"?>\\n\";\n\t\tif ( !includeStyleDef )\n\t\t{\n\t\t\theader  << \"<?xml-stylesheet type=\\\"text/css\\\" href=\\\"\"\n\t\t\t<< getStyleOutputPath()\n\t\t\t<< \"\\\"?>\\n\";\n\t\t}\n\t\theader << \"<!DOCTYPE svg PUBLIC \\\"-//W3C//DTD SVG 1.2//EN\\\" \"\n\t\t<< \"\\\"http://www.w3.org/Graphics/SVG/1.2/DTD/svg12.dtd\\\">\\n\";\n\t\theader << \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" version=\\\"1.2\\\" \"\n\t\t<< \"baseProfile=\\\"full\\\" xml:space=\\\"preserve\\\"\";\n\t\tif ( width.size() ) header << \" width=\\\"\"<<width<<\"\\\"\";\n\t\tif ( height.size() ) header << \" height=\\\"\"<<height<<\"\\\"\";\n\t\t//viewBox=\\\"0 0 800 600\\\"\n\t\theader << \">\\n<desc>\" << docTitle << \"</desc>\\n\";\n\t\tif ( includeStyleDef )\n\t\t{\n\t\t\theader << \"<defs>\\n\";\n\t\t\theader << getStyleDefinition();\n\t\t\theader << \"\\n</defs>\\n\";\n\t\t}\n\t\treturn header.str();\n\t}\n\n\tvoid SVGGenerator::printBody()\n\t{\n\t\t*out << \"<g>\\n<rect x=\\\"0\\\" y=\\\"0\\\" width=\\\"100%\\\" height=\\\"100%\\\"/>\"; // rect: background color\n\t\tint fontSize=0;\n\t\tStringTools::str2num<int> ( fontSize, getBaseFontSize(), std::dec );\n\t\t*out << \"\\n<text x=\\\"10\\\" y=\\\"\"<<fontSize*2<<\"\\\">\";\n\t\tprocessRootState();\n\t\t*out << \"</text>\\n</g>\\n\";\n\t}\n\n\n\tstring SVGGenerator::getFooter()\n\t{\n\t\tostringstream os;\n\t\tos <<\"</svg>\\n\";\n\t\tos<< \"<!-- SVG generated by Highlight \"\n\t\t<< HIGHLIGHT_VERSION\n\t\t<< \", \"\n\t\t<< HIGHLIGHT_URL\n\t\t<<\" -->\\n\";\n\t\treturn os.str();\n\t}\n\n\tstring SVGGenerator::maskCharacter ( unsigned  char c )\n\t{\n\t\tswitch ( c )\n\t\t{\n\t\t\tcase '<' :\n\t\t\t\treturn \"&lt;\";\n\t\t\t\tbreak;\n\t\t\tcase '>' :\n\t\t\t\treturn \"&gt;\";\n\t\t\t\tbreak;\n\t\t\tcase '&' :\n\t\t\t\treturn \"&amp;\";\n\t\t\t\tbreak;\n\t\t\tcase '\\\"' :\n\t\t\t\treturn \"&quot;\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn string ( 1, c );\n\t\t}\n\t}\n\n\tstring SVGGenerator::getKeywordOpenTag ( unsigned int styleID )\n\t{\n\t\treturn getOpenTag ( currentSyntax->getKeywordClasses() [styleID] );\n\t}\n\n\tstring SVGGenerator::getKeywordCloseTag ( unsigned int styleID )\n\t{\n\t\treturn \"</tspan>\";\n\t}\n\n\tstring SVGGenerator::getNewLine()\n\t{\n\n\t\tif ( lineNumber>1 )\n\t\t{\n\t\t\tostringstream os;\n\t\t\tint fontSize=0;\n\t\t\tStringTools::str2num<int> ( fontSize, getBaseFontSize(), std::dec );\n\t\t\tos<< \"</text>\\n<text x=\\\"10\\\" y=\\\"\"<< ( lineNumber*fontSize*2 ) <<\"\\\">\";\n\t\t\treturn os.str();\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn \"\";\n\t\t}\n\t}\n\n\tvoid SVGGenerator::setSVGSize ( const string& w, const string& h )\n\t{\n\t\twidth=w;\n\t\theight=h;\n\t}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/syntaxreader.cpp",
    "content": "/***************************************************************************\n                          syntaxreader.cpp  -  description\n                             -------------------\n    begin                : Wed Nov 28 2001\n    copyright            : (C) 2001-2010 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n#include <memory>\n\n#include \"syntaxreader.h\"\n#include \"stringtools.h\"\n#include \"enums.h\"\n\nusing namespace std;\n\nnamespace highlight\n{\n\nconst string SyntaxReader::REGEX_IDENTIFIER =\n    \"[a-zA-Z_]\\\\w*\";\n\nconst string SyntaxReader::REGEX_NUMBER =\n    \"(?:0x|0X)[0-9a-fA-F]+|\\\\d*[\\\\.]?\\\\d+(?:[eE][\\\\-\\\\+]\\\\d+)?[lLuU]*\";\n\nconst string SyntaxReader::REGEX_ESCSEQ =\n    \"\\\\\\\\u[[:xdigit:]]{4}|\\\\\\\\\\\\d{3}|\\\\\\\\x[[:xdigit:]]{2}|\\\\\\\\[ntvbrfa\\\\\\\\\\\\?'\\\"]\";\n    \nEmbedLangDelimMap SyntaxReader::exitDelimiters;\nvector<Diluculum::LuaFunction*> SyntaxReader::pluginChunks;\n\nint RegexElement::instanceCnt=0;\n\n\nint SyntaxReader::luaAddKeyword (lua_State *L) {\n    int retVal=0;\n    if (lua_gettop(L)==2){\n      \tconst char*keyword=lua_tostring(L, 1);\n      \tunsigned int kwgroupID=lua_tonumber(L, 2);\n\tlua_getglobal(L, GLOBAL_INSTANCE_NAME);\n\tSyntaxReader **a=reinterpret_cast<SyntaxReader **>(lua_touserdata(L, 3));\n\tif (*a){\n\t  (*a)->addKeyword(kwgroupID, keyword);\n\t  retVal=1;\n\t}\n    }\n    lua_pushboolean(L, retVal);\n    return 1;\n}\n\nSyntaxReader::SyntaxReader() :\n        ignoreCase ( false ),\n        disableHighlighting ( false ),\n        allowNestedComments ( true ),\n        reformatCode ( false ),\n        rawStringPrefix(0),\n        continuationChar(0),\n        validateStateChangeFct(NULL),\n        decorateFct(NULL),\n        luaState(NULL)\n{\n\n}\n\nSyntaxReader::~SyntaxReader()\n{\n    for ( vector<RegexElement*>::iterator it=regex.begin(); it!=regex.end();it++ )\n    {\n        delete *it;\n    }\n    if (validateStateChangeFct) delete validateStateChangeFct;\n    if (decorateFct) delete decorateFct;\n    if (luaState) delete luaState;\n    for (unsigned int i=0;i<pluginChunks.size();i++){\n      delete pluginChunks[i];\n    }\n    pluginChunks.clear();\n}\n\nint SyntaxReader::isKeyword ( const string &s )\n{\n    return ( s.length() && keywords.count ( s ) ) ? keywords[s] : 0;\n}\n\nvoid SyntaxReader::restoreLangEndDelim(const string& langPath) {\n    //TODO exitDelimiters be left static?\n    if ( !langPath.empty()&& exitDelimiters.count(langPath) )\n    {\n       regex.insert (regex.begin(),1, new RegexElement ( EMBEDDED_CODE_END,EMBEDDED_CODE_END, exitDelimiters[langPath] ) );\n    }\n}\n\nunsigned int SyntaxReader::generateNewKWClass ( const string& newClassName )\n{\n    unsigned int newClassID=0;\n    bool found=false;\n    while (!keywordClasses.empty() && newClassID<keywordClasses.size() && !found )\n    {\n        found = ( newClassName==keywordClasses.at(newClassID++) );\n    }\n    if ( !found )\n    {\n        newClassID++;\n        keywordClasses.push_back ( newClassName );\n    }\n\n    return newClassID;\n}\n\n\nbool SyntaxReader::readFlag(const Diluculum::LuaVariable& var) {\n    if (var.value()==Diluculum::Nil) return false;\n    return var.value().asBoolean();\n}\n\n\nvoid  SyntaxReader::initLuaState(Diluculum::LuaState& ls, const string& langDefPath, const string& pluginReadFilePath, OutputType type ){\n          // initialize Lua state with variables which can be used within scripts\n        string::size_type Pos = langDefPath.find_last_of ( Platform::pathSeparator );\n        ls[\"HL_LANG_DIR\"] =langDefPath.substr ( 0, Pos+1 );\n\n\tls[\"HL_INPUT_FILE\"] = pluginReadFilePath;\n\tls[\"HL_OUTPUT\"] = type;\n\t\n        ls[\"Identifiers\"]=REGEX_IDENTIFIER;\n        ls[\"Digits\"]=REGEX_NUMBER;\n\n\t//nitialize environment for hook functions\n\tls[\"HL_STANDARD\"]=STANDARD;\n\tls[\"HL_STRING\"]=STRING;\n\tls[\"HL_NUMBER\"]=NUMBER;\n\tls[\"HL_LINE_COMMENT\"]=SL_COMMENT;\n\tls[\"HL_BLOCK_COMMENT\"]=ML_COMMENT;\n\tls[\"HL_ESC_SEQ\"]=ESC_CHAR;\n\tls[\"HL_PREPROC\"]=DIRECTIVE;\n\tls[\"HL_PREPROC_STRING\"]=DIRECTIVE_STRING;\n\tls[\"HL_OPERATOR\"]=SYMBOL;\n\tls[\"HL_LINENUMBER\"]=LINENUMBER;\n\tls[\"HL_INTERPOLATION\"]=STRING_INTERPOLATION;\n\tls[\"HL_KEYWORD\"]=KEYWORD;\n\tls[\"HL_STRING_END\"]=STRING_END;\n\tls[\"HL_LINE_COMMENT_END\"]=SL_COMMENT_END;\n\tls[\"HL_BLOCK_COMMENT_END\"]=ML_COMMENT_END;\n\tls[\"HL_ESC_SEQ_END\"]=ESC_CHAR_END;\n\tls[\"HL_PREPROC_END\"]=DIRECTIVE_END;\n\tls[\"HL_OPERATOR_END\"]=SYMBOL_END;\n\tls[\"HL_KEYWORD_END\"]=KEYWORD_END;\n\tls[\"HL_EMBEDDED_CODE_BEGIN\"]=EMBEDDED_CODE_BEGIN;\n\tls[\"HL_EMBEDDED_CODE_END\"]=EMBEDDED_CODE_END;\n\tls[\"HL_IDENTIFIER_BEGIN\"]=IDENTIFIER_BEGIN;\n\tls[\"HL_IDENTIFIER_END\"]=IDENTIFIER_END;\n\tls[\"HL_INTERPOLATION_END\"]=STRING_INTERPOLATION_END;\n\tls[\"HL_UNKNOWN\"]=_UNKNOWN;\n\tls[\"HL_FORMAT_HTML\"]=HTML;\n\tls[\"HL_FORMAT_XHTML\"]=XHTML;\n\tls[\"HL_FORMAT_TEX\"]=TEX;\n\tls[\"HL_FORMAT_LATEX\"]=LATEX;\n\tls[\"HL_FORMAT_RTF\"]=RTF;\n\tls[\"HL_FORMAT_ANSI\"]=ANSI;\n\tls[\"HL_FORMAT_XTERM256\"]=XTERM256;\n\tls[\"HL_FORMAT_HTML32\"]=HTML32;\n\tls[\"HL_FORMAT_SVG\"]=SVG;\n\tls[\"HL_FORMAT_BBCODE\"]=BBCODE;\n\tls[\"HL_FORMAT_PANGO\"]=PANGO;\n\tls[\"HL_FORMAT_ODT\"]=ODTFLAT;\n}\n\n\nvoid SyntaxReader::addKeyword(unsigned int groupID, const string& kw){\n  if (!isKeyword ( kw )){\n    keywords.insert ( make_pair (kw, groupID ) );\n  }\n}\n\nLoadResult SyntaxReader::load ( const string& langDefPath, const string& pluginReadFilePath, OutputType outputType, bool clear )\n{\n\n    currentPath=langDefPath;\n    disableHighlighting=false;\n    \n    #ifndef NACL_BUILD\n    if (!Platform::fileExists(langDefPath)){\n      return LOAD_FAILED;\n    }\n#endif\n\n    try {\n\n\tif (luaState) delete luaState;\n\tluaState=new Diluculum::LuaState();\n\n\tDiluculum::LuaState& ls=*luaState;\n\tinitLuaState(ls, langDefPath, pluginReadFilePath, outputType);\n\n\tlua_register (ls.getState(),\"AddKeyword\",luaAddKeyword);\n\t\n\tSyntaxReader **s = (SyntaxReader **)lua_newuserdata(ls.getState(), sizeof(SyntaxReader *));\n\t*s=this;\n\tlua_setglobal(ls.getState(), GLOBAL_INSTANCE_NAME);\n\n        // ececute script and read values\n        ls.doFile (langDefPath);\n#ifdef NACL_BUILD\n\tls.doString(langDefPath);\n#else\n        ls.doFile (langDefPath);\n#endif\n\n        langDesc = ls[\"Description\"].value().asString();\n\n\tif (pluginChunks.size()){\n\t  Diluculum::LuaValueList params;\n\t  params.push_back(langDesc);\n\t  for (unsigned int i=0;i<pluginChunks.size();i++){\n\t    ls.call(*pluginChunks[i], params, \"syntax user function\");\n\t  }\n\t}\n\n\tDiluculum::LuaValueMap globals = ls.globals();\n\n        ignoreCase=readFlag(ls[\"IgnoreCase\"]);\n        reformatCode=readFlag(ls[\"EnableIndentation\"]);\n        disableHighlighting=readFlag(ls[\"DisableHighlighting\"]);\n\n        int idx=1;\n        int keywordIdx=0;\n        int kwId=0;\n        char kwName[5]={0};\n        while (ls[\"Keywords\"][idx].value() !=Diluculum::Nil) {\n            keywordIdx=ls[\"Keywords\"][idx][\"Id\"].value().asNumber();\n            snprintf(kwName, sizeof(kwName), \"kw%c\", ('a'+keywordIdx-1)); // TODO kwa -> kw1...\n            kwId= generateNewKWClass ( kwName );\n\n            if (ls[\"Keywords\"][idx][\"List\"].value()!=Diluculum::Nil) {\n                int listIdx=1;\n                Diluculum::LuaVariable luaList=ls[\"Keywords\"][idx][\"List\"];\n                while (luaList[listIdx].value()!=Diluculum::Nil) {\n                    keywords.insert ( make_pair ( luaList[listIdx].value().asString(), kwId ) );\n                    ++listIdx;\n                }\n            } else if (ls[\"Keywords\"][idx][\"Regex\"].value()!=Diluculum::Nil) {\n                string reString=StringTools::trim(ls[\"Keywords\"][idx][\"Regex\"].value().asString());\n                int captGroup=-1;\n                if (ls[\"Keywords\"][idx][\"Group\"].value()!=Diluculum::Nil) {\n                    captGroup=ls[\"Keywords\"][idx][\"Group\"].value().asNumber();\n                }\n                regex.push_back ( new RegexElement ( KEYWORD, KEYWORD_END, reString, kwId, captGroup ) );\n            }\n            idx++;\n        }\n\n        if (globals.count(\"Comments\")) {\n\n            int listIdx=1;\n            int openDelimId=0;\n            int closeDelimId=0;\n            while (ls[\"Comments\"][listIdx].value()!=Diluculum::Nil) {\n                if (ls[\"Comments\"][listIdx][\"Block\"].value().asBoolean()) {\n\n                    if (ls[\"Comments\"][listIdx][\"Nested\"].value()!=Diluculum::Nil)\n                        allowNestedComments = ls[\"Comments\"][listIdx][\"Nested\"].value().asBoolean();\n\n                    string openDelim=StringTools::trim(ls[\"Comments\"][listIdx][\"Delimiter\"][1].value().asString());\n\t\t    RegexElement* elem=new RegexElement ( ML_COMMENT,ML_COMMENT_END, openDelim, 0, -1 );\n\t\t    openDelimId=elem->instanceId;\n\t\t    regex.push_back ( elem );\n                    \n                    string closeDelim=StringTools::trim(ls[\"Comments\"][listIdx][\"Delimiter\"][2].value().asString());\n                    \n\t\t    elem= new RegexElement ( ML_COMMENT_END,ML_COMMENT_END, closeDelim, 0, -1 );\n\t\t    closeDelimId=elem->instanceId;\n\t\t    regex.push_back ( elem);\n                    \n                    delimiterDistinct[openDelimId]=openDelim!=closeDelim;\n                    delimiterDistinct[closeDelimId]=openDelim!=closeDelim;\n                    delimIds2[closeDelimId]=openDelimId;\n\n                } else {\n                    regex.push_back ( new RegexElement ( SL_COMMENT, SL_COMMENT_END, StringTools::trim(ls[\"Comments\"][listIdx][\"Delimiter\"][1].value().asString()), 0, -1 ) );\n                }\n                ++listIdx;\n            }\n\n        }\n\n        //move behind comment section because of fortran comments (^cC.*$)\n        string re_digit = StringTools::trim(ls[\"Digits\"].value().asString());\n        string re_identifier= StringTools::trim(ls[\"Identifiers\"].value().asString());\n\n        // insert identifier and number regex after keyword regexes\n        regex.push_back ( new RegexElement ( IDENTIFIER_BEGIN, IDENTIFIER_END,\n                                             re_identifier  ) );\n        regex.push_back ( new RegexElement ( NUMBER, NUMBER_END,\n                                              re_digit  ) );\n\n        if (globals.count(\"Strings\")) {\n\n            if (ls[\"Strings\"][\"RawPrefix\"].value()!=Diluculum::Nil) {\n                rawStringPrefix=ls[\"Strings\"][\"RawPrefix\"].value().asString().at(0);\n            }\n\n            if (ls[\"Strings\"][\"Delimiter\"].value()!=Diluculum::Nil) {\n                \n\t\tRegexElement* elem=new RegexElement ( STRING,STRING_END, StringTools::trim( ls[\"Strings\"][\"Delimiter\"].value().asString()), 0, -1 );\n\t\tdelimiterDistinct[elem->instanceId]=true;\n\t\tregex.push_back (elem );\n            }\n            if (ls[\"Strings\"][\"Interpolation\"].value()!=Diluculum::Nil) {\n\t\tRegexElement* elem=new RegexElement ( STRING_INTERPOLATION, STRING_INTERPOLATION_END, StringTools::trim( ls[\"Strings\"][\"Interpolation\"].value().asString()), 0, -1 );\n\t\tregex.push_back (elem );\n            }\n\n            if (ls[\"Strings\"][\"DelimiterPairs\"].value()!=Diluculum::Nil) {\n\n                int listIdx=1;\n                int openDelimId=0;\n                int closeDelimId=0;\n                while (ls[\"Strings\"][\"DelimiterPairs\"][listIdx].value()!=Diluculum::Nil) {\n\n                    string openDelim=StringTools::trim(ls[\"Strings\"][\"DelimiterPairs\"][listIdx][\"Open\"].value().asString());\n                    \n\t\t    RegexElement* elem =new RegexElement(STRING, STRING_END, openDelim, 0, -1);\n\t\t    openDelimId=elem->instanceId;\n\t\t    regex.push_back( elem );\n                    \n                    string closeDelim=StringTools::trim(ls[\"Strings\"][\"DelimiterPairs\"][listIdx][\"Close\"].value().asString());\n\n\t\t    elem = new RegexElement(STRING_END, STRING_END, closeDelim, 0, -1);\n\t\t    closeDelimId=elem->instanceId;\n\t\t    regex.push_back( elem );\n\n                    delimIds2[closeDelimId]=openDelimId;\n\n\t\t    if (ls[\"Strings\"][\"DelimiterPairs\"][listIdx][\"Raw\"].value()!=Diluculum::Nil){\n\t\t      rawStringOpenDelims[openDelimId]=ls[\"Strings\"][\"DelimiterPairs\"][listIdx][\"Raw\"].value().asBoolean();\n\t\t    }\n\n                    ++listIdx;\n                }\n            }\n\n            string  escRegex=(ls[\"Strings\"][\"Escape\"].value()==Diluculum::Nil)?REGEX_ESCSEQ:ls[\"Strings\"][\"Escape\"].value().asString();\n            \n            regex.push_back ( new RegexElement ( ESC_CHAR,ESC_CHAR_END, StringTools::trim(escRegex), 0, -1 ) );\n            \n        }\n\n        if (globals.count(\"PreProcessor\")) {\n            \n            regex.push_back ( new RegexElement ( DIRECTIVE,DIRECTIVE_END, StringTools::trim(ls[\"PreProcessor\"][\"Prefix\"].value().asString()), 0, -1 ) );\n            \n            if (ls[\"PreProcessor\"][\"Continuation\"].value()!=Diluculum::Nil) {\n                continuationChar=ls[\"PreProcessor\"][\"Continuation\"].value().asString().at(0);\n            }\n        }\n\n        if (globals.count(\"Operators\")) {\n            regex.push_back ( new RegexElement ( SYMBOL,SYMBOL_END, StringTools::trim( ls[\"Operators\"].value().asString()), 0, -1 ) );\n        }\n\n        if (globals.count(\"NestedSections\")) {\n\n            int listIdx=1;\n            while (ls[\"NestedSections\"][listIdx].value()!=Diluculum::Nil) {\n\n                string lang= ls[\"NestedSections\"][listIdx][\"Lang\"].value().asString();\n                string openDelim=StringTools::trim(ls[\"NestedSections\"][listIdx][\"Delimiter\"][1].value().asString());\n                regex.insert(regex.begin(), 1, new RegexElement(EMBEDDED_CODE_BEGIN, EMBEDDED_CODE_BEGIN, openDelim, 0, -1, lang));\n   \n                string closeDelim=StringTools::trim(ls[\"NestedSections\"][listIdx][\"Delimiter\"][2].value().asString());\n                exitDelimiters[getNewPath(lang)] = closeDelim;\n\n                ++listIdx;\n            }\n\n        }\n        \n        if (globals.count(\"HeaderInjection\")) {\n            headerInjection+= ls[\"HeaderInjection\"].value().asString();\n        }\n        \n        if (globals.count(\"FooterInjection\")) {\n            footerInjection+= ls[\"FooterInjection\"].value().asString();\n        }\n\n        // load hook functions\n        if (globals.count(\"OnStateChange\")) {\n            validateStateChangeFct=new Diluculum::LuaFunction(ls[\"OnStateChange\"].value().asFunction());\n        }\n        if (globals.count(\"Decorate\")) {\n            decorateFct=new Diluculum::LuaFunction(ls[\"Decorate\"].value().asFunction());\n        }\n\n    } catch (Diluculum::LuaError err) {\n        luaErrorMsg = string(err.what());\n        return LOAD_FAILED_LUA;\n    }\n    return LOAD_OK;\n}\n\nstring SyntaxReader::getNewPath(const string& lang) {\n    string::size_type Pos = currentPath.find_last_of ( Platform::pathSeparator );\n    return currentPath.substr ( 0, Pos+1 ) + lang + \".lang\";\n}\n\n\nint SyntaxReader::getOpenDelimiterID ( const string& token, State s) {\n    boost::xpressive::smatch what;\n    for (unsigned int i=0; i<getRegexElements().size(); i++ )  {\n        RegexElement *regexElem = getRegexElements() [i];\n        if (regexElem->open==s ) {\n\t  \n\t  if( regex_match( token, what, regexElem->rex ) ){\n\t         return regexElem->instanceId;\n\t  }\n        }\n    }\n    return 0;\n}\n\nbool SyntaxReader::matchesOpenDelimiter ( const string& token, State s, int openDelimId) {\n    boost::xpressive::smatch what;\n    for (unsigned int i=0; i<getRegexElements().size(); i++ )  {\n        RegexElement *regexElem = getRegexElements() [i];\n        if (regexElem->open==s ) {\n\t  \n\t  if( regex_match( token, what, regexElem->rex ) && delimIds2[regexElem->instanceId]==openDelimId){\n\t         return true;\n\t  }\n\n        }\n    }\n    return false;\n}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/texgenerator.cpp",
    "content": "/***************************************************************************\n                          TexGenerator.cpp  -  description\n                             -------------------\n    begin                : Mit Jul 24 2002\n    copyright            : (C) 2002 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include <sstream>\n\n#include \"charcodes.h\"\n#include \"version.h\"\n#include \"texgenerator.h\"\n\nnamespace highlight\n{\n\n\tTexGenerator::TexGenerator()\n\t\t\t: CodeGenerator ( TEX )\n\t{\n\t\t/*This makes TeX to use every par it encounters (the \\\\leavevmode has\n\t\tno effect when TeX is in horizontal mode and when TeX is in vertical\n\t\tmode, it switches it to horizontal mode).*/\n\t\tnewLineTag=\"\\\\leavevmode\\\\par\\n\";\n\n\t\tspacer = \"\\\\ \";\n\t\tmaskWs=true;\n\t\texcludeWs=true;\n\t\tmaskWsBegin = \"{\\\\hlstd\";\n\t\tmaskWsEnd = \"}\";\n\t\tstyleCommentOpen=\"%\";\n\t}\n\n\tTexGenerator::~TexGenerator()\n\t{}\n\n\tvoid TexGenerator::initOutputTags(){\n\t\topenTags.push_back ( \"{\\\\hl\"+STY_NAME_STD+\" \" );\n\t\topenTags.push_back ( \"{\\\\hl\"+STY_NAME_STR+\" \" );\n\t\topenTags.push_back ( \"{\\\\hl\"+STY_NAME_NUM+\" \" );\n\t\topenTags.push_back ( \"{\\\\hl\"+STY_NAME_SLC+\" \" );\n\t\topenTags.push_back ( \"{\\\\hl\"+STY_NAME_COM+\" \" );\n\t\topenTags.push_back ( \"{\\\\hl\"+STY_NAME_ESC+\" \" );\n\t\topenTags.push_back ( \"{\\\\hl\"+STY_NAME_DIR+\" \" );\n\t\topenTags.push_back ( \"{\\\\hl\"+STY_NAME_DST+\" \" );\n\t\topenTags.push_back ( \"{\\\\hl\"+STY_NAME_LIN+\" \" );\n\t\topenTags.push_back ( \"{\\\\hl\"+STY_NAME_SYM+\" \" );\n\t\topenTags.push_back ( \"{\\\\hl\"+STY_NAME_IPL+\" \" );\n\n\t\tfor (unsigned int i=0; i<NUMBER_BUILTIN_STATES; i++ )\n\t\t{\n\t\t\tcloseTags.push_back ( \"}\" );\n\t\t}\n\t}\n\n\tstring TexGenerator::getAttributes ( const string & elemName,const ElementStyle & elem )\n\t{\n\t\tostringstream s;\n\t\ts << \"\\\\def\\\\hl\"\n\t\t  << elemName\n\t\t  << \"{\";\n\t\tif ( elem.isBold() )  s << \"\\\\bf\";\n\t\tif ( elem.isItalic() )  s << \"\\\\it\";\n\t\ts  <<  \"\\\\textColor{\"\n\t\t  << ( elem.getColour().getRed ( TEX ) ) <<\" \"\n\t\t  << ( elem.getColour().getGreen ( TEX ) ) <<\" \"\n\t\t  << ( elem.getColour().getBlue ( TEX ) ) <<\" 0.0}}\\n\";\n\t\treturn  s.str();\n\t}\n\n\tstring TexGenerator::getHeader()\n\t{\n\t\tostringstream os;\n\t\tos << styleCommentOpen\n\t\t<< \" Document title: \" << docTitle << \"\\n\\n\";\n\t\tif ( currentSyntax->highlightingEnabled() )\n\t\t{\n\t\t\tif ( includeStyleDef )\n\t\t\t{\n\t\t\t\tos << getStyleDefinition();\n\t\t\t\tos << CodeGenerator::readUserStyleDef();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tos << \"\\\\input \"\n\t\t\t\t  << getStyleOutputPath()\n\t\t\t\t  << \"\\n\\n\";\n\t\t\t}\n\t\t}\n\n\t\treturn os.str();\n\t}\n\n\tvoid TexGenerator::printBody()\n\t{\n\t\t*out << \"{\\n\\\\\"<<getBaseFont() <<\"\\n\";\n\n\t\tprocessRootState();\n\n\t\t*out << \"}\\n\";\n\t}\n\n\tstring TexGenerator::getFooter()\n\t{\n\t\tostringstream os;\n\t\tos << \"\\\\bye\\n\"\n\t\t  << \"% TeX generated by Highlight \"\n\t\t  << HIGHLIGHT_VERSION\n\t\t  << \", \"\n\t\t  << HIGHLIGHT_URL\n\t\t  << endl;\n\t\treturn os.str();\n\t}\n\n\tstring TexGenerator:: maskCharacter ( unsigned char c )\n\t{\n\t\tswitch ( c )\n\t\t{\n\t\t\tcase '{':\n\t\t\tcase '}':\n\t\t\t{\n\t\t\t\tstring m ( \"$\\\\\" );\n\t\t\t\tm += c;\n\t\t\t\tm += '$';\n\t\t\t\treturn m;\n\t\t\t}\n\t\t\tbreak;\n\t\t\tcase '^':\n\t\t\t\treturn \"{\\\\bf\\\\^{}}\";\n\t\t\t\tbreak;\n\t\t\tcase '_':\n\t\t\t\treturn \"\\\\_{}\";\n\t\t\t\tbreak;\n\t\t\tcase '&':\n\t\t\tcase '$':\n\t\t\tcase '#':\n\t\t\tcase '%':\n\t\t\t{\n\t\t\t\tstring m ( \"\\\\\" );\n\t\t\t\tm += c;\n\t\t\t\treturn m;\n\t\t\t}\n\t\t\tbreak;\n\t\t\tcase '\\\\':\n\t\t\t\treturn \"$\\\\backslash$\";\n\t\t\t\tbreak;\n\t\t\tcase ' ':\n\t\t\t\treturn spacer;\n\t\t\t\tbreak;\n\t\t\tcase '+':\n\t\t\tcase '-':\n\t\t\tcase '<':\n\t\t\tcase '>':\n\t\t\tcase '=':\n\t\t\t{\n\t\t\t\tstring m ( \"$\\\\mathord{\" );\n\t\t\t\tm += c;\n\t\t\t\tm += \"}$\";\n\t\t\t\treturn m;\n\t\t\t}\n\t\t\tbreak;\n\t\t\tcase AUML_LC:\n\t\t\t\treturn \"\\\\\\\"a\";\n\t\t\t\tbreak;\n\t\t\tcase OUML_LC:\n\t\t\t\treturn \"\\\\\\\"o\";\n\t\t\t\tbreak;\n\t\t\tcase UUML_LC:\n\t\t\t\treturn \"\\\\\\\"u\";\n\t\t\t\tbreak;\n\t\t\tcase AUML_UC:\n\t\t\t\treturn \"\\\\\\\"A\";\n\t\t\t\tbreak;\n\t\t\tcase OUML_UC:\n\t\t\t\treturn \"\\\\\\\"O\";\n\t\t\t\tbreak;\n\t\t\tcase UUML_UC:\n\t\t\t\treturn \"\\\\\\\"U\";\n\t\t\t\tbreak;\n\t\t\tcase AACUTE_LC:\n\t\t\t\treturn \"\\\\'a\";\n\t\t\t\tbreak;\n\t\t\tcase EACUTE_LC:\n\t\t\t\treturn \"\\\\'e\";\n\t\t\t\tbreak;\n\t\t\tcase OACUTE_LC:\n\t\t\t\treturn \"\\\\'o\";\n\t\t\t\tbreak;\n\t\t\tcase UACUTE_LC:\n\t\t\t\treturn \"\\\\'u\";\n\t\t\t\tbreak;\n\t\t\tcase AGRAVE_LC:\n\t\t\t\treturn \"\\\\`a\";\n\t\t\t\tbreak;\n\t\t\tcase EGRAVE_LC:\n\t\t\t\treturn \"\\\\`e\";\n\t\t\t\tbreak;\n\t\t\tcase OGRAVE_LC:\n\t\t\t\treturn \"\\\\`o\";\n\t\t\t\tbreak;\n\t\t\tcase UGRAVE_LC:\n\t\t\t\treturn \"\\\\`u\";\n\t\t\t\tbreak;\n\t\t\tcase AACUTE_UC:\n\t\t\t\treturn \"\\\\'A\";\n\t\t\t\tbreak;\n\t\t\tcase EACUTE_UC:\n\t\t\t\treturn \"\\\\'E\";\n\t\t\t\tbreak;\n\t\t\tcase OACUTE_UC:\n\t\t\t\treturn \"\\\\'O\";\n\t\t\t\tbreak;\n\t\t\tcase UACUTE_UC:\n\t\t\t\treturn \"\\\\'U\";\n\t\t\t\tbreak;\n\t\t\tcase AGRAVE_UC:\n\t\t\t\treturn \"\\\\`A\";\n\t\t\t\tbreak;\n\t\t\tcase EGRAVE_UC:\n\t\t\t\treturn \"\\\\`E\";\n\t\t\t\tbreak;\n\t\t\tcase UGRAVE_UC:\n\t\t\t\treturn \"\\\\`O\";\n\t\t\t\tbreak;\n\t\t\tcase OGRAVE_UC:\n\t\t\t\treturn \"\\\\`U\";\n\t\t\t\tbreak;\n\t\t\tcase SZLIG:\n\t\t\t\treturn \"\\\\ss \";\n\t\t\t\tbreak;\n\n\t\t\tdefault :\n\t\t\t\treturn string ( 1, c );\n\t\t}\n\t}\n\n\tstring TexGenerator::getKeywordOpenTag ( unsigned int styleID )\n\t{\n\t\treturn \"{\\\\hl\"+currentSyntax->getKeywordClasses() [styleID]+\" \";\n\t}\n\n\tstring TexGenerator::getKeywordCloseTag ( unsigned int styleID )\n\t{\n\t\treturn \"}\";\n\t}\n\n\n\tstring TexGenerator::getStyleDefinition()\n\t{\n\t\tif ( styleDefinitionCache.empty() )\n\t\t{\n\t\t\tostringstream os;\n\t\t\tos << getAttributes ( STY_NAME_STD, docStyle.getDefaultStyle() );\n\t\t\tos << getAttributes ( STY_NAME_NUM, docStyle.getNumberStyle() );\n\t\t\tos << getAttributes ( STY_NAME_ESC, docStyle.getEscapeCharStyle() );\n\t\t\tos << getAttributes ( STY_NAME_STR, docStyle.getStringStyle() );\n\t\t\tos << getAttributes ( STY_NAME_DST, docStyle.getPreProcStringStyle() );\n\t\t\tos << getAttributes ( STY_NAME_SLC, docStyle.getSingleLineCommentStyle() );\n\t\t\tos << getAttributes ( STY_NAME_COM, docStyle.getCommentStyle() );\n\t\t\tos << getAttributes ( STY_NAME_DIR, docStyle.getPreProcessorStyle() );\n\t\t\tos << getAttributes ( STY_NAME_LIN, docStyle.getLineStyle() );\n\t\t\tos << getAttributes ( STY_NAME_SYM, docStyle.getOperatorStyle() );\n\t\t\tos << getAttributes ( STY_NAME_IPL, docStyle.getInterpolationStyle() );\n\n\t\t\tKeywordStyles styles = docStyle.getKeywordStyles();\n\t\t\tfor ( KSIterator it=styles.begin(); it!=styles.end(); it++ )\n\t\t\t{\n\t\t\t\tos << getAttributes ( it->first, it->second );\n\t\t\t}\n\n\t\t\tos <<  \"% The special option is not supported by all dvi drivers\\n\"\n\t\t\t<< \"\\\\special{background rgb \"\n\t\t\t<< docStyle.getBgColour().getRed ( LATEX ) << \" \"\n\t\t\t<< docStyle.getBgColour().getGreen ( LATEX ) << \" \"\n\t\t\t<< docStyle.getBgColour().getBlue ( LATEX ) << \"}\";\n\t\t\tos << \"\\n\\\\nopagenumbers\\n\"\n\t\t\t<< \"\\\\input colordvi\\n\";\n\t\t\tstyleDefinitionCache=os.str();\n\t\t}\n\t\treturn styleDefinitionCache;\n\t}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/themereader.cpp",
    "content": "/***************************************************************************\n                          themereader.cpp  -  description\n                             -------------------\n    begin                : Son Nov 10 2002\n    copyright            : (C) 2002-2010 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n#include \"themereader.h\"\n#include <Diluculum/LuaState.hpp>\n#include <sstream>\n\nnamespace highlight\n{\n\nThemeReader::ThemeReader() : fileOK ( false )\n{}\n\nThemeReader::~ThemeReader()\n{\n  for (unsigned int i=0;i<pluginChunks.size();i++){\n      delete pluginChunks[i];\n  }\n\n}\n\n\nvoid ThemeReader::initStyle(ElementStyle& style, const Diluculum::LuaVariable& var) {\n    string styleColor=\"#000000\";\n    bool styleBold=false, styleItalic=false, styleUnderline=false;\n\n    if (var[\"Colour\"].value()!=Diluculum::Nil)\n        styleColor= var[\"Colour\"].value().asString();\n    if (var[\"Bold\"].value()!=Diluculum::Nil)\n        styleBold= var[\"Bold\"].value().asBoolean();\n    if (var[\"Italic\"].value()!=Diluculum::Nil)\n        styleItalic= var[\"Italic\"].value().asBoolean();\n    if (var[\"Underline\"].value()!=Diluculum::Nil)\n        styleUnderline= var[\"Underline\"].value().asBoolean();\n\n    style.setColour(Colour(styleColor));\n    style.setBold(styleBold);\n    style.setItalic(styleItalic);\n    style.setUnderline(styleUnderline);\n}\n\nbool ThemeReader::load ( const string &styleDefinitionPath , OutputType type)\n{\n    try {\n        fileOK=true;\n        Diluculum::LuaState ls;\n\tls[\"HL_FORMAT_HTML\"]=HTML;\n\tls[\"HL_FORMAT_XHTML\"]=XHTML;\n\tls[\"HL_FORMAT_TEX\"]=TEX;\n\tls[\"HL_FORMAT_LATEX\"]=LATEX;\n\tls[\"HL_FORMAT_RTF\"]=RTF;\n\tls[\"HL_FORMAT_ANSI\"]=ANSI;\n\tls[\"HL_FORMAT_XTERM256\"]=XTERM256;\n\tls[\"HL_FORMAT_HTML32\"]=HTML32;\n\tls[\"HL_FORMAT_SVG\"]=SVG;\n\tls[\"HL_FORMAT_BBCODE\"]=BBCODE;\n\tls[\"HL_FORMAT_PANGO\"]=PANGO;\n\tls[\"HL_FORMAT_ODT\"]=ODTFLAT;\n\tls[\"HL_OUTPUT\"] = type;\n\tls.doString(\"Injections={}\");\n\t\n#ifdef NACL_BUILD\n  ls.doString(styleDefinitionPath);\n#else\n\t  ls.doFile (styleDefinitionPath);\n#endif\n      \n\tdesc = ls[\"Description\"].value().asString();\n\n\tif (pluginChunks.size()){\n\t  Diluculum::LuaValueList params;\n\t  params.push_back(desc);\n\t  for (unsigned int i=0;i<pluginChunks.size();i++){\n\t    ls.call(*pluginChunks[i], params, \"theme user function\");\n\t  }\n\t}\n\n        initStyle(canvas, ls[\"Canvas\"]);\n        initStyle(defaultElem, ls[\"Default\"]);\n        initStyle(comment, ls[\"BlockComment\"]);\n        initStyle(slcomment, ls[\"LineComment\"]);\n        initStyle(directive, ls[\"PreProcessor\"]);\n        initStyle(str, ls[\"String\"]);\n        initStyle(escapeChar, ls[\"Escape\"]);\n\tinitStyle(interpolation, ls[\"Interpolation\"]);\n        initStyle(number, ls[\"Number\"]);\n        initStyle(dstr, ls[\"StringPreProc\"]);\n        initStyle(line, ls[\"LineNum\"]);\n        initStyle(operators, ls[\"Operator\"]);\n\n        int idx=1;\n        ElementStyle kwStyle;\n        char kwName[5];\n        while (ls[\"Keywords\"][idx].value() !=Diluculum::Nil) {\n            initStyle(kwStyle, ls[\"Keywords\"][idx]);\n            snprintf(kwName, sizeof(kwName), \"kw%c\", ('a'+idx-1)); // TODO kwa -> kw1...\n            keywordStyles.insert ( make_pair ( string(kwName),kwStyle ));\n            idx++;\n        }\n        \n       idx=1;\n\twhile (ls[\"Injections\"][idx].value() !=Diluculum::Nil) {\n\t  //  injections.push_back (ls[\"Injections\"][idx].value().asString());\n\t  themeInjections +=ls[\"Injections\"][idx].value().asString();\n\t  idx++;\n        }\n\n    } catch (Diluculum::LuaFileError err) {\n        errorMsg = string(err.what());\n        return fileOK=false;\n    } catch (Diluculum::TypeMismatchError err) {\n        errorMsg = string(err.what());\n        return fileOK=false;\n    } catch (Diluculum::LuaSyntaxError err) {\n        errorMsg = \"syntax error: \"+string(err.what());\n        return fileOK=false;\n    }\n\n    return fileOK;\n}\n\nstring ThemeReader::getErrorMessage() const\n{\n    return errorMsg;\n}\n\nColour ThemeReader::getBgColour() const\n{\n    return canvas.getColour();\n}\n\nElementStyle ThemeReader::getDefaultStyle() const\n{\n    return defaultElem;\n}\n\nElementStyle ThemeReader::getCommentStyle() const\n{\n    return comment;\n}\n\nElementStyle ThemeReader::getSingleLineCommentStyle() const\n{\n    return slcomment;\n}\n\nElementStyle ThemeReader::getStringStyle() const\n{\n    return str;\n}\n\nElementStyle ThemeReader::getPreProcStringStyle() const\n{\n    return dstr;\n}\n\nElementStyle ThemeReader::getEscapeCharStyle() const\n{\n    return escapeChar;\n}\n\nElementStyle ThemeReader::getInterpolationStyle() const\n{\n    return interpolation;\n}\n\n\nElementStyle ThemeReader::getNumberStyle() const\n{\n    return number;\n}\n\nElementStyle ThemeReader::getPreProcessorStyle() const\n{\n    return directive;\n}\n\nElementStyle ThemeReader::getLineStyle() const\n{\n    return line;\n}\n\nElementStyle ThemeReader::getOperatorStyle() const\n{\n    return operators;\n}\n\nbool ThemeReader::found () const\n{\n    return fileOK;\n}\n\nElementStyle ThemeReader::getKeywordStyle ( const string &className )\n{\n    if ( !keywordStyles.count ( className ) ) return defaultElem;\n    return keywordStyles[className];\n}\n\nvector <string> ThemeReader::getClassNames() const\n{\n    vector <string> kwClassNames;\n    for ( KSIterator iter = keywordStyles.begin(); iter != keywordStyles.end(); iter++ )\n    {\n        kwClassNames.push_back ( ( *iter ).first );\n    }\n    return kwClassNames;\n}\n\nKeywordStyles ThemeReader::getKeywordStyles() const\n{\n    return keywordStyles;\n}\n\nstring ThemeReader::getInjections() const{\n  return themeInjections;\n}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/xhtmlgenerator.cpp",
    "content": "/***************************************************************************\n                          htmlcode.cpp  -  description\n                             -------------------\n    begin                : Wed Nov 28 2001\n    copyright            : (C) 2001 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include \"xhtmlgenerator.h\"\n\nusing namespace std;\n\nnamespace highlight\n{\n\n\tXHtmlGenerator::XHtmlGenerator ()\n\t{\n\t\tfileSuffix=\".xhtml\";\n\t\tbrTag=\"<br />\";\n\t\thrTag=\"<hr />\";\n\t\tidAttr=\"id\";\n\t\tcssClassName=\"hl\";\n\t}\n\n\tstring XHtmlGenerator::getHeaderStart ( const string &title )\n\t{\n\t\tostringstream header;\n\t\theader << \"<?xml version=\\\"1.0\\\"\";\n\t\tif ( encodingDefined() )\n\t\t{\n\t\t\theader << \" encoding=\\\"\" << encoding << \"\\\"\";\n\t\t}\n\t\theader << \"?>\\n<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.1//EN\\\"\"\n\t\t<< \"  \\\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\\\">\\n\"\n\t\t<< \"<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\n\"\n\t\t<< \"<head>\\n<title>\" << title << \"</title>\\n\";\n\n\t\treturn header.str();\n\t}\n\n\n\tstring XHtmlGenerator::getHeader()\n\t{\n\t\tostringstream os;\n\t\tos << getHeaderStart ( docTitle );\n\n\t\tif ( currentSyntax->highlightingEnabled() )\n\t\t{\n\t\t\tif ( includeStyleDef )\n\t\t\t{\n\t\t\t\tos << \"<style type=\\\"text/css\\\">\\n\";\n\t\t\t\tos << \"<![CDATA[\\n\";\n\t\t\t\tos << getStyleDefinition();\n\t\t\t\tos << CodeGenerator::readUserStyleDef();\n\t\t\t\tos << \"]]>\\n\";\n\t\t\t\tos << \"</style>\\n\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tos << \"<link rel=\\\"stylesheet\\\" type=\\\"text/css\\\" href=\\\"\"\n\t\t\t\t<< getStyleOutputPath()\n\t\t\t\t<< \"\\\"\"\n\t\t\t\t<< \"/\"\n\t\t\t\t<< \">\\n\";\n\t\t\t}\n\t\t}\n\t\tos << \"</head>\\n<body\";\n\t\tif (!cssClassName.empty()) \n\t\t  os << \" class=\\\"\"<<cssClassName<<\"\\\"\";\n\t\tos << \">\\n\";\n\n\t\treturn os.str();\n\t}\n\n}\n"
  },
  {
    "path": "jni/highlight/core/xterm256generator.cpp",
    "content": "/***************************************************************************\n                   xterm256generator.cpp  -  description\n                             -------------------\n    begin                : Oct 13 2006\n    copyright            : (C) 2006 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <sstream>\n\n#include \"xterm256generator.h\"\n#include \"charcodes.h\"\n#include \"version.h\"\n\nusing namespace std;\n\nnamespace highlight\n{\n\tXterm256Generator::Xterm256Generator() : CodeGenerator ( XTERM256 )\n\t{\n\n\t\tnewLineTag = \"\\n\";\n\t\tspacer = \" \";\n\t}\n\n\tXterm256Generator::~Xterm256Generator() {}\n\n\tstring Xterm256Generator::getHeader()\n\t{\n\t\treturn string();\n\t}\n\n\tvoid Xterm256Generator::printBody()\n\t{\n\t\tprocessRootState();\n\t}\n\n\tstring Xterm256Generator::getFooter()\n\t{\n\t\treturn string();\n\t}\n\n\tstring Xterm256Generator::maskCharacter ( unsigned char c )\n\t{\n\t\treturn string ( 1, c );\n\t}\n\n\tvoid Xterm256Generator::initOutputTags ( )\n\t{\n\t\topenTags.push_back ( getOpenTag ( docStyle.getDefaultStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getStringStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getNumberStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getSingleLineCommentStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getCommentStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getEscapeCharStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getPreProcessorStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getPreProcStringStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getLineStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getOperatorStyle() ) );\n\t\topenTags.push_back ( getOpenTag ( docStyle.getInterpolationStyle()) );\n\n\t\tfor (unsigned int i=0;i<NUMBER_BUILTIN_STATES; i++ )\n\t\t{\n\t\t\tcloseTags.push_back ( \"\\033[m\" );\n\t\t}\n\t}\n\n\tstring  Xterm256Generator::getOpenTag ( const ElementStyle &col )\n\t{\n\n\t\tColour c= col.getColour();\n\t\tunsigned char  rgb[3];\n\t\trgb[0] = ( unsigned char ) strtoll ( c.getRed ( HTML ).c_str(), NULL, 16 );\n\t\trgb[1] = ( unsigned char ) strtoll ( c.getGreen ( HTML ).c_str(), NULL, 16 );\n\t\trgb[2] = ( unsigned char ) strtoll ( c.getBlue ( HTML ).c_str(), NULL, 16 );\n\n\t\tostringstream s;\n\t\t//s  << \"\\033[38;5;\"<< ( int ) rgb2xterm ( rgb ) << \"m\";\n\t\ts  << \"\\033[\";\n\n\t\tif ( col.isBold() ) s << \"1;\";\n\t\tif ( col.isItalic() ) s << \"3;\";\n\t\tif ( col.isUnderline() ) s << \"4;\";\n\t\t\n\t\ts << \"38;5;\"<< ( int ) rgb2xterm ( rgb ) << \"m\";\n\t\treturn  s.str();\n\t}\n\n\tstring Xterm256Generator::getKeywordOpenTag ( unsigned int styleID )\n\t{\n\t\treturn getOpenTag ( docStyle.getKeywordStyle ( currentSyntax->getKeywordClasses() [styleID] ) );\n\t}\n\n\tstring Xterm256Generator::getKeywordCloseTag ( unsigned int styleID )\n\t{\n\t\treturn \"\\033[m\";\n\t}\n\n\t/* the following functions are based on Wolfgang Frischs xterm256 converter utility:\n\t   http://frexx.de/xterm-256-notes/\n\t*/\n\n\tvoid Xterm256Generator::xterm2rgb ( unsigned char color, unsigned char* rgb )\n\t{\n\t\t// 16 basic colors\n\t\tif ( color<16 )\n\t\t{\n\t\t\trgb[0] = basic16[color][0];\n\t\t\trgb[1] = basic16[color][1];\n\t\t\trgb[2] = basic16[color][2];\n\t\t}\n\n\t\t// color cube color\n\t\tif ( color>=16 && color<=232 )\n\t\t{\n\t\t\tcolor-=16;\n\t\t\trgb[0] = valuerange[ ( color/36 ) %6];\n\t\t\trgb[1] = valuerange[ ( color/6 ) %6];\n\t\t\trgb[2] = valuerange[color%6];\n\t\t}\n\n\t\t// gray tone\n\t\tif ( color>=233 && color<=253 )\n\t\t{\n\t\t\trgb[0]=rgb[1]=rgb[2] = 8+ ( color-232 ) *0x0a;\n\t\t}\n\t}\n\n\tvoid Xterm256Generator::maketable()\n\t{\n\t\tunsigned char c, rgb[3];\n\t\tfor ( c=0;c<=253;c++ )\n\t\t{\n\t\t\txterm2rgb ( c,rgb );\n\t\t\tcolortable[c][0] = rgb[0];\n\t\t\tcolortable[c][1] = rgb[1];\n\t\t\tcolortable[c][2] = rgb[2];\n\t\t}\n\t}\n\n\tunsigned char Xterm256Generator::rgb2xterm ( unsigned char* rgb )\n\t{\n\t\tunsigned char c, best_match=0;\n\t\tdouble d, smallest_distance;\n\n\t\tif ( !initialized )\n\t\t{\n\t\t\tmaketable();\n\t\t\tinitialized = true;\n\t\t}\n\n\t\tsmallest_distance = 10000000000.0;\n\n\t\tfor ( c=0;c<=253;c++ )\n\t\t{\n\t\t\td = pow ( colortable[c][0]-rgb[0],2.0 ) +\n\t\t\t    pow ( colortable[c][1]-rgb[1],2.0 ) +\n\t\t\t    pow ( colortable[c][2]-rgb[2],2.0 );\n\t\t\tif ( d<smallest_distance )\n\t\t\t{\n\t\t\t\tsmallest_distance = d;\n\t\t\t\tbest_match=c;\n\t\t\t}\n\t\t}\n\t\treturn best_match;\n\t}\n\n\tbool Xterm256Generator::initialized=false;\n\tunsigned char Xterm256Generator::colortable[254][3] = { {0} };\n\n\tconst unsigned char Xterm256Generator::valuerange[] = { 0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF };\n\n\tconst unsigned char Xterm256Generator::basic16[16][3] =\n\t{\n\t\t{ 0x00, 0x00, 0x00 }, // 0\n\t\t{ 0xCD, 0x00, 0x00 }, // 1\n\t\t{ 0x00, 0xCD, 0x00 }, // 2\n\t\t{ 0xCD, 0xCD, 0x00 }, // 3\n\t\t{ 0x00, 0x00, 0xEE }, // 4\n\t\t{ 0xCD, 0x00, 0xCD }, // 5\n\t\t{ 0x00, 0xCD, 0xCD }, // 6\n\t\t{ 0xE5, 0xE5, 0xE5 }, // 7\n\t\t{ 0x7F, 0x7F, 0x7F }, // 8\n\t\t{ 0xFF, 0x00, 0x00 }, // 9\n\t\t{ 0x00, 0xFF, 0x00 }, // 10\n\t\t{ 0xFF, 0xFF, 0x00 }, // 11\n\t\t{ 0x5C, 0x5C, 0xFF }, // 12\n\t\t{ 0xFF, 0x00, 0xFF }, // 13\n\t\t{ 0x00, 0xFF, 0xFF }, // 14\n\t\t{ 0xFF, 0xFF, 0xFF }  // 15\n\t};\n}\n"
  },
  {
    "path": "jni/highlight/gui-qt/highlight-gui.qrc",
    "content": "<RCC>\n    <qresource prefix=\"/\" >\n        <file>highlight.xpm</file>\n        <file>hl_icon2.png</file>\n\t\t<file>file.png</file>\n\t\t<file>plugin.png</file>\n    </qresource>\n</RCC>\n"
  },
  {
    "path": "jni/highlight/gui-qt/highlight.pro",
    "content": "# -------------------------------------------------\r\n# Project created by QtCreator 2009-03-03T22:45:06\r\n# -------------------------------------------------\r\nTARGET = highlight-gui\r\nTEMPLATE = app\r\nINCLUDEPATH += . \\\r\n    ../include\r\nwin32:CONFIG += static\r\n\r\nPRECOMPILED_HEADER = precomp.h\r\nDEFINES += O2 QT\r\nwin32:DESTDIR = ../../\r\nunix:DESTDIR = ../\r\nSOURCES += main.cpp \\\r\n    mainwindow.cpp \\\r\n    io_report.cpp \\\r\n    showtextfile.cpp\r\nHEADERS += mainwindow.h \\\r\n    precomp.h \\\r\n    io_report.h \\\r\n    showtextfile.h\r\nFORMS += mainwindow.ui \\\r\n    io_report.ui \\\r\n    showtextfile.ui\r\nRESOURCES = highlight-gui.qrc\r\nTRANSLATIONS = highlight_de_DE.ts highlight_es_ES.ts highlight_cs_CZ.ts  highlight_zh_CN.ts\r\n\r\nwin32:RC_FILE = highlight-gui.rc\r\nwin32:LIBS += -L../.. -lhighlight\r\nunix:LIBS += -L.. -lhighlight\r\n\r\n# If Lua 5.2 is not default on your system yet you have to omit 5.1 here:\r\nunix {\r\n    LIBS += -llua\r\n    CONFIG += link_pkgconfig\r\n    PKGCONFIG += lua\r\n}\r\n\r\nwin32:QMAKE_POST_LINK = f:/upx/upx.exe --best ../../highlight-gui.exe\r\n\r\n"
  },
  {
    "path": "jni/highlight/gui-qt/highlight.xpm",
    "content": "/* XPM */\nstatic char * highlight_xpm[] = {\n\"48 48 1122 2\",\n\"  \tc None\",\n\". \tc #0C5C92\",\n\"+ \tc #0D5C92\",\n\"@ \tc #0F5F94\",\n\"# \tc #0F5E94\",\n\"$ \tc #126196\",\n\"% \tc #156398\",\n\"& \tc #156498\",\n\"* \tc #18669A\",\n\"= \tc #32728E\",\n\"- \tc #588D93\",\n\"; \tc #62857B\",\n\"> \tc #739482\",\n\", \tc #748D79\",\n\"' \tc #6B7E6D\",\n\") \tc #5F847D\",\n\"! \tc #37616E\",\n\"~ \tc #2A607B\",\n\"{ \tc #196699\",\n\"] \tc #1B689C\",\n\"^ \tc #307799\",\n\"/ \tc #549192\",\n\"( \tc #609C90\",\n\"_ \tc #6AA593\",\n\": \tc #68A696\",\n\"< \tc #629785\",\n\"[ \tc #64937D\",\n\"} \tc #547967\",\n\"| \tc #546B5C\",\n\"1 \tc #53584A\",\n\"2 \tc #515549\",\n\"3 \tc #3E4747\",\n\"4 \tc #2C5F7B\",\n\"5 \tc #1B689B\",\n\"6 \tc #1E6493\",\n\"7 \tc #215E87\",\n\"8 \tc #22547C\",\n\"9 \tc #275276\",\n\"0 \tc #3B5A6F\",\n\"a \tc #3E5770\",\n\"b \tc #3D5568\",\n\"c \tc #365D6D\",\n\"d \tc #1C689A\",\n\"e \tc #1E6B9E\",\n\"f \tc #1E6A9E\",\n\"g \tc #3D8091\",\n\"h \tc #56A29C\",\n\"i \tc #499B92\",\n\"j \tc #5FA290\",\n\"k \tc #609789\",\n\"l \tc #558C7A\",\n\"m \tc #598E79\",\n\"n \tc #546857\",\n\"o \tc #485343\",\n\"p \tc #374A3F\",\n\"q \tc #4C4231\",\n\"r \tc #885229\",\n\"s \tc #A5602A\",\n\"t \tc #452C1C\",\n\"u \tc #2C4156\",\n\"v \tc #395373\",\n\"w \tc #3F526F\",\n\"x \tc #465067\",\n\"y \tc #4E4E5C\",\n\"z \tc #5A5760\",\n\"A \tc #675F5F\",\n\"B \tc #655B59\",\n\"C \tc #5A5751\",\n\"D \tc #406071\",\n\"E \tc #22648B\",\n\"F \tc #216DA0\",\n\"G \tc #448E98\",\n\"H \tc #399EA1\",\n\"I \tc #3C928D\",\n\"J \tc #548378\",\n\"K \tc #54887E\",\n\"L \tc #3F7872\",\n\"M \tc #3E6B63\",\n\"N \tc #404F47\",\n\"O \tc #41363C\",\n\"P \tc #221B20\",\n\"Q \tc #392923\",\n\"R \tc #BD9C6E\",\n\"S \tc #5A321F\",\n\"T \tc #2D1716\",\n\"U \tc #382B30\",\n\"V \tc #504550\",\n\"W \tc #65626C\",\n\"X \tc #726767\",\n\"Y \tc #78655E\",\n\"Z \tc #69574F\",\n\"` \tc #665D54\",\n\" .\tc #3F545E\",\n\"..\tc #285D7D\",\n\"+.\tc #216D9D\",\n\"@.\tc #206DA0\",\n\"#.\tc #246FA2\",\n\"$.\tc #236FA2\",\n\"%.\tc #2470A2\",\n\"&.\tc #2370A2\",\n\"*.\tc #307797\",\n\"=.\tc #498F86\",\n\"-.\tc #3C7777\",\n\";.\tc #497170\",\n\">.\tc #437072\",\n\",.\tc #435559\",\n\"'.\tc #555E59\",\n\").\tc #58665C\",\n\"!.\tc #736852\",\n\"~.\tc #7A5334\",\n\"{.\tc #472815\",\n\"].\tc #331D17\",\n\"^.\tc #674229\",\n\"/.\tc #5F3528\",\n\"(.\tc #513B44\",\n\"_.\tc #463B48\",\n\":.\tc #503A3F\",\n\"<.\tc #604137\",\n\"[.\tc #594133\",\n\"}.\tc #616661\",\n\"|.\tc #38667E\",\n\"1.\tc #256D9A\",\n\"2.\tc #2772A4\",\n\"3.\tc #2672A4\",\n\"4.\tc #2E769D\",\n\"5.\tc #469FA3\",\n\"6.\tc #477B78\",\n\"7.\tc #457073\",\n\"8.\tc #326471\",\n\"9.\tc #4D5156\",\n\"0.\tc #946141\",\n\"a.\tc #AC5D2A\",\n\"b.\tc #CD6F27\",\n\"c.\tc #C36924\",\n\"d.\tc #945C2E\",\n\"e.\tc #574936\",\n\"f.\tc #3C3630\",\n\"g.\tc #3B3933\",\n\"h.\tc #322523\",\n\"i.\tc #746358\",\n\"j.\tc #A99E85\",\n\"k.\tc #C3B997\",\n\"l.\tc #9F967C\",\n\"m.\tc #2C729D\",\n\"n.\tc #2672A3\",\n\"o.\tc #2974A6\",\n\"p.\tc #2974A5\",\n\"q.\tc #2975A6\",\n\"r.\tc #478F95\",\n\"s.\tc #4A7B7C\",\n\"t.\tc #3C6267\",\n\"u.\tc #3F545F\",\n\"v.\tc #737779\",\n\"w.\tc #CABFA8\",\n\"x.\tc #F4CF92\",\n\"y.\tc #C5682A\",\n\"z.\tc #9F4E21\",\n\"A.\tc #52584D\",\n\"B.\tc #254749\",\n\"C.\tc #223F43\",\n\"D.\tc #253A3C\",\n\"E.\tc #3A3B39\",\n\"F.\tc #ADA589\",\n\"G.\tc #DED7AD\",\n\"H.\tc #C5B890\",\n\"I.\tc #877C68\",\n\"J.\tc #4C7386\",\n\"K.\tc #2A74A6\",\n\"L.\tc #2975A5\",\n\"M.\tc #2C77A8\",\n\"N.\tc #2C77A7\",\n\"O.\tc #2E78A7\",\n\"P.\tc #548D85\",\n\"Q.\tc #485657\",\n\"R.\tc #9D9891\",\n\"S.\tc #E0DFD6\",\n\"T.\tc #FCFDF4\",\n\"U.\tc #FAFDF0\",\n\"V.\tc #E8E7D4\",\n\"W.\tc #78715E\",\n\"X.\tc #1F3E48\",\n\"Y.\tc #1B373E\",\n\"Z.\tc #1D363C\",\n\"`.\tc #233437\",\n\" +\tc #343431\",\n\".+\tc #B0A88B\",\n\"++\tc #E6E3B9\",\n\"@+\tc #AF9D7C\",\n\"#+\tc #594E48\",\n\"$+\tc #3A6478\",\n\"%+\tc #2F79A9\",\n\"&+\tc #2F79AA\",\n\"*+\tc #44899D\",\n\"=+\tc #65877E\",\n\"-+\tc #D4D3C3\",\n\";+\tc #F4F3DF\",\n\">+\tc #CFC4A7\",\n\",+\tc #A59174\",\n\"'+\tc #8F7A5E\",\n\")+\tc #3A3839\",\n\"!+\tc #1C2023\",\n\"~+\tc #1A2023\",\n\"{+\tc #161617\",\n\"]+\tc #212120\",\n\"^+\tc #372924\",\n\"/+\tc #69422C\",\n\"(+\tc #BCA88B\",\n\"_+\tc #C1B192\",\n\":+\tc #6C605C\",\n\"<+\tc #455E69\",\n\"[+\tc #327CAB\",\n\"}+\tc #327CAC\",\n\"|+\tc #5B9EAC\",\n\"1+\tc #94B49B\",\n\"2+\tc #8A8F73\",\n\"3+\tc #6E7061\",\n\"4+\tc #474A45\",\n\"5+\tc #353433\",\n\"6+\tc #2C3431\",\n\"7+\tc #32332F\",\n\"8+\tc #303835\",\n\"9+\tc #2A2F2C\",\n\"0+\tc #263535\",\n\"a+\tc #263739\",\n\"b+\tc #3E322A\",\n\"c+\tc #622915\",\n\"d+\tc #632A18\",\n\"e+\tc #653B2D\",\n\"f+\tc #4A3735\",\n\"g+\tc #426780\",\n\"h+\tc #367FAE\",\n\"i+\tc #55A0B6\",\n\"j+\tc #69A59B\",\n\"k+\tc #527E6F\",\n\"l+\tc #446055\",\n\"m+\tc #384741\",\n\"n+\tc #344A43\",\n\"o+\tc #2D3C39\",\n\"p+\tc #333A35\",\n\"q+\tc #293B3A\",\n\"r+\tc #283B3B\",\n\"s+\tc #1D4142\",\n\"t+\tc #22383A\",\n\"u+\tc #274040\",\n\"v+\tc #513122\",\n\"w+\tc #692912\",\n\"x+\tc #5C2715\",\n\"y+\tc #623D2D\",\n\"z+\tc #4C4241\",\n\"A+\tc #387AA2\",\n\"B+\tc #4389B6\",\n\"C+\tc #438AB6\",\n\"D+\tc #4389B7\",\n\"E+\tc #438AB7\",\n\"F+\tc #60A8BE\",\n\"G+\tc #68A49A\",\n\"H+\tc #538373\",\n\"I+\tc #446154\",\n\"J+\tc #416458\",\n\"K+\tc #2F625B\",\n\"L+\tc #265855\",\n\"M+\tc #204E4E\",\n\"N+\tc #21413E\",\n\"O+\tc #405647\",\n\"P+\tc #364238\",\n\"Q+\tc #2D3D37\",\n\"R+\tc #253838\",\n\"S+\tc #283534\",\n\"T+\tc #2C3C3B\",\n\"U+\tc #4A3224\",\n\"V+\tc #672810\",\n\"W+\tc #652B13\",\n\"X+\tc #583022\",\n\"Y+\tc #473129\",\n\"Z+\tc #486D7D\",\n\"`+\tc #5196C0\",\n\" @\tc #5195C0\",\n\".@\tc #6AADC3\",\n\"+@\tc #68B7AE\",\n\"@@\tc #4C8070\",\n\"#@\tc #477666\",\n\"$@\tc #427167\",\n\"%@\tc #306D66\",\n\"&@\tc #255E5D\",\n\"*@\tc #1F5657\",\n\"=@\tc #205559\",\n\"-@\tc #23504E\",\n\";@\tc #477560\",\n\">@\tc #4C6754\",\n\",@\tc #464235\",\n\"'@\tc #303A35\",\n\")@\tc #323C36\",\n\"!@\tc #493E32\",\n\"~@\tc #673219\",\n\"{@\tc #692A10\",\n\"]@\tc #733211\",\n\"^@\tc #633421\",\n\"/@\tc #483129\",\n\"(@\tc #4A6B7C\",\n\"_@\tc #60A1C9\",\n\":@\tc #68ACC9\",\n\"<@\tc #6EB8B4\",\n\"[@\tc #5B9986\",\n\"}@\tc #528374\",\n\"|@\tc #41726C\",\n\"1@\tc #396B65\",\n\"2@\tc #286764\",\n\"3@\tc #226060\",\n\"4@\tc #215E61\",\n\"5@\tc #225356\",\n\"6@\tc #2B5451\",\n\"7@\tc #3E635C\",\n\"8@\tc #466A6A\",\n\"9@\tc #50615A\",\n\"0@\tc #604830\",\n\"a@\tc #5E3821\",\n\"b@\tc #6A3216\",\n\"c@\tc #76300E\",\n\"d@\tc #79320D\",\n\"e@\tc #823B12\",\n\"f@\tc #683318\",\n\"g@\tc #462E24\",\n\"h@\tc #4E6978\",\n\"i@\tc #5FA0C8\",\n\"j@\tc #6DA9CE\",\n\"k@\tc #6DA9CD\",\n\"l@\tc #6FABCC\",\n\"m@\tc #80C5C6\",\n\"n@\tc #5C9480\",\n\"o@\tc #588D7C\",\n\"p@\tc #467970\",\n\"q@\tc #3B726A\",\n\"r@\tc #317570\",\n\"s@\tc #2B6F6C\",\n\"t@\tc #336461\",\n\"u@\tc #2F6C6C\",\n\"v@\tc #396966\",\n\"w@\tc #386B6D\",\n\"x@\tc #3F6A6E\",\n\"y@\tc #49848B\",\n\"z@\tc #605949\",\n\"A@\tc #994B18\",\n\"B@\tc #9A3906\",\n\"C@\tc #843910\",\n\"D@\tc #792D0A\",\n\"E@\tc #93420E\",\n\"F@\tc #8D4213\",\n\"G@\tc #6F3619\",\n\"H@\tc #4E342A\",\n\"I@\tc #54676D\",\n\"J@\tc #6DA8CD\",\n\"K@\tc #7BB0D2\",\n\"L@\tc #75B5B3\",\n\"M@\tc #5C9885\",\n\"N@\tc #5B907C\",\n\"O@\tc #448074\",\n\"P@\tc #548074\",\n\"Q@\tc #3B7971\",\n\"R@\tc #397F7C\",\n\"S@\tc #3D7D79\",\n\"T@\tc #3A736F\",\n\"U@\tc #297172\",\n\"V@\tc #376363\",\n\"W@\tc #477378\",\n\"X@\tc #48767B\",\n\"Y@\tc #586E6B\",\n\"Z@\tc #7C6A4F\",\n\"`@\tc #B6520E\",\n\" #\tc #A63E05\",\n\".#\tc #8A3206\",\n\"+#\tc #873A0C\",\n\"@#\tc #984D18\",\n\"##\tc #A14F18\",\n\"$#\tc #88461E\",\n\"%#\tc #4E3327\",\n\"&#\tc #5E7177\",\n\"*#\tc #7AB0D2\",\n\"=#\tc #7BB1D2\",\n\"-#\tc #88B8D6\",\n\";#\tc #80BACA\",\n\">#\tc #5AA58D\",\n\",#\tc #5A9D8A\",\n\"'#\tc #609484\",\n\")#\tc #508077\",\n\"!#\tc #599086\",\n\"~#\tc #528C82\",\n\"{#\tc #4E8980\",\n\"]#\tc #3A7875\",\n\"^#\tc #266365\",\n\"/#\tc #3B797E\",\n\"(#\tc #517979\",\n\"_#\tc #5F8887\",\n\":#\tc #657369\",\n\"<#\tc #938462\",\n\"[#\tc #C98240\",\n\"}#\tc #D26714\",\n\"|#\tc #B94B06\",\n\"1#\tc #953F0C\",\n\"2#\tc #8B3D0F\",\n\"3#\tc #AF6427\",\n\"4#\tc #AE5D20\",\n\"5#\tc #884A23\",\n\"6#\tc #4B3227\",\n\"7#\tc #7393A0\",\n\"8#\tc #96C0DA\",\n\"9#\tc #95C0D9\",\n\"0#\tc #69B8AF\",\n\"a#\tc #4E9B88\",\n\"b#\tc #53978A\",\n\"c#\tc #59988D\",\n\"d#\tc #56827A\",\n\"e#\tc #5B8B82\",\n\"f#\tc #4D8C83\",\n\"g#\tc #357E81\",\n\"h#\tc #235F65\",\n\"i#\tc #3B7A7B\",\n\"j#\tc #5C8580\",\n\"k#\tc #5D7D7A\",\n\"l#\tc #6B7769\",\n\"m#\tc #A99263\",\n\"n#\tc #D99E4B\",\n\"o#\tc #E68D2A\",\n\"p#\tc #DA6D0F\",\n\"q#\tc #B95108\",\n\"r#\tc #9E4307\",\n\"s#\tc #A65115\",\n\"t#\tc #A8591D\",\n\"u#\tc #AE5E20\",\n\"v#\tc #93532A\",\n\"w#\tc #503F31\",\n\"x#\tc #8EB6CD\",\n\"y#\tc #96BFDA\",\n\"z#\tc #A3C7DE\",\n\"A#\tc #A3C7DF\",\n\"B#\tc #8BC7CA\",\n\"C#\tc #3EA196\",\n\"D#\tc #4B9D92\",\n\"E#\tc #499189\",\n\"F#\tc #568D86\",\n\"G#\tc #4D9189\",\n\"H#\tc #478B83\",\n\"I#\tc #3A807B\",\n\"J#\tc #2D8485\",\n\"K#\tc #36797C\",\n\"L#\tc #588283\",\n\"M#\tc #637F78\",\n\"N#\tc #727664\",\n\"O#\tc #9C8B60\",\n\"P#\tc #DBAE5A\",\n\"Q#\tc #EDA53C\",\n\"R#\tc #E6811B\",\n\"S#\tc #D66609\",\n\"T#\tc #B85109\",\n\"U#\tc #B3530D\",\n\"V#\tc #A54F0F\",\n\"W#\tc #A05921\",\n\"X#\tc #AA5C1D\",\n\"Y#\tc #844D23\",\n\"Z#\tc #676861\",\n\"`#\tc #A2C6DE\",\n\" $\tc #A4C7DE\",\n\".$\tc #B4D1E4\",\n\"+$\tc #B4D0E4\",\n\"@$\tc #B4D1E3\",\n\"#$\tc #ADCDDB\",\n\"$$\tc #68C3C4\",\n\"%$\tc #329B95\",\n\"&$\tc #35918E\",\n\"*$\tc #298585\",\n\"=$\tc #4B8D85\",\n\"-$\tc #338E8D\",\n\";$\tc #348583\",\n\">$\tc #2B8486\",\n\",$\tc #37949B\",\n\"'$\tc #4B7E7A\",\n\")$\tc #5B7D74\",\n\"!$\tc #647C6F\",\n\"~$\tc #837D5D\",\n\"{$\tc #B9985C\",\n\"]$\tc #EAA53C\",\n\"^$\tc #EE9223\",\n\"/$\tc #E8790F\",\n\"($\tc #D66308\",\n\"_$\tc #B74F07\",\n\":$\tc #A84707\",\n\"<$\tc #98490F\",\n\"[$\tc #9E5F27\",\n\"}$\tc #7F4B22\",\n\"|$\tc #614731\",\n\"1$\tc #9FB5BF\",\n\"2$\tc #B4D0E3\",\n\"3$\tc #CEDFEC\",\n\"4$\tc #CDDFEC\",\n\"5$\tc #9FD4D5\",\n\"6$\tc #2DA5AA\",\n\"7$\tc #169DA1\",\n\"8$\tc #257073\",\n\"9$\tc #2D878A\",\n\"0$\tc #2F8085\",\n\"a$\tc #338A8C\",\n\"b$\tc #3099A1\",\n\"c$\tc #48847F\",\n\"d$\tc #597E78\",\n\"e$\tc #447A7B\",\n\"f$\tc #388692\",\n\"g$\tc #5C7E77\",\n\"h$\tc #9B9871\",\n\"i$\tc #DDA246\",\n\"j$\tc #F19C2A\",\n\"k$\tc #EB7B0E\",\n\"l$\tc #E06B07\",\n\"m$\tc #BF4F03\",\n\"n$\tc #AA4A0A\",\n\"o$\tc #91430E\",\n\"p$\tc #A66122\",\n\"q$\tc #975D29\",\n\"r$\tc #5A3B25\",\n\"s$\tc #7B7B6C\",\n\"t$\tc #C9DCE9\",\n\"u$\tc #CEDFEB\",\n\"v$\tc #E9EEF4\",\n\"w$\tc #E8EEF4\",\n\"x$\tc #E9EFF4\",\n\"y$\tc #82C8CB\",\n\"z$\tc #0B9BAA\",\n\"A$\tc #1C7E89\",\n\"B$\tc #55898A\",\n\"C$\tc #1B96A7\",\n\"D$\tc #4099A1\",\n\"E$\tc #3E8088\",\n\"F$\tc #49797D\",\n\"G$\tc #3D848A\",\n\"H$\tc #2B8193\",\n\"I$\tc #3B838C\",\n\"J$\tc #3F7980\",\n\"K$\tc #828467\",\n\"L$\tc #CA974D\",\n\"M$\tc #E99B32\",\n\"N$\tc #F1901E\",\n\"O$\tc #E16D0C\",\n\"P$\tc #CD5C09\",\n\"Q$\tc #B44D07\",\n\"R$\tc #9A4D19\",\n\"S$\tc #A0632E\",\n\"T$\tc #996A40\",\n\"U$\tc #855F3B\",\n\"V$\tc #675B4B\",\n\"W$\tc #D1D9DB\",\n\"X$\tc #8C96A6\",\n\"Y$\tc #99B9C0\",\n\"Z$\tc #5ECAE5\",\n\"`$\tc #5A99A4\",\n\" %\tc #5D9C9F\",\n\".%\tc #508188\",\n\"+%\tc #448C96\",\n\"@%\tc #528A8F\",\n\"#%\tc #3D8F9F\",\n\"$%\tc #418998\",\n\"%%\tc #498B90\",\n\"&%\tc #3E7C81\",\n\"*%\tc #4F7879\",\n\"=%\tc #597B77\",\n\"-%\tc #9C8660\",\n\";%\tc #D9983E\",\n\">%\tc #F39D29\",\n\",%\tc #E7760E\",\n\"'%\tc #C75307\",\n\")%\tc #C0580F\",\n\"!%\tc #A34C10\",\n\"~%\tc #A26333\",\n\"{%\tc #9A6B3D\",\n\"]%\tc #A3733E\",\n\"^%\tc #715332\",\n\"/%\tc #707882\",\n\"(%\tc #8B95A5\",\n\"_%\tc #284B6C\",\n\":%\tc #5BB4C7\",\n\"<%\tc #3CB3D7\",\n\"[%\tc #61999E\",\n\"}%\tc #568588\",\n\"|%\tc #4D9298\",\n\"1%\tc #368496\",\n\"2%\tc #3A8092\",\n\"3%\tc #457B82\",\n\"4%\tc #467C85\",\n\"5%\tc #407E89\",\n\"6%\tc #3A7882\",\n\"7%\tc #43747B\",\n\"8%\tc #4E5951\",\n\"9%\tc #AF8444\",\n\"0%\tc #F8D25D\",\n\"a%\tc #F6961B\",\n\"b%\tc #DA6409\",\n\"c%\tc #B04A0A\",\n\"d%\tc #A1470B\",\n\"e%\tc #9D5928\",\n\"f%\tc #AB8155\",\n\"g%\tc #9A6C3C\",\n\"h%\tc #855C2F\",\n\"i%\tc #4D5B5B\",\n\"j%\tc #284B6B\",\n\"k%\tc #6AACCC\",\n\"l%\tc #6AABCC\",\n\"m%\tc #6AAFC8\",\n\"n%\tc #5DCBE8\",\n\"o%\tc #3BA5CB\",\n\"p%\tc #3F7681\",\n\"q%\tc #579CA3\",\n\"r%\tc #3F8A9C\",\n\"s%\tc #2D879E\",\n\"t%\tc #3B8597\",\n\"u%\tc #488591\",\n\"v%\tc #4A808C\",\n\"w%\tc #4A858D\",\n\"x%\tc #387B87\",\n\"y%\tc #3E6569\",\n\"z%\tc #826539\",\n\"A%\tc #F4DD72\",\n\"B%\tc #FBC342\",\n\"C%\tc #EB7A11\",\n\"D%\tc #C75C0F\",\n\"E%\tc #9F470F\",\n\"F%\tc #A3571C\",\n\"G%\tc #9D6534\",\n\"H%\tc #B1854C\",\n\"I%\tc #78522D\",\n\"J%\tc #586D6F\",\n\"K%\tc #68A9C9\",\n\"L%\tc #81CBEB\",\n\"M%\tc #80CBEC\",\n\"N%\tc #7ED0E1\",\n\"O%\tc #56C9ED\",\n\"P%\tc #3491B4\",\n\"Q%\tc #2696A7\",\n\"R%\tc #569CA5\",\n\"S%\tc #518A94\",\n\"T%\tc #5297A3\",\n\"U%\tc #53909D\",\n\"V%\tc #538B95\",\n\"W%\tc #45838E\",\n\"X%\tc #367C87\",\n\"Y%\tc #476D6F\",\n\"Z%\tc #9B7B40\",\n\"`%\tc #F9D14A\",\n\" &\tc #FCCD49\",\n\".&\tc #F99E20\",\n\"+&\tc #E17113\",\n\"@&\tc #AA5113\",\n\"#&\tc #954C16\",\n\"$&\tc #7B441B\",\n\"%&\tc #996E3E\",\n\"&&\tc #916C40\",\n\"*&\tc #67746D\",\n\"=&\tc #7BC1DF\",\n\"-&\tc #80CBEB\",\n\";&\tc #81CBEC\",\n\">&\tc #8D948C\",\n\",&\tc #87A8AA\",\n\"'&\tc #85BFCD\",\n\")&\tc #83CEEF\",\n\"!&\tc #82DBEA\",\n\"~&\tc #44C6EE\",\n\"{&\tc #2990B4\",\n\"]&\tc #238799\",\n\"^&\tc #3A7D8C\",\n\"/&\tc #4F9DAA\",\n\"(&\tc #4D97A3\",\n\"_&\tc #478E9A\",\n\":&\tc #3E808D\",\n\"<&\tc #38808A\",\n\"[&\tc #4C706B\",\n\"}&\tc #C2923D\",\n\"|&\tc #FBD656\",\n\"1&\tc #FBBC2D\",\n\"2&\tc #FCB52D\",\n\"3&\tc #F38914\",\n\"4&\tc #D26613\",\n\"5&\tc #7F3E18\",\n\"6&\tc #714627\",\n\"7&\tc #553722\",\n\"8&\tc #6E5439\",\n\"9&\tc #789FA8\",\n\"0&\tc #81CAE9\",\n\"a&\tc #83CEEE\",\n\"b&\tc #9D8880\",\n\"c&\tc #9A877C\",\n\"d&\tc #94887E\",\n\"e&\tc #8B9189\",\n\"f&\tc #7CCAD3\",\n\"g&\tc #37B1E1\",\n\"h&\tc #2A809B\",\n\"i&\tc #1F7D90\",\n\"j&\tc #348D9E\",\n\"k&\tc #2791A2\",\n\"l&\tc #2E8D9C\",\n\"m&\tc #2F8190\",\n\"n&\tc #397E85\",\n\"o&\tc #4E6964\",\n\"p&\tc #AB651D\",\n\"q&\tc #FACC3F\",\n\"r&\tc #FBBB2E\",\n\"s&\tc #FCAF20\",\n\"t&\tc #F68C10\",\n\"u&\tc #E06D0E\",\n\"v&\tc #B3520D\",\n\"w&\tc #5A2B19\",\n\"x&\tc #463025\",\n\"y&\tc #58635F\",\n\"z&\tc #71A2B1\",\n\"A&\tc #7BC2E2\",\n\"B&\tc #A59184\",\n\"C&\tc #AC9D91\",\n\"D&\tc #AE9D96\",\n\"E&\tc #A39088\",\n\"F&\tc #81CCDF\",\n\"G&\tc #48B1DD\",\n\"H&\tc #2181A1\",\n\"I&\tc #286877\",\n\"J&\tc #238697\",\n\"K&\tc #2A8290\",\n\"L&\tc #36747C\",\n\"M&\tc #3C686B\",\n\"N&\tc #54453A\",\n\"O&\tc #A8500E\",\n\"P&\tc #F6AE23\",\n\"Q&\tc #FBC333\",\n\"R&\tc #FBA718\",\n\"S&\tc #F99610\",\n\"T&\tc #EA780B\",\n\"U&\tc #CB600D\",\n\"V&\tc #843A0C\",\n\"W&\tc #473021\",\n\"X&\tc #5D7C84\",\n\"Y&\tc #73B4D3\",\n\"Z&\tc #73B5D5\",\n\"`&\tc #C1B398\",\n\" *\tc #C4B9A6\",\n\".*\tc #BEB29E\",\n\"+*\tc #BBB0A1\",\n\"@*\tc #A3BEC1\",\n\"#*\tc #51BFE7\",\n\"$*\tc #287FAD\",\n\"%*\tc #2F596B\",\n\"&*\tc #3E5150\",\n\"**\tc #4C4640\",\n\"=*\tc #564338\",\n\"-*\tc #572D1B\",\n\";*\tc #AE540B\",\n\">*\tc #F3970F\",\n\",*\tc #FCAE16\",\n\"'*\tc #FCAF1E\",\n\")*\tc #FAA119\",\n\"!*\tc #F1860E\",\n\"~*\tc #DC7617\",\n\"{*\tc #AC5C19\",\n\"]*\tc #6E6758\",\n\"^*\tc #6593A4\",\n\"/*\tc #6BA8C7\",\n\"(*\tc #6BA8C8\",\n\"_*\tc #6BA9C8\",\n\":*\tc #D4C7A0\",\n\"<*\tc #D1CAAC\",\n\"[*\tc #CCC5A9\",\n\"}*\tc #CBC4AD\",\n\"|*\tc #BEC9BE\",\n\"1*\tc #57C0E6\",\n\"2*\tc #215384\",\n\"3*\tc #30262D\",\n\"4*\tc #53352B\",\n\"5*\tc #663C2B\",\n\"6*\tc #5F2A16\",\n\"7*\tc #85400E\",\n\"8*\tc #DA8518\",\n\"9*\tc #F6A51B\",\n\"0*\tc #F9A317\",\n\"a*\tc #F8A01A\",\n\"b*\tc #EE9320\",\n\"c*\tc #E18826\",\n\"d*\tc #B35916\",\n\"e*\tc #884729\",\n\"f*\tc #4E565A\",\n\"g*\tc #6298B4\",\n\"h*\tc #639BBB\",\n\"i*\tc #639CBB\",\n\"j*\tc #D4C290\",\n\"k*\tc #D3C59A\",\n\"l*\tc #D2C8A4\",\n\"m*\tc #D2C8A8\",\n\"n*\tc #BDCBB9\",\n\"o*\tc #2B82BB\",\n\"p*\tc #3D414F\",\n\"q*\tc #432924\",\n\"r*\tc #733C1F\",\n\"s*\tc #7A360F\",\n\"t*\tc #95490F\",\n\"u*\tc #713511\",\n\"v*\tc #A26022\",\n\"w*\tc #CE8E31\",\n\"x*\tc #E49224\",\n\"y*\tc #CD7C20\",\n\"z*\tc #B46922\",\n\"A*\tc #93501C\",\n\"B*\tc #87411B\",\n\"C*\tc #EBAF57\",\n\"D*\tc #C17641\",\n\"E*\tc #975A3B\",\n\"F*\tc #7F6050\",\n\"G*\tc #607481\",\n\"H*\tc #5B8FAE\",\n\"I*\tc #BA9D6E\",\n\"J*\tc #C4A673\",\n\"K*\tc #C6AE7E\",\n\"L*\tc #CBB98C\",\n\"M*\tc #8DB2BB\",\n\"N*\tc #3076A0\",\n\"O*\tc #CAAC63\",\n\"P*\tc #CA832D\",\n\"Q*\tc #A2510F\",\n\"R*\tc #9F4E0D\",\n\"S*\tc #854111\",\n\"T*\tc #472F34\",\n\"U*\tc #4D332A\",\n\"V*\tc #663F26\",\n\"W*\tc #89552D\",\n\"X*\tc #A17142\",\n\"Y*\tc #8C5A33\",\n\"Z*\tc #B17648\",\n\"`*\tc #D68D50\",\n\" =\tc #C08C5B\",\n\".=\tc #BA875F\",\n\"+=\tc #B08765\",\n\"@=\tc #9F7354\",\n\"#=\tc #996F59\",\n\"$=\tc #605E61\",\n\"%=\tc #567E99\",\n\"&=\tc #5382A2\",\n\"*=\tc #5382A1\",\n\"==\tc #906D51\",\n\"-=\tc #906E4E\",\n\";=\tc #B09066\",\n\">=\tc #B49467\",\n\",=\tc #61A9C9\",\n\"'=\tc #8A9E91\",\n\")=\tc #E8A840\",\n\"!=\tc #C07424\",\n\"~=\tc #7A3D11\",\n\"{=\tc #8A4F24\",\n\"]=\tc #4E383A\",\n\"^=\tc #524249\",\n\"/=\tc #64473D\",\n\"(=\tc #74513C\",\n\"_=\tc #BB9A66\",\n\":=\tc #CFB17A\",\n\"<=\tc #D0AD76\",\n\"[=\tc #CFAF7E\",\n\"}=\tc #CCAE85\",\n\"|=\tc #88624A\",\n\"1=\tc #A9704F\",\n\"2=\tc #AC6E4C\",\n\"3=\tc #B17858\",\n\"4=\tc #B78968\",\n\"5=\tc #AE927D\",\n\"6=\tc #937A70\",\n\"7=\tc #75767A\",\n\"8=\tc #55748B\",\n\"9=\tc #4C7796\",\n\"0=\tc #516A74\",\n\"a=\tc #516C7D\",\n\"b=\tc #5E7682\",\n\"c=\tc #678580\",\n\"d=\tc #59A1C1\",\n\"e=\tc #C18B44\",\n\"f=\tc #B67029\",\n\"g=\tc #693B1D\",\n\"h=\tc #80583A\",\n\"i=\tc #907051\",\n\"j=\tc #4A3A3B\",\n\"k=\tc #5F4840\",\n\"l=\tc #725644\",\n\"m=\tc #BA9A67\",\n\"n=\tc #D5BB7E\",\n\"o=\tc #D9C289\",\n\"p=\tc #D3B986\",\n\"q=\tc #CFB487\",\n\"r=\tc #B0916F\",\n\"s=\tc #AE7C5A\",\n\"t=\tc #BD8A6C\",\n\"u=\tc #B37D63\",\n\"v=\tc #B48A73\",\n\"w=\tc #B9A692\",\n\"x=\tc #BAA590\",\n\"y=\tc #B29A88\",\n\"z=\tc #A39082\",\n\"A=\tc #877876\",\n\"B=\tc #797C82\",\n\"C=\tc #617889\",\n\"D=\tc #4F738E\",\n\"E=\tc #48708F\",\n\"F=\tc #47708F\",\n\"G=\tc #436887\",\n\"H=\tc #518BA4\",\n\"I=\tc #4D4B47\",\n\"J=\tc #834B1E\",\n\"K=\tc #54473A\",\n\"L=\tc #4B626F\",\n\"M=\tc #50616B\",\n\"N=\tc #5B5E5C\",\n\"O=\tc #58504A\",\n\"P=\tc #47352C\",\n\"Q=\tc #654E3B\",\n\"R=\tc #C29C60\",\n\"S=\tc #CEB074\",\n\"T=\tc #D1BB84\",\n\"U=\tc #D5C28F\",\n\"V=\tc #D8C79A\",\n\"W=\tc #C9AF8E\",\n\"X=\tc #CAB195\",\n\"Y=\tc #C49779\",\n\"Z=\tc #BE8C72\",\n\"`=\tc #CBBEA9\",\n\" -\tc #C3B29F\",\n\".-\tc #C1AC94\",\n\"+-\tc #C3B4A4\",\n\"@-\tc #B6A79B\",\n\"#-\tc #A8968C\",\n\"$-\tc #A28E85\",\n\"%-\tc #9B887F\",\n\"&-\tc #988A83\",\n\"*-\tc #858783\",\n\"=-\tc #6E7C83\",\n\"--\tc #607685\",\n\";-\tc #567284\",\n\">-\tc #476C86\",\n\",-\tc #436888\",\n\"'-\tc #436987\",\n\")-\tc #3E6180\",\n\"!-\tc #41667F\",\n\"~-\tc #49656F\",\n\"{-\tc #4A3121\",\n\"]-\tc #484A4D\",\n\"^-\tc #41627A\",\n\"/-\tc #415666\",\n\"(-\tc #5C5F5A\",\n\"_-\tc #8F7857\",\n\":-\tc #AD895A\",\n\"<-\tc #BB9D6D\",\n\"[-\tc #CEBB8A\",\n\"}-\tc #D4C198\",\n\"|-\tc #D8CBA6\",\n\"1-\tc #D4C8A9\",\n\"2-\tc #D1C7AC\",\n\"3-\tc #D0C4A9\",\n\"4-\tc #CDC2A9\",\n\"5-\tc #D5C6AC\",\n\"6-\tc #CFC3AC\",\n\"7-\tc #CBC6B7\",\n\"8-\tc #C4BAAC\",\n\"9-\tc #B7A595\",\n\"0-\tc #B7A291\",\n\"a-\tc #AF9585\",\n\"b-\tc #A8937C\",\n\"c-\tc #A28E7E\",\n\"d-\tc #A6958B\",\n\"e-\tc #9B8D88\",\n\"f-\tc #87817E\",\n\"g-\tc #6F777A\",\n\"h-\tc #586E7C\",\n\"i-\tc #43637F\",\n\"j-\tc #406280\",\n\"k-\tc #3B5B78\",\n\"l-\tc #3A5979\",\n\"m-\tc #3A5977\",\n\"n-\tc #3C5872\",\n\"o-\tc #3A5A79\",\n\"p-\tc #3A5A78\",\n\"q-\tc #3A5978\",\n\"r-\tc #395A78\",\n\"s-\tc #3B5B79\",\n\"t-\tc #4A6478\",\n\"u-\tc #54626D\",\n\"v-\tc #6D665B\",\n\"w-\tc #937654\",\n\"x-\tc #BCA67B\",\n\"y-\tc #C9B689\",\n\"z-\tc #CBBC91\",\n\"A-\tc #CEC19C\",\n\"B-\tc #D1C7A8\",\n\"C-\tc #D3CAAD\",\n\"D-\tc #D2C3A1\",\n\"E-\tc #CBB89A\",\n\"F-\tc #D0C6AE\",\n\"G-\tc #CBC1AB\",\n\"H-\tc #CBC1AF\",\n\"I-\tc #C6B7A3\",\n\"J-\tc #C1AC96\",\n\"K-\tc #C3B399\",\n\"L-\tc #BDAB96\",\n\"M-\tc #B3A296\",\n\"N-\tc #AE9A8E\",\n\"O-\tc #A58D81\",\n\"P-\tc #A58E82\",\n\"Q-\tc #A38E82\",\n\"R-\tc #9A8C84\",\n\"S-\tc #928D87\",\n\"T-\tc #7F8180\",\n\"U-\tc #6A7780\",\n\"V-\tc #5F707B\",\n\"W-\tc #566B78\",\n\"X-\tc #506878\",\n\"Y-\tc #3C5B78\",\n\"Z-\tc #355271\",\n\"`-\tc #365371\",\n\" ;\tc #4C6271\",\n\".;\tc #858679\",\n\"+;\tc #AC956D\",\n\"@;\tc #A3845D\",\n\"#;\tc #A48864\",\n\"$;\tc #C4B48F\",\n\"%;\tc #D6C9A0\",\n\"&;\tc #D6CBA3\",\n\"*;\tc #DAD1AE\",\n\"=;\tc #D3C6A6\",\n\"-;\tc #D7D0B3\",\n\";;\tc #D7D2B7\",\n\">;\tc #D4CFB8\",\n\",;\tc #CFC2A7\",\n\"';\tc #D6CEB3\",\n\");\tc #D0C4AD\",\n\"!;\tc #C6BDAC\",\n\"~;\tc #C4BDB2\",\n\"{;\tc #C0B3A8\",\n\"];\tc #C0B09F\",\n\"^;\tc #C4B49F\",\n\"/;\tc #BBAA9A\",\n\"(;\tc #B39A88\",\n\"_;\tc #B19E90\",\n\":;\tc #AD9B90\",\n\"<;\tc #AD9D90\",\n\"[;\tc #AB9A8D\",\n\"};\tc #AA9A8B\",\n\"|;\tc #9E9386\",\n\"1;\tc #8E8475\",\n\"2;\tc #897B6D\",\n\"3;\tc #304B6A\",\n\"4;\tc #304B69\",\n\"5;\tc #3A536D\",\n\"6;\tc #5A6A6D\",\n\"7;\tc #787567\",\n\"8;\tc #9F8C6D\",\n\"9;\tc #A28061\",\n\"0;\tc #C6A673\",\n\"a;\tc #CBB080\",\n\"b;\tc #D1BD8C\",\n\"c;\tc #D7C89D\",\n\"d;\tc #D9CEA8\",\n\"e;\tc #DDD8B5\",\n\"f;\tc #E1DAB7\",\n\"g;\tc #E0DAB7\",\n\"h;\tc #DBD5B8\",\n\"i;\tc #D9D4B8\",\n\"j;\tc #D8D1B7\",\n\"k;\tc #CFC1A6\",\n\"l;\tc #D2CAB5\",\n\"m;\tc #D1C5AB\",\n\"n;\tc #CBBEA6\",\n\"o;\tc #C2AC94\",\n\"p;\tc #B8A18E\",\n\"q;\tc #C2B3A0\",\n\"r;\tc #BCAD9C\",\n\"s;\tc #B4A295\",\n\"t;\tc #AF9D8F\",\n\"u;\tc #AC998B\",\n\"v;\tc #2C4362\",\n\"w;\tc #2C4462\",\n\"x;\tc #2E4563\",\n\"y;\tc #4B5E69\",\n\"z;\tc #917962\",\n\"A;\tc #9C7758\",\n\"B;\tc #956B4A\",\n\"C;\tc #B28B5E\",\n\"D;\tc #BB9E71\",\n\"E;\tc #C7AD7E\",\n\"F;\tc #D6C494\",\n\"G;\tc #DFD3A9\",\n\"H;\tc #D9CFA6\",\n\"I;\tc #DCD5B2\",\n\"J;\tc #E1DCB7\",\n\"K;\tc #DBD1AB\",\n\"L;\tc #DFD8B5\",\n\"M;\tc #DACDA6\",\n\"N;\tc #D9D0B2\",\n\"O;\tc #D4C8AA\",\n\"P;\tc #D2C7A9\",\n\"Q;\tc #D1CAB3\",\n\"R;\tc #CAC1AC\",\n\"S;\tc #C0B09E\",\n\"T;\tc #273C5B\",\n\"U;\tc #334761\",\n\"V;\tc #293D5B\",\n\"W;\tc #887862\",\n\"X;\tc #696453\",\n\"Y;\tc #494E4D\",\n\"Z;\tc #48494F\",\n\"`;\tc #5E544F\",\n\" >\tc #866D51\",\n\".>\tc #A38560\",\n\"+>\tc #C7AE7D\",\n\"@>\tc #CFAF78\",\n\"#>\tc #D0B784\",\n\"$>\tc #D6C595\",\n\"%>\tc #D7C99D\",\n\"&>\tc #D2C293\",\n\"*>\tc #D8CA9B\",\n\"=>\tc #D9C99B\",\n\"->\tc #D7C89F\",\n\";>\tc #D9CEA9\",\n\">>\tc #DED5AE\",\n\",>\tc #D7CEAE\",\n\"'>\tc #D7D1B5\",\n\")>\tc #D1C7AD\",\n\"!>\tc #B5A398\",\n\"~>\tc #A69388\",\n\". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . \",\n\". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . \",\n\". . . . + + . + . + + + + + . + . + + + . + . . . . . . + . . . . + + + . + . . + . + . + . . . \",\n\"@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ # @ @ @ @ @ @ # @ @ \",\n\"@ @ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ \",\n\"% % % % % & % % % & % % % % % % % % % % % % % % % % % & & % % % % & % % % % % % % % % % % % % & \",\n\"* * * * * * * * * * * * * * * * * * * * * = - ; > , ' ) ! ~ { * * * * * * * * * * * * * * * * * \",\n\"] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ^ / ( _ : < [ } | 1 2 3 4 5 ] ] ] 6 7 8 9 0 a b c d ] ] ] \",\n\"e e e e e e e e e e e e e e f e e e g h i j k l m n o p q r s t u v w x y z A B C D E e e e e e \",\n\"F F F F F F F F F F F F F F F F F G H I J K L M N O P Q R S T U V W X Y Z `  ...+.F F F F F F @.\",\n\"#.$.%.#.$.%.%.&.%.%.%.%.&.#.$.#.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.&.%.$.%.%.#.&.%.&.&.\",\n\"2.3.2.3.3.3.2.3.3.3.2.3.3.3.3.4.5.6.7.8.9.0.a.b.c.d.e.f.g.h.i.j.k.l.m.3.3.2.n.3.3.3.3.3.n.3.3.n.\",\n\"o.o.o.p.o.o.o.o.o.o.o.o.p.o.q.r.s.t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.o.p.o.o.o.o.o.K.L.o.o.o.o.o.\",\n\"M.M.M.M.N.N.N.M.M.N.N.N.M.M.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. +.+++@+#+$+N.N.M.M.M.M.M.M.M.N.M.N.N.N.N.\",\n\"%+%+%+%+&+%+%+%+&+%+&+%+%+%+*+=+-+;+>+,+'+)+!+~+{+]+^+/+(+_+:+<+%+&+&+%+&+%+&+%+%+&+%+%+%+%+%+%+\",\n\"[+[+}+}+[+[+[+[+[+[+[+[+[+[+|+1+2+3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+\",\n\"h+h+h+h+h+h+h+h+h+h+h+h+h+i+j+k+l+m+n+o+9+p+q+r+s+t+u+v+w+x+y+z+A+h+h+h+h+h+h+h+h+h+h+h+h+h+h+h+\",\n\"B+C+B+D+B+E+D+D+C+B+B+B+F+G+H+I+J+K+L+M+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+B+B+B+D+B+D+B+B+B+D+B+D+B+B+C+\",\n\"`+`+ @`+`+`+`+`+ @ @ @.@+@@@#@$@%@&@*@=@-@;@>@,@'@)@!@~@{@]@^@/@(@ @ @`+`+ @`+`+`+`+ @`+ @ @`+`+\",\n\"_@_@_@_@_@_@_@_@_@_@:@<@[@}@|@1@2@3@4@5@6@7@8@9@0@a@b@c@d@e@f@g@h@i@_@_@_@_@_@_@_@_@_@_@_@_@_@_@\",\n\"j@j@j@j@k@k@j@k@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@C@D@E@F@G@H@I@J@j@j@j@k@k@k@k@k@j@k@k@j@k@k@\",\n\"K@K@K@K@K@K@K@K@K@L@M@N@O@P@Q@R@S@T@U@V@W@X@Y@Z@`@ #.#+#@###$#%#&#*#K@K@K@K@K@=#=#K@K@K@K@K@K@K@\",\n\"-#-#-#-#-#-#-#-#;#>#,#'#)#!#~#{#]#^#/#(#_#:#<#[#}#|#1#2#3#4#5#6#7#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#\",\n\"8#8#8#8#8#8#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#8#8#8#8#8#y#8#8#8#8#8#8#8#8#8#\",\n\"z#z#z#A#z#z#A#B#C#D#E#F#G#H#I#J#K#L#M#N#O#P#Q#R#S#T#U#V#W#X#Y#Z#`#z#z#z#z#z# $z#z#z#z#z#A#A#z#A#\",\n\".$+$@$.$@$.$#$$$%$&$*$=$-$;$>$,$'$)$!$~${$]$^$/$($_$:$<$[$}$|$1$2$.$@$.$.$.$.$.$@$.$@$.$.$2$.$.$\",\n\"3$3$4$3$3$3$5$6$7$8$9$0$a$b$c$d$e$f$g$h$i$j$k$l$m$n$o$p$q$r$s$t$3$3$3$3$3$3$3$3$3$3$u$3$3$3$3$3$\",\n\"v$v$v$v$w$x$y$z$A$B$C$D$E$F$G$H$I$J$K$L$M$N$O$P$Q$R$S$T$U$V$W$w$v$v$v$w$v$v$v$v$v$w$v$v$v$v$v$v$\",\n\"X$X$X$X$X$Y$Z$`$ %.%+%@%#%$%%%&%*%=%-%;%>%,%'%)%!%~%{%]%^%/%(%X$X$X$X$X$X$X$X$X$X$X$X$X$X$X$X$X$\",\n\"_%_%_%_%_%:%<%[%}%|%1%2%3%4%5%6%7%8%9%0%a%b%c%d%e%f%g%h%i%j%_%_%_%_%_%_%_%_%_%_%_%_%_%_%_%_%_%_%\",\n\"k%l%k%k%m%n%o%p%q%r%s%t%u%v%w%x%y%z%A%B%C%D%E%F%G%H%I%J%K%l%k%l%k%k%k%l%k%k%l%k%k%k%k%k%k%k%l%k%\",\n\"L%M%M%M%N%O%P%Q%R%S%T%U%V%W%X%Y%Z%`% &.&+&@&#&$&%&&&*&=&-&L%L%-&-&-&L%-&-&;&L%M%L%;&M%-&M%;&-&M%\",\n\">&,&'&)&!&~&{&]&^&/&(&_&:&<&[&}&|&1&2&3&4&5&6&7&8&9&0&)&)&a&)&a&a&a&)&)&a&)&a&)&a&)&a&)&)&a&a&a&\",\n\"b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z&A&A&A&A&A&A&A&A&A&A&A&A&A&A&A&A&A&A&A&A&A&A&A&\",\n\"B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&Z&\",\n\"`& *.*+*@*#*$*%*&***=*-*;*>*,*'*)*!*~*{*]*^*/*(*_*(*(*(*(*(*_*(*(*(*(*_*(*_*(*(*(*_*(*(*(*_*(*(*\",\n\":*<*[*}*|*1*2*3*4*5*6*7*8*9*0*a*b*c*d*e*f*g*h*h*i*h*i*i*i*i*i*i*i*i*i*i*i*h*i*h*i*i*i*i*i*i*i*i*\",\n\"j*k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*A*B*C*D*E*F*G*H*H*H*H*H*H*H*H*H*H*H*H*H*H*H*H*H*H*H*H*H*H*H*H*\",\n\"I*J*K*L*M*N*O*P*Q*R*S*T*U*V*W*X*Y*Z*`* =.=+=@=#=$=%=&=&=*=*=*=*=*=&=*=&=&=&=&=*=*=&=*=&=*=*=&=*=\",\n\"==-=;=>=,='=)=!=~={=]=^=/=(=_=:=<=[=}=|=1=2=3=4=5=6=7=8=9=9=9=9=9=9=9=9=9=9=9=9=9=9=9=9=9=9=9=9=\",\n\"0=a=b=c=d=e=f=g=h=i=j=k=l=m=n=o=p=q=r=s=t=u=v=w=x=y=z=A=B=C=D=E=E=E=E=E=E=E=F=F=E=F=E=F=E=F=F=E=\",\n\"G=G=G=H=I=J=K=L=M=N=O=P=Q=R=S=T=U=V=W=X=Y=Z=`= -.-+-@-#-$-%-&-*-=---;->-G=G=G=G=G=G=,-,-,-G=G='-\",\n\")-)-!-~-{-]-)-)-)-)-)-^-/-(-_-:-<-[-}-|-1-2-3-4-5-6-7-8-9-0-a-b-c-d-e-f-g-h-i-j-)-)-)-)-)-)-)-)-\",\n\"k-l-k-m-n-o-p-q-o-o-o-p-r-s-t-u-v-w-x-y-z-A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-l-Y-\",\n\"Z-Z-Z-Z-Z-Z-Z-Z-Z-Z-Z-Z-Z-Z-Z-Z-`- ;.;+;@;#;$;%;&;*;=;-;;;>;,;';);!;~;{;];^;/;(;_;:;<;[;};|;1;2;\",\n\"3;3;3;3;4;3;3;3;3;3;3;3;3;3;4;3;3;3;3;5;6;7;8;9;0;a;b;c;d;e;f;g;h;i;j;k;l;m;n;o;p;q;r;s;t;u;|;|;\",\n\"v;v;v;v;v;v;v;v;v;v;v;v;v;v;v;v;v;v;v;v;w;x;y;z;A;B;C;D;E;F;c;G;H;I;J;K;L;M;N;O;P;Q;R;S;|;|;u;|;\",\n\"T;T;T;T;T;T;T;T;T;T;T;T;T;T;T;T;U;T;T;T;T;T;V;W;X;Y;Z;`; >.>+>@>#>$>%>&>*>=>->;>>>,>'>)>'>!>~>|;\"};\n"
  },
  {
    "path": "jni/highlight/gui-qt/highlight_cs_CZ.ts",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE TS>\n<TS version=\"2.0\" language=\"cs_CZ\">\n<context>\n    <name>MainWindow</name>\n    <message>\n        <source>Preview of &quot;%1&quot; not possible.</source>\n        <translation>Náhled na &quot;%1&quot; není možný.</translation>\n    </message>\n    <message>\n        <source>Choose a ctags file</source>\n        <translation type=\"obsolete\">Vyberte soubor ctags</translation>\n    </message>\n    <message>\n        <source>Language definition error</source>\n        <translation>Chyba v určení jazyka</translation>\n    </message>\n    <message>\n        <source>Invalid regular expression in %1:\n%2</source>\n        <translation>Neplatný regulární výraz v %1: %2</translation>\n    </message>\n    <message>\n        <source>Unknown syntax</source>\n        <translation>Neznámá skladba</translation>\n    </message>\n    <message>\n        <source>Output error</source>\n        <translation>Chyba ve výstupu</translation>\n    </message>\n    <message>\n        <source>Could not read tags information in &quot;%1&quot;</source>\n        <translation type=\"obsolete\">Nepodařilo se přečíst informace o značkách v %1</translation>\n    </message>\n    <message>\n        <source>Select one or more plug-ins</source>\n        <translation>Vybrat jeden nebo více přídavných modulů</translation>\n    </message>\n    <message>\n        <source>About providing translations</source>\n        <translation>Poskytnutí překladů</translation>\n    </message>\n    <message>\n        <source>Initialization error</source>\n        <translation>Chyba při započetí</translation>\n    </message>\n    <message>\n        <source>%1 options</source>\n        <translation>%1 volby</translation>\n    </message>\n    <message>\n        <source>Conversion of &quot;%1&quot; not possible.</source>\n        <translation>Převod &quot;%1&quot; se nezdařil.</translation>\n    </message>\n    <message>\n        <source>Select destination directory</source>\n        <translation>Vybrat cílový adresář</translation>\n    </message>\n    <message>\n        <source>Tags file error</source>\n        <translation type=\"obsolete\">Chyba v souboru značek</translation>\n    </message>\n    <message>\n        <source>Current syntax: %1</source>\n        <translation>Současná skladba: %1</translation>\n    </message>\n    <message>\n        <source>clipboard data</source>\n        <translation>Daten ve schránce</translation>\n    </message>\n    <message>\n        <source>Output directory does not exist!</source>\n        <translation>Výstupní adresář neexistuje!</translation>\n    </message>\n    <message>\n        <source>The GUI was developed using the Qt toolkit, and translations may be provided using the tools Qt Linguist and lrelease.\nThe highlight.ts file for Linguist resides in the src/gui-qt subdirectory.\nThe qm file generated by lrelease has to be saved in gui-files/l10n.\n\nPlease send a note to as (at) andre-simon (dot) de if you have issues during translating or if you have finished or updated a translation.</source>\n        <translation>Toto GUI bylo vyvinuto s pomocí sady nástrojů Qt, proto jsou překladové soubory vytvářeny pomocí nástrojů Qt Linguist a lrelease.\nSoubor highlight.ts pro Linguist se nachází v podadresáři src/gui-qt.\nSoubor qm vydávaný lrelease je uložen v gui-files/l10n.\n\nZprávu, prosím, pošlete na adresu elektronické pošty as (at) andre-simon (dot) de, budete-li mít při překladu nějaké potíže nebo když jste nějaký překlad vytvořili nebo zaktualizovali.</translation>\n    </message>\n    <message>\n        <source>Could not convert %1</source>\n        <translation>Nepodařilo se převést %1</translation>\n    </message>\n    <message>\n        <source>Select one or more files to open</source>\n        <translation>Vybrat jeden nebo více souborů k otevření</translation>\n    </message>\n    <message>\n        <source>Choose a style include file</source>\n        <translation>Vyberte vstupní stylový list</translation>\n    </message>\n    <message>\n        <source>Converted %1 files in %2 ms</source>\n        <translation>Převedeno %1 souborů za %2 ms</translation>\n    </message>\n    <message>\n        <source>Preview (%1):</source>\n        <translation>Náhled (%1):</translation>\n    </message>\n    <message>\n        <source>Could not find syntax definitions. Check installation.</source>\n        <translation>Nepodařilo se najít určení skladby.\nPrověřte instalaci.</translation>\n    </message>\n    <message>\n        <source>You must define a style output file!</source>\n        <translation>Musíte určit stylový list k vydání!</translation>\n    </message>\n    <message>\n        <source>Choose a plug-in input file</source>\n        <translation>Vyberte vstupní soubor s přídavným modulem</translation>\n    </message>\n    <message>\n        <source>Lua error</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <source>Could not convert %1:\nLua Syntax error: %2</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n</context>\n<context>\n    <name>MainWindowClass</name>\n    <message>\n        <source>A3</source>\n        <translation>A3</translation>\n    </message>\n    <message>\n        <source>A4</source>\n        <translation>A4</translation>\n    </message>\n    <message>\n        <source>A5</source>\n        <translation>A5</translation>\n    </message>\n    <message>\n        <source>B4</source>\n        <translation>B4</translation>\n    </message>\n    <message>\n        <source>B5</source>\n        <translation>B5</translation>\n    </message>\n    <message>\n        <source>B6</source>\n        <translation>B6</translation>\n    </message>\n    <message>\n        <source>...</source>\n        <translation>...</translation>\n    </message>\n    <message>\n        <source>RTF</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>SVG</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>TeX</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>HTML</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>Misc</source>\n        <translation>Různé</translation>\n    </message>\n    <message>\n        <source>&amp;Exit</source>\n        <translation>&amp;Ukončit</translation>\n    </message>\n    <message>\n        <source>&amp;File</source>\n        <translation>&amp;Soubor</translation>\n    </message>\n    <message>\n        <source>&amp;Help</source>\n        <translation>&amp;Nápověda</translation>\n    </message>\n    <message>\n        <source>&amp;Load</source>\n        <translation>&amp;Nahrát</translation>\n    </message>\n    <message>\n        <source>&amp;Save</source>\n        <translation>&amp;Uložit</translation>\n    </message>\n    <message>\n        <source>&amp;Tips</source>\n        <translation>&amp;Rady</translation>\n    </message>\n    <message>\n        <source>Read a ctags file and add the included metainformation as tooltips.\nSee ctags.sf.net for details.</source>\n        <translation type=\"obsolete\">Čtěte soubor ctags a přidejte zahrnuté metainformace jako nástrojové rady.\nPodívejte se na ctags.sf.net, abyste se dozvěděl více.</translation>\n    </message>\n    <message>\n        <source>Inline CSS</source>\n        <translation>Řadový CSS</translation>\n    </message>\n    <message>\n        <source>&amp;Open files</source>\n        <translation>&amp;Otevřít soubory</translation>\n    </message>\n    <message>\n        <source>Files</source>\n        <translation>Soubory</translation>\n    </message>\n    <message>\n        <source>LaTeX</source>\n        <translation>LaTeX</translation>\n    </message>\n    <message>\n        <source>Legal</source>\n        <translation>Právní</translation>\n    </message>\n    <message>\n        <source>Linux</source>\n        <translation type=\"obsolete\">Linux</translation>\n    </message>\n    <message>\n        <source>Plug-In description</source>\n        <translation>Popis přídavného modulu</translation>\n    </message>\n    <message>\n        <source>UPPER</source>\n        <translation>VELKÁ PÍSMENA</translation>\n    </message>\n    <message>\n        <source>UTF-8</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>XHTML</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>Clipboard</source>\n        <translation>Schránka</translation>\n    </message>\n    <message>\n        <source>lower</source>\n        <translation>malá písmena</translation>\n    </message>\n    <message>\n        <source>No options defined.</source>\n        <translation>Nestanoveny žádné volby.</translation>\n    </message>\n    <message>\n        <source>Capitalize</source>\n        <translation>Velká počáteční písmena</translation>\n    </message>\n    <message>\n        <source>List of input files.</source>\n        <translation>Seznam vstupních souborů.</translation>\n    </message>\n    <message>\n        <source>Intelligent wrapping</source>\n        <translation>Chytré zalamování</translation>\n    </message>\n    <message>\n        <source>ISO-8859-1</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>ISO-8859-2</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>ISO-8859-3</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>ISO-8859-4</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>ISO-8859-5</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>ISO-8859-6</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>ISO-8859-7</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>ISO-8859-8</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>ISO-8859-9</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>Generate an index file with hyperlinks to all outputted files.</source>\n        <translation>Vytvořit rejstříkový soubor s odkazy na všechny výstupní soubory.</translation>\n    </message>\n    <message>\n        <source>Embed style (CSS)</source>\n        <translation>Vložit styl CSS</translation>\n    </message>\n    <message>\n        <source>Add line anchors</source>\n        <translation>Přidat kotvu</translation>\n    </message>\n    <message>\n        <source>Embed style (defs)</source>\n        <translation>Vložit stylový list</translation>\n    </message>\n    <message>\n        <source>Set encoding:</source>\n        <translation>Nastavit kódování:</translation>\n    </message>\n    <message>\n        <source>Paste from clipboard</source>\n        <translation>Vložit ze schránky</translation>\n    </message>\n    <message>\n        <source>Enable line wrapping.</source>\n        <translation>Povolit automatické zalamování řádků.</translation>\n    </message>\n    <message>\n        <source>Reformat and indent your code.\nThis feature is enabled tor C, C++, C# and Java code.</source>\n        <translation>Formátovat a odsadit vstupní kód.\nTato funkce je povolena pro C, C++, C# a pro kód Java.</translation>\n    </message>\n    <message>\n        <source>Start the conversion of your input files.</source>\n        <translation>Začít s převodem vstupních souborů.</translation>\n    </message>\n    <message>\n        <source>Choose a plug-in script.</source>\n        <translation>Vyberte skript přídavného modulu.</translation>\n    </message>\n    <message>\n        <source>Output format:</source>\n        <translation>Výstupní formát:</translation>\n    </message>\n    <message>\n        <source>Select the correct syntax of the code snippet.</source>\n        <translation>Vyberte správnou skladbu kousku s kódem.</translation>\n    </message>\n    <message>\n        <source>Output progress:</source>\n        <translation>Postup výstupu:</translation>\n    </message>\n    <message>\n        <source>Pad with zeroes</source>\n        <translation>Ukázat nuly vpravo</translation>\n    </message>\n    <message>\n        <source>Choose a formatting scheme.</source>\n        <translation>Vyberte formátovací schéma.</translation>\n    </message>\n    <message>\n        <source>Add an achor to each line.</source>\n        <translation>Přidat kotvu ke každému řádku.</translation>\n    </message>\n    <message>\n        <source>Add line numbers</source>\n        <translation>Přidat čísla řádků</translation>\n    </message>\n    <message>\n        <source>&amp;License</source>\n        <translation>&amp;Povolení</translation>\n    </message>\n    <message>\n        <source>Read ctags file:</source>\n        <translation type=\"obsolete\">Číst soubor ctags:</translation>\n    </message>\n    <message>\n        <source>Color theme:</source>\n        <translation>Barévné schéma:</translation>\n    </message>\n    <message>\n        <source>highlight.sty</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>highlight.css</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>Enter the number of spaces which replace a tab.\nSet the width to 0 to keep tabs.</source>\n        <translation>Zadejte počet prázdných znaků, které nahradí zarážku.\nNastavte jejich počet na nulu, aby byly zarážky zachovány.</translation>\n    </message>\n    <message>\n        <source>Enclose in pre tags</source>\n        <translation>Uzavřít do před-značek</translation>\n    </message>\n    <message>\n        <source>Stylesheet include file:</source>\n        <translation>Stylový list zahrnuje soubor:</translation>\n    </message>\n    <message>\n        <source>Replace quotes by dq sequences.</source>\n        <translation>Nahradit uvozovky sekvencí \\dq.</translation>\n    </message>\n    <message>\n        <source>Formatting</source>\n        <translation>Formátování</translation>\n    </message>\n    <message>\n        <source>Select a colour theme.</source>\n        <translation>Vyberte barevné schéma.</translation>\n    </message>\n    <message>\n        <source>Plug-ins</source>\n        <translation>Přídavné moduly</translation>\n    </message>\n    <message>\n        <source>Fill leading space of line numbers with zeroes.</source>\n        <translation>Vyplnit číslování řádků nulami vpravo.</translation>\n    </message>\n    <message>\n        <source>Test if input data is not binary.\nRemoves Unicode BOM mark.</source>\n        <translation>Ujistěte se, že vstup není binární.\nOdstraní značku Unicode BOM.</translation>\n    </message>\n    <message>\n        <source>Add the filename as prefix to the anchors.</source>\n        <translation>Přidejte souborový název jako předponu ke kotvám.</translation>\n    </message>\n    <message>\n        <source>Choose an output format.</source>\n        <translation>Vyberte výstupní formát.</translation>\n    </message>\n    <message>\n        <source>Remove the selected input files.</source>\n        <translation>Odstranit vybrané vstupní soubory.</translation>\n    </message>\n    <message>\n        <source>Include the style information in each output file.</source>\n        <translation>Zahrňte informace o stylu do každého výstupního souboru.</translation>\n    </message>\n    <message>\n        <source>Change the keyword case.</source>\n        <translation>Změňte psaní velkých a malých písmen, když vstupní skladba nerozlišuje ve psaní velkých a malých písmen.</translation>\n    </message>\n    <message>\n        <source>BBCode</source>\n        <translation>BBCode</translation>\n    </message>\n    <message>\n        <source>List of plug-ins. Toggle checkbox to enable the scripts.</source>\n        <translation>Seznam přídavných modulů. Klepněte na zaškrtávací okénko pro povolení skriptů.</translation>\n    </message>\n    <message>\n        <source>Name of the referenced style file.</source>\n        <translation>Název zmíněného souboru se stylem.</translation>\n    </message>\n    <message>\n        <source>Stylesheet file:</source>\n        <translation>Soubor se stylovým listem:</translation>\n    </message>\n    <message>\n        <source>Include:</source>\n        <translation>Zařadit vstupní soubor:</translation>\n    </message>\n    <message>\n        <source>Include file name in anchor</source>\n        <translation>Zařadit název souboru do kotvy</translation>\n    </message>\n    <message>\n        <source>Output destination:</source>\n        <translation>Cílový adresář:</translation>\n    </message>\n    <message>\n        <source>Path of the ctags file.</source>\n        <translation type=\"obsolete\">Cesta k souboru ctags.</translation>\n    </message>\n    <message>\n        <source>Letter</source>\n        <translation>Dopis</translation>\n    </message>\n    <message>\n        <source>Copy preview to clipboard</source>\n        <translation>Kopírovat náhled do schránky</translation>\n    </message>\n    <message>\n        <source>Readme</source>\n        <translation>Příručka</translation>\n    </message>\n    <message>\n        <source>Choose input files</source>\n        <translation>Vybrat vstupní soubory</translation>\n    </message>\n    <message>\n        <source>Add character styles</source>\n        <translation>Přidat znakové styly</translation>\n    </message>\n    <message>\n        <source>Width:</source>\n        <translation>Šířka:</translation>\n    </message>\n    <message>\n        <source>Highlighting options</source>\n        <translation>Volby pro zvýrazňování</translation>\n    </message>\n    <message>\n        <source>Select a CSS include file.</source>\n        <translation>Vyberte vstupní soubor CSS.</translation>\n    </message>\n    <message>\n        <source>Add pretty symbols</source>\n        <translation>Přidat symboly</translation>\n    </message>\n    <message>\n        <source>Copy highlighted code of the seleted file into the clipboard.</source>\n        <translation>Kopírovat obsah vybraného souboru se zvýrazněním do schránky.</translation>\n    </message>\n    <message>\n        <source>Font name:</source>\n        <translation>Název písma:</translation>\n    </message>\n    <message>\n        <source>Font size:</source>\n        <translation>Velikost písma:</translation>\n    </message>\n    <message>\n        <source>Select syntax:</source>\n        <translation>Vybrat skladbu:</translation>\n    </message>\n    <message>\n        <source>Image size:</source>\n        <translation>Velikost obrázku:</translation>\n    </message>\n    <message>\n        <source>Add plug-in to pool</source>\n        <translation>Přidat přídavný modul do sbírky</translation>\n    </message>\n    <message>\n        <source>Path of the CSS include file.</source>\n        <translation>Cesta k souboru CSS, která se má přidat do stylového listu.</translation>\n    </message>\n    <message>\n        <source>Page size:</source>\n        <translation>Velikost strany:</translation>\n    </message>\n    <message>\n        <source>Preview</source>\n        <translation>Náhled</translation>\n    </message>\n    <message>\n        <source>Line numbering options:</source>\n        <translation>Volby pro číslování řádků:</translation>\n    </message>\n    <message>\n        <source>Make output Babel compatible.</source>\n        <translation>Vytvořit kód, který je slučitelný s Babel.</translation>\n    </message>\n    <message>\n        <source>Keyword case:</source>\n        <translation>Velikost písmen klíčových slov:</translation>\n    </message>\n    <message>\n        <source>Set the output file ancoding.</source>\n        <translation>Nastavte kódování výstupního souboru.</translation>\n    </message>\n    <message>\n        <source>Tab width:</source>\n        <translation>Šířka zarážky:</translation>\n    </message>\n    <message>\n        <source>Remove all plug-ins.</source>\n        <translation>Odstranit všechny přídavné moduly.</translation>\n    </message>\n    <message>\n        <source>Select a style include file.</source>\n        <translation>Vyberte vstupní soubor stylového listu.</translation>\n    </message>\n    <message>\n        <source>&amp;Changelog</source>\n        <translation>&amp;Změny</translation>\n    </message>\n    <message>\n        <source>Generate output without document header and footer.</source>\n        <translation>Vytvořit výstup bez záhlaví a zápatí dokumentu.</translation>\n    </message>\n    <message>\n        <source>Select a page size.</source>\n        <translation>Vyberte velikost strany.</translation>\n    </message>\n    <message>\n        <source>About &amp;translations</source>\n        <translation>&amp;Překlady</translation>\n    </message>\n    <message>\n        <source>Paste clipboard content into the preview window.</source>\n        <translation>Vložte obsah schránky do okna s náhledem.</translation>\n    </message>\n    <message>\n        <source>Clear selection</source>\n        <translation>Smazat výběr</translation>\n    </message>\n    <message>\n        <source>Save output in the input file directories.</source>\n        <translation>Uložte výstup do adresářů se vstupním souborem.</translation>\n    </message>\n    <message>\n        <source>Description</source>\n        <translation>Popis</translation>\n    </message>\n    <message>\n        <source>Choose a ctags file.</source>\n        <translation type=\"obsolete\">Vyberte soubor ctags.</translation>\n    </message>\n    <message>\n        <source>Copy highlighted code into the clipboard.</source>\n        <translation>Kopírujte zvýrazněný kód do schránky.</translation>\n    </message>\n    <message>\n        <source>Select or define the encoding.\nThe result has to match the input file encoding.</source>\n        <translation>Vyberte nebo určete kódování výstupu.\nVýsledné kódování musí odpovídat kódování vstupního souboru.</translation>\n    </message>\n    <message>\n        <source>Select or enter the font name.</source>\n        <translation type=\"obsolete\">Vyberte nebo zadejte název písma.</translation>\n    </message>\n    <message>\n        <source>Output as ordered list</source>\n        <translation>Výstup jako seřazený seznam</translation>\n    </message>\n    <message>\n        <source>Add character stylesheets with formatting information.\nYou can select the stylesheets in your word processor to reformat additional text.</source>\n        <translation>Přidejte znakové stylové listy s informacemi o formátování.\nTyto stylové listy můžete vybrat ve svém textovém editoru, abyste přeformátoval dodatečný text.</translation>\n    </message>\n    <message>\n        <source>Validate input data</source>\n        <translation>Schválit vstupní data</translation>\n    </message>\n    <message>\n        <source>Write to source directories</source>\n        <translation>Zapsat do zdrojových adresářů</translation>\n    </message>\n    <message>\n        <source>Remove the selected plug-ins.</source>\n        <translation>Odstranit vybrané přídavné moduly ze seznamu.</translation>\n    </message>\n    <message>\n        <source>Index/ctags</source>\n        <translation type=\"obsolete\">Index/ctags</translation>\n    </message>\n    <message>\n        <source>Escape quotes</source>\n        <translation>Nahradit uvozovky</translation>\n    </message>\n    <message>\n        <source>Generate index file</source>\n        <translation>Vytvořit rejstříkový soubor</translation>\n    </message>\n    <message>\n        <source>Select the output directory.</source>\n        <translation>Vyberte výstupní adresář.</translation>\n    </message>\n    <message>\n        <source>Output the lines within an ordered list.</source>\n        <translation>Vydat řádky jako seřazený seznam.</translation>\n    </message>\n    <message>\n        <source>&amp;About Highlight</source>\n        <translation>&amp;O Highlight</translation>\n    </message>\n    <message>\n        <source>Path of the style include file.</source>\n        <translation>Cesta k souboru stylového listu, která se má přidat do stylového listu.</translation>\n    </message>\n    <message>\n        <source>Line wrapping</source>\n        <translation>Zalamování řádků</translation>\n    </message>\n    <message>\n        <source>Clear all</source>\n        <translation>Odstranit vše</translation>\n    </message>\n    <message>\n        <source>Shows decription of a selected plug-in script.</source>\n        <translation>Ukázat popis vybraného skriptu přídavného modulu.</translation>\n    </message>\n    <message>\n        <source>Embed style (macros)</source>\n        <translation>Vložit stylový list (macros)</translation>\n    </message>\n    <message>\n        <source>ISO-8859-10</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>ISO-8859-11</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>ISO-8859-12</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>ISO-8859-13</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>ISO-8859-14</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>ISO-8859-15</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>Convert files</source>\n        <translation>Převést soubory</translation>\n    </message>\n    <message>\n        <source>Select a keyword case.</source>\n        <translation>Vyberte typ psaní velkých a malých písmen.</translation>\n    </message>\n    <message>\n        <source>Add &amp;lt;pre&amp;gt; tags to the output, if the flag &quot;No document header and footer&quot; is selected.</source>\n        <translation>Přidat značky  &amp;lt;pre&amp;gt; do výstupu, pokud je vybrán příznak &quot;Žádná záhlaví a zápatí dokumentu&quot;.</translation>\n    </message>\n    <message>\n        <source>Remove all input files.</source>\n        <translation>Odstranit všechny vstupní soubory.</translation>\n    </message>\n    <message>\n        <source>Enter the maximum line length.</source>\n        <translation>Zadejte největší délku řádku.</translation>\n    </message>\n    <message>\n        <source>Enter the SVG width (may contain units).</source>\n        <translation>Zadejte šířku obrázku SVG (může obsahovat jednotky velikosti).</translation>\n    </message>\n    <message>\n        <source>Visit andre-simon.de</source>\n        <translation>Navštivte andre-simon.de</translation>\n    </message>\n    <message>\n        <source>Load &amp;default project</source>\n        <translation>Nahrát &amp;výchozí projekt</translation>\n    </message>\n    <message>\n        <source>Add line numbers to the output.</source>\n        <translation>Přidat čísla řádků do výstupu.</translation>\n    </message>\n    <message>\n        <source>Choose the source code files you want to convert.</source>\n        <translation>vyberte soubory se zdrojovým kódem, jež chcete převést.</translation>\n    </message>\n    <message>\n        <source>Copy file to clipboard</source>\n        <translation>Kopírovat soubor do schránky</translation>\n    </message>\n    <message>\n        <source>Stylesheets</source>\n        <translation>Stylové listy</translation>\n    </message>\n    <message>\n        <source>Replace default symbols (brackets, tilde) by nice redefinitions.</source>\n        <translation>Nahradit výchozí zobrazení různých symbolů (závorky, vlnovka) pěknějšími.</translation>\n    </message>\n    <message>\n        <source>Omit header and footer</source>\n        <translation>Vynechat záhlaví a zápatí</translation>\n    </message>\n    <message>\n        <source>Reformat:</source>\n        <translation>Formátovat:</translation>\n    </message>\n    <message>\n        <source>Add CSS information to each tag (do not use CSS class definitions).</source>\n        <translation>Přidat stylové listy do každé značky (nepoužívat žádné třídy CSS).</translation>\n    </message>\n    <message>\n        <source>Enter the font size.</source>\n        <translation>Zadejte velikost písma.</translation>\n    </message>\n    <message>\n        <source>General</source>\n        <translation>Obecné</translation>\n    </message>\n    <message>\n        <source>Output specific</source>\n        <translation>Volby pro výstup</translation>\n    </message>\n    <message>\n        <source>Name of the referenced  style file.</source>\n        <translation>Název zmíněného stylového listu.</translation>\n    </message>\n    <message>\n        <source>CSS class prefix:</source>\n        <translation>Předpona třídy CSS:</translation>\n    </message>\n    <message>\n        <source>Highlight</source>\n        <translation>Highlight</translation>\n    </message>\n    <message>\n        <source>Add Babel compatibility</source>\n        <translation>Slučitelnost s Babel</translation>\n    </message>\n    <message>\n        <source>Add a CSS class name prefix to avoid namespace clashes.</source>\n        <translation>Přidat předponu pro název třídy CSS, pro vyhnutí se střetům s jinými stylovými listy.</translation>\n    </message>\n    <message>\n        <source>Height:</source>\n        <translation>Výška:</translation>\n    </message>\n    <message>\n        <source>Enter the SVG height (may contain units).</source>\n        <translation>Zadejte výšku obrázku SVG (může obsahovat jednotky velikosti).</translation>\n    </message>\n    <message>\n        <source>Select the line number width.</source>\n        <translation>Vyberte počet míst číslování.</translation>\n    </message>\n    <message>\n        <source>Output directory</source>\n        <translation>Výstupní adresář</translation>\n    </message>\n    <message>\n        <source>Indent statements and function parameters after wrapping.</source>\n        <translation>Odsadit příkazy a parametry funkcí po zalomení.</translation>\n    </message>\n    <message>\n        <source>&amp;Windows</source>\n        <translation>&amp;Okna</translation>\n    </message>\n    <message>\n        <source>&amp;Dock floating panels</source>\n        <translation>&amp;Ukotvit plovoucí panely</translation>\n    </message>\n    <message>\n        <source>Select or enter the font name. HTML supports a list of fonts, separated with comma.</source>\n        <translation>Vyberte nebo zadejte název písma. HTML podporuje seznam písem oddělených čárkou.</translation>\n    </message>\n    <message>\n        <source>Plug-in input file</source>\n        <translation>Vstupní soubor s přídavným modulem</translation>\n    </message>\n    <message>\n        <source>Optional path to a plug-in input file</source>\n        <translation>Volitelná cesta k vstupnímu souboru s přídavným modulem</translation>\n    </message>\n    <message>\n        <source>Select the plug-in input file.</source>\n        <translation>Vyberte vstupní soubor s přídavným modulem.</translation>\n    </message>\n    <message>\n        <source>Use non breaking spaces</source>\n        <translation type=\"obsolete\">Použít tvrdé mezery</translation>\n    </message>\n    <message>\n        <source>Do not add line numbering to lines which were automatically wrapped.</source>\n        <translation>Nepřidávat číslování řádků do řádků, které byly automaticky zalomeny.</translation>\n    </message>\n    <message>\n        <source>Omit line numbers of wrapped lines</source>\n        <translation>Vynechat čísla řádků zalomených řádků</translation>\n    </message>\n    <message>\n        <source>Replace spaces by nbsp entities.</source>\n        <translation type=\"obsolete\">Nahradit mezery entitami nbsp.</translation>\n    </message>\n    <message>\n        <source>ODT</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <source>Set line numbering start</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n</context>\n<context>\n    <name>ShowTextFile</name>\n    <message>\n        <source>OK</source>\n        <translation>OK</translation>\n    </message>\n    <message>\n        <source>Show text</source>\n        <translation>Ukázat text</translation>\n    </message>\n    <message>\n        <source>TextLabel</source>\n        <translation>Textový štítek</translation>\n    </message>\n</context>\n<context>\n    <name>io_report</name>\n    <message>\n        <source>Output errors:</source>\n        <translation>Výstupní chyby:</translation>\n    </message>\n    <message>\n        <source>Error summary</source>\n        <translation>Přehled chyb</translation>\n    </message>\n    <message>\n        <source>Remove files above from input file list</source>\n        <translation>Odstranit výše uvedené soubory ze seznamu se vstupními soubory</translation>\n    </message>\n    <message>\n        <source>Input errors:</source>\n        <translation>Vstupní chyby:</translation>\n    </message>\n    <message>\n        <source>Reformatting not possible:</source>\n        <translation>Přeformátování není možné:</translation>\n    </message>\n</context>\n</TS>\n"
  },
  {
    "path": "jni/highlight/gui-qt/highlight_de_DE.ts",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE TS>\n<TS version=\"2.1\" language=\"de_DE\" sourcelanguage=\"en_US\">\n<context>\n    <name>MainWindow</name>\n    <message>\n        <source>Themes or indent schemes not found.\nCheck installation.</source>\n        <translation type=\"obsolete\">Farb- oder Formatierungsvorlagen nicht gefunden.\nInstallation prüfen.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"94\"/>\n        <source>Initialization error</source>\n        <translation>Initialisierungsfehler</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"95\"/>\n        <source>Could not find syntax definitions. Check installation.</source>\n        <translation>Syntaxdefinitionen nicht gefunden.\nInstallation prüfen.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"157\"/>\n        <source>Select one or more files to open</source>\n        <translation>Wähle eine oder mehrere Dateien zum Öffnen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"189\"/>\n        <source>Select destination directory</source>\n        <translation>Wähle das Zielverzeichnis</translation>\n    </message>\n    <message>\n        <source>Tags file error</source>\n        <translation type=\"obsolete\">Tags Dateifehler</translation>\n    </message>\n    <message>\n        <source>Could not read tags information in &quot;%1&quot;</source>\n        <translation type=\"obsolete\">Konnte Tags-Informationen in %1 nicht lesen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"700\"/>\n        <location filename=\"mainwindow.cpp\" line=\"731\"/>\n        <source>Output error</source>\n        <translation>Ausgabefehler</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"700\"/>\n        <source>Output directory does not exist!</source>\n        <translation>Zielverzeichnis existert nicht!</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"731\"/>\n        <source>You must define a style output file!</source>\n        <translation>Sie müssen ein Stylesheet zur Ausgabe angeben!</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"770\"/>\n        <source>Language definition error</source>\n        <translation>Fehler in Sprachdefinition</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"771\"/>\n        <source>Invalid regular expression in %1:\n%2</source>\n        <translation>Ungültiger regulärer Ausdruck in %1: %2</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"775\"/>\n        <source>Unknown syntax</source>\n        <translation>Unbekannte Syntax</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"775\"/>\n        <source>Could not convert %1</source>\n        <translation>Konnte %1 nicht konvertieren</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"778\"/>\n        <source>Lua error</source>\n        <translation>Lua Fehler</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"778\"/>\n        <source>Could not convert %1:\nLua Syntax error: %2</source>\n        <translation>Konnte %1 nicht konvertieren:\\nLua Syntaxfehler: %2</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"847\"/>\n        <source>Converted %1 files in %2 ms</source>\n        <translation>%1 Dateien in %2 ms konvertiert</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"932\"/>\n        <source>Conversion of &quot;%1&quot; not possible.</source>\n        <translation>Konnte &quot;%1&quot; nicht konvertieren.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"932\"/>\n        <location filename=\"mainwindow.cpp\" line=\"1036\"/>\n        <location filename=\"mainwindow.cpp\" line=\"1059\"/>\n        <source>clipboard data</source>\n        <translation>Daten der Zwischenablage</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"990\"/>\n        <source>%1 options</source>\n        <translation>%1-Optionen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1035\"/>\n        <source>Preview (%1):</source>\n        <translation>Vorschau (%1):</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1038\"/>\n        <source>Current syntax: %1</source>\n        <translation>Aktuelle Syntax: %1</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1059\"/>\n        <source>Preview of &quot;%1&quot; not possible.</source>\n        <translation>Vorschau von &quot;%1&quot; nicht möglich.</translation>\n    </message>\n    <message>\n        <source>Choose a ctags file</source>\n        <translation type=\"obsolete\">Wählen Sie eine ctags Datei</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1092\"/>\n        <location filename=\"mainwindow.cpp\" line=\"1096\"/>\n        <location filename=\"mainwindow.cpp\" line=\"1100\"/>\n        <location filename=\"mainwindow.cpp\" line=\"1105\"/>\n        <source>Choose a style include file</source>\n        <translation>Wählen Sie ein Eingabe-Stylesheet</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1110\"/>\n        <source>About providing translations</source>\n        <translation>Übersetzungen bereitstellen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1111\"/>\n        <source>The GUI was developed using the Qt toolkit, and translations may be provided using the tools Qt Linguist and lrelease.\nThe highlight.ts file for Linguist resides in the src/gui-qt subdirectory.\nThe qm file generated by lrelease has to be saved in gui-files/l10n.\n\nPlease send a note to as (at) andre-simon (dot) de if you have issues during translating or if you have finished or updated a translation.</source>\n        <translation>Diese GUI wurde mit dem Qt Toolkit entwickelt, daher werden Übersetzungsdateien mit den Werkzeugen Qt Linguist und lrelease erstellt.\nDie highlight.ts Datei für Linguist befindet sich im src/gui-qt Unterverzeichnis.\nDie von lrelease ausgegebene qm-Datei wird in gui-files/l10n gespeichert.\n\nBitte senden Sie eine Nachricht an as (at) andre-simon (dot) de, wenn Sie Probleme bei der Übersetzung haben oder wenn Sie eine Übersetzung fertiggestellt bzw. aktualisiert haben.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1176\"/>\n        <source>Select one or more plug-ins</source>\n        <translation>Wähle ein Plug-in</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1214\"/>\n        <source>Choose a plug-in input file</source>\n        <translation>Wähle eine Eingabedatei für Plug-Ins aus</translation>\n    </message>\n</context>\n<context>\n    <name>MainWindowClass</name>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"163\"/>\n        <source>Choose the source code files you want to convert.</source>\n        <translation>Wähle  Sourcecode-Dateien zur Konvertierung aus.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"169\"/>\n        <source>Choose input files</source>\n        <translation>Dateien wählen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"195\"/>\n        <source>List of input files.</source>\n        <translation>Liste der Eingabedateien.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"219\"/>\n        <source>Remove the selected input files.</source>\n        <translation>Lösche die markierten Dateien aus der Eingabeliste.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"222\"/>\n        <location filename=\"mainwindow.ui\" line=\"478\"/>\n        <source>Clear selection</source>\n        <translation>Auswahl entfernen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"229\"/>\n        <source>Remove all input files.</source>\n        <translation>Lösche  die Eingabeliste.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"232\"/>\n        <location filename=\"mainwindow.ui\" line=\"488\"/>\n        <source>Clear all</source>\n        <translation>Alle entfernen</translation>\n    </message>\n    <message>\n        <source>Output destination</source>\n        <translation type=\"obsolete\">Zielverzeichnis</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"271\"/>\n        <source>Output directory</source>\n        <translation>Zielverzeichnis</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"290\"/>\n        <source>Select the output directory.</source>\n        <translation>Wähle das Ausgabeverzeichnis.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"293\"/>\n        <location filename=\"mainwindow.ui\" line=\"553\"/>\n        <location filename=\"mainwindow.ui\" line=\"1046\"/>\n        <location filename=\"mainwindow.ui\" line=\"1283\"/>\n        <location filename=\"mainwindow.ui\" line=\"1379\"/>\n        <location filename=\"mainwindow.ui\" line=\"1615\"/>\n        <source>...</source>\n        <translation>...</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"302\"/>\n        <source>Save output in the input file directories.</source>\n        <translation>Speichere Ausgabe in den Verzeichnissen der Eingabedateien.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"305\"/>\n        <source>Write to source directories</source>\n        <translation>In Quellverzeichnisse schreiben</translation>\n    </message>\n    <message>\n        <source>Output options</source>\n        <translation type=\"obsolete\">Ausgabeoptionen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"598\"/>\n        <source>General</source>\n        <translation>Allgemein</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"618\"/>\n        <source>Output format:</source>\n        <translation>Ausgabeformat:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"640\"/>\n        <source>Choose an output format.</source>\n        <translation>Wähle ein Ausgabeformat.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"644\"/>\n        <source>HTML</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"649\"/>\n        <source>XHTML</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"654\"/>\n        <source>LaTeX</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"659\"/>\n        <source>TeX</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"664\"/>\n        <source>RTF</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"669\"/>\n        <source>ODT</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"674\"/>\n        <source>SVG</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"698\"/>\n        <source>Add line numbers to the output.</source>\n        <translation>Füge Zeilennummern zur Ausgabe hinzu.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"701\"/>\n        <source>Add line numbers</source>\n        <translation>Zeilennummerierung</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"721\"/>\n        <source>Set line numbering start</source>\n        <translation>Lege den Beginn der Nummerierung fest</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"740\"/>\n        <source>Select the line number width.</source>\n        <translation>Wähle die Stellenanzahl der Nummerierung.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"761\"/>\n        <source>Fill leading space of line numbers with zeroes.</source>\n        <translation>Fülle Zeilennummerierung mit Nullen auf.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"764\"/>\n        <source>Pad with zeroes</source>\n        <translation>Zeige führende Nullen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"777\"/>\n        <source>Generate output without document header and footer.</source>\n        <translation>Erzeuge Ausgabe ohne Dokumentenkopf und -fußteil.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"780\"/>\n        <source>Omit header and footer</source>\n        <translation>Kopf- und Fußteil auslassen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"787\"/>\n        <source>Test if input data is not binary.\nRemoves Unicode BOM mark.</source>\n        <translation>Stellt sicher, daß die Eingabe nicht binär ist.\nEntfernt den Unicode BOM.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"791\"/>\n        <source>Validate input data</source>\n        <translation>Prüfe Eingabedaten</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"800\"/>\n        <source>Set the output file ancoding.</source>\n        <translation>Setzt das Encoding.</translation>\n    </message>\n    <message>\n        <source>Encoding:</source>\n        <translation type=\"obsolete\">Encoding:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"810\"/>\n        <source>Select or define the encoding.\nThe result has to match the input file encoding.</source>\n        <translation>Wähle oder definiere das Ausgabe-Encoding.\nDas Encoding muss mit den Eingabedateien übereinstimmen.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"821\"/>\n        <source>ISO-8859-1</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"826\"/>\n        <source>ISO-8859-2</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"831\"/>\n        <source>ISO-8859-3</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"836\"/>\n        <source>ISO-8859-4</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"841\"/>\n        <source>ISO-8859-5</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"846\"/>\n        <source>ISO-8859-6</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"851\"/>\n        <source>ISO-8859-7</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"856\"/>\n        <source>ISO-8859-8</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"861\"/>\n        <source>ISO-8859-9</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"866\"/>\n        <source>ISO-8859-10</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"871\"/>\n        <source>ISO-8859-11</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"876\"/>\n        <source>ISO-8859-12</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"881\"/>\n        <source>ISO-8859-13</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"886\"/>\n        <source>ISO-8859-14</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"891\"/>\n        <source>ISO-8859-15</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"896\"/>\n        <source>UTF-8</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"920\"/>\n        <source>Output specific</source>\n        <translation>Format-Optionen</translation>\n    </message>\n    <message>\n        <source>HTML options</source>\n        <translation type=\"obsolete\">HTML Optionen</translation>\n    </message>\n    <message>\n        <source>Style</source>\n        <translation type=\"obsolete\">Stylesheets</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"969\"/>\n        <location filename=\"mainwindow.ui\" line=\"1213\"/>\n        <location filename=\"mainwindow.ui\" line=\"1309\"/>\n        <location filename=\"mainwindow.ui\" line=\"1545\"/>\n        <source>Include the style information in each output file.</source>\n        <translation>Füge die Stylesheets in jede Ausgabedatei ein.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"972\"/>\n        <location filename=\"mainwindow.ui\" line=\"1548\"/>\n        <source>Embed style (CSS)</source>\n        <translation>CSS einbetten</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"985\"/>\n        <source>Add CSS information to each tag (do not use CSS class definitions).</source>\n        <translation>Füge Stylesheets in jeden Tag ein (benutze keine CSS Klassen).</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"988\"/>\n        <source>Inline CSS</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>Style file:</source>\n        <translation type=\"obsolete\">Stylesheet-Datei:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1015\"/>\n        <location filename=\"mainwindow.ui\" line=\"1331\"/>\n        <location filename=\"mainwindow.ui\" line=\"1567\"/>\n        <source>Name of the referenced style file.</source>\n        <translation>Name des  referenzierten Stylesheets.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1018\"/>\n        <location filename=\"mainwindow.ui\" line=\"1570\"/>\n        <source>highlight.css</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>Style include file:</source>\n        <translation type=\"obsolete\">Eingabe-Stylesheet:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1036\"/>\n        <location filename=\"mainwindow.ui\" line=\"1605\"/>\n        <source>Path of the CSS include file.</source>\n        <translation>Pfad zur CSS-Datei, die ins Stylesheet eingefügt werden soll.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1043\"/>\n        <source>Select a CSS include file.</source>\n        <translation>Wähle eine Stylesheet-Eingabedatei.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1057\"/>\n        <source>CSS class prefix:</source>\n        <translation>CSS Präfix:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1064\"/>\n        <source>Add a CSS class name prefix to avoid namespace clashes.</source>\n        <translation>Definiere einen CSS-Klassennamen, um Kollisionen mit anderen Stylesheets zu vermeiden.</translation>\n    </message>\n    <message>\n        <source>Tags and index files</source>\n        <translation type=\"obsolete\">Tags- und Indexdateien</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1142\"/>\n        <source>Generate an index file with hyperlinks to all outputted files.</source>\n        <translation>Erzeuge eine Indexdatei mit Links zu allen Ausgabedateien.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1145\"/>\n        <source>Generate index file</source>\n        <translation>Indexdatei erzeugen</translation>\n    </message>\n    <message>\n        <source>Read a ctags file and add the included metainformation as tooltips.\nSee ctags.sf.net for details.</source>\n        <translation type=\"obsolete\">Lese eine ctags-Datei und füge die Metainformationen als Tooltips hinzu.\nSiehe ctags.sf.net um mehr darüber zu erfahren.</translation>\n    </message>\n    <message>\n        <source>Ctags file:</source>\n        <translation type=\"obsolete\">Ctags Datei:</translation>\n    </message>\n    <message>\n        <source>Path of the ctags file.</source>\n        <translation type=\"obsolete\">Pfad der ctags-Datei.</translation>\n    </message>\n    <message>\n        <source>Choose a ctags file.</source>\n        <translation type=\"obsolete\">Wähle eine ctags Datei.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1093\"/>\n        <source>Misc</source>\n        <translation>Verschiedenes</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1112\"/>\n        <source>Add an achor to each line.</source>\n        <translation>Füge Anker zu jeder Zeile hinzu.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1115\"/>\n        <source>Add line anchors</source>\n        <translation>Anker einfügen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1122\"/>\n        <source>Add the filename as prefix to the anchors.</source>\n        <translation>Füge Dateinamen als Präfix zum Anker hinzu.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1125\"/>\n        <source>Include file name in anchor</source>\n        <translation>Dateiname im Anker</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1132\"/>\n        <source>Output the lines within an ordered list.</source>\n        <translation>Gib die Zeilen als sortierte Liste aus.</translation>\n    </message>\n    <message>\n        <source>Ordered list</source>\n        <translation type=\"obsolete\">Sortierte Liste</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1152\"/>\n        <source>Add &amp;lt;pre&amp;gt; tags to the output, if the flag &quot;No document header and footer&quot; is selected.</source>\n        <translation>Schließe die Ausgabe in  &amp;lt;pre&amp;gt;-Tags ein, wenn die Option &quot;Kopf- und Fußteil auslassen&quot; gewählt ist.</translation>\n    </message>\n    <message>\n        <source>Enclose in &lt;pre&gt;</source>\n        <translation type=\"obsolete\">Schließe in &amp;lt;pre&amp;gt; ein</translation>\n    </message>\n    <message>\n        <source>LaTeX options</source>\n        <translation type=\"obsolete\">LaTeX Optionen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1183\"/>\n        <source>Replace quotes by dq sequences.</source>\n        <translation>Ersetze Anführungszeichen mit \\dq-Sequenzen.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1186\"/>\n        <source>Escape quotes</source>\n        <translation>Ersetze Anführungszeichen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1193\"/>\n        <source>Make output Babel compatible.</source>\n        <translation>Erzeuge Code, der mit Babel verträglich ist.</translation>\n    </message>\n    <message>\n        <source>Babel compatibility</source>\n        <translation type=\"obsolete\">Babel Kompatibilität</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1203\"/>\n        <source>Replace default symbols (brackets, tilde) by nice redefinitions.</source>\n        <translation>Ersetze Standard-Darstellung verschiedener Symbole (Klammern, Tilde) durch schönere Definitionen.</translation>\n    </message>\n    <message>\n        <source>Pretty symbols</source>\n        <translation type=\"obsolete\">Schönere Symbole</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1216\"/>\n        <source>Embed style (defs)</source>\n        <translation>Stylesheet einbetten</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1235\"/>\n        <source>Name of the referenced  style file.</source>\n        <translation>Name des  referenzierten Stylesheets.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1238\"/>\n        <location filename=\"mainwindow.ui\" line=\"1334\"/>\n        <source>highlight.sty</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>Style include:</source>\n        <translation type=\"obsolete\">Eingabe-Stylesheet:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"803\"/>\n        <source>Set encoding:</source>\n        <translation>Encoding:</translation>\n    </message>\n    <message>\n        <source>Read ctags file:</source>\n        <translation type=\"obsolete\">Lese ctags-Datei:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1135\"/>\n        <source>Output as ordered list</source>\n        <translation>Sortierte Liste</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1155\"/>\n        <source>Enclose in pre tags</source>\n        <translation>Schließe in pre-Tags  ein</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1196\"/>\n        <source>Add Babel compatibility</source>\n        <translation>Babel Kompatibilität</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1206\"/>\n        <source>Add pretty symbols</source>\n        <translation>Symbole anpassen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1002\"/>\n        <location filename=\"mainwindow.ui\" line=\"1225\"/>\n        <location filename=\"mainwindow.ui\" line=\"1321\"/>\n        <location filename=\"mainwindow.ui\" line=\"1557\"/>\n        <source>Stylesheet file:</source>\n        <translation>Stylesheet-Datei:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"256\"/>\n        <source>Output destination:</source>\n        <translation>Zielverzeichnis:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1249\"/>\n        <location filename=\"mainwindow.ui\" line=\"1345\"/>\n        <location filename=\"mainwindow.ui\" line=\"1581\"/>\n        <source>Stylesheet include file:</source>\n        <translation>Eingabe-Stylesheet:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1105\"/>\n        <source>Line numbering options:</source>\n        <translation>Optionen der Zeilennummerierung:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"20\"/>\n        <source>Highlight</source>\n        <translation>Highlight</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"157\"/>\n        <source>Files</source>\n        <translation>Dateien</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"371\"/>\n        <source>Paste clipboard content into the preview window.</source>\n        <translation>Füge Inhalt der Zwischenablage in die Vorschau ein.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"374\"/>\n        <source>Paste from clipboard</source>\n        <translation>Aus Zwischenablage einfügen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"416\"/>\n        <source>Copy highlighted code into the clipboard.</source>\n        <translation>Kopiere formatierte Ausgabe in die Zwischenablage.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"419\"/>\n        <source>Copy preview to clipboard</source>\n        <translation>In Zwischenablage kopieren</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"387\"/>\n        <source>Select syntax:</source>\n        <translation>Syntax wählen:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"394\"/>\n        <source>Select the correct syntax of the code snippet.</source>\n        <translation>Wähle die zum Text passende Syntax.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"440\"/>\n        <source>Plug-ins</source>\n        <translation>Plug-Ins</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"449\"/>\n        <source>Add plug-in to pool</source>\n        <translation>Füge Plug-In zur Sammlung hinzu</translation>\n    </message>\n    <message>\n        <source>List of plug-ins.</source>\n        <translation type=\"obsolete\">Sammlung von Plug-Ins.</translation>\n    </message>\n    <message>\n        <source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;\n&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;\np, li { white-space: pre-wrap; }\n&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;\n&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Remove the selected plug-ins.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>\n        <translation type=\"obsolete\">Entferne die selektierten Plug-Ins</translation>\n    </message>\n    <message>\n        <source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;\n&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;\np, li { white-space: pre-wrap; }\n&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;\n&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Remove all plug-ins.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>\n        <translation type=\"obsolete\">Entferne alle Plug-Ins</translation>\n    </message>\n    <message>\n        <source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;\n&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;\np, li { white-space: pre-wrap; }\n&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;\n&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Use the selected plugin.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>\n        <translation type=\"obsolete\">Bneutze das ausgewählte Plug-In</translation>\n    </message>\n    <message>\n        <source>Enable selected plug-in script</source>\n        <translation type=\"obsolete\">Aktiviere das selektierte Plug-In Skript</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"679\"/>\n        <source>BBCode</source>\n        <translation>BBCode</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"961\"/>\n        <source>Stylesheets</source>\n        <translation>Stylesheets</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1029\"/>\n        <source>Include:</source>\n        <translation>Eingabedatei:</translation>\n    </message>\n    <message>\n        <source>Index/ctags</source>\n        <translation type=\"obsolete\">Index/ctags</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1273\"/>\n        <location filename=\"mainwindow.ui\" line=\"1369\"/>\n        <source>Path of the style include file.</source>\n        <translation>Pfad zur sty-Datei, die ins Stylesheet eingefügt werden soll.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1280\"/>\n        <location filename=\"mainwindow.ui\" line=\"1376\"/>\n        <location filename=\"mainwindow.ui\" line=\"1612\"/>\n        <source>Select a style include file.</source>\n        <translation>Wähle eine Stylesheet-Eingabedatei.</translation>\n    </message>\n    <message>\n        <source>TeX options</source>\n        <translation type=\"obsolete\">TeX Optionen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1312\"/>\n        <source>Embed style (macros)</source>\n        <translation>Stylesheet einbetten</translation>\n    </message>\n    <message>\n        <source>RTF options</source>\n        <translation type=\"obsolete\">RTF Optionen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1405\"/>\n        <source>Add character stylesheets with formatting information.\nYou can select the stylesheets in your word processor to reformat additional text.</source>\n        <translation>Füge Zeichenvorlagen mit Formatierungsinformationen hinzu.\nDiese können in der Textverarbeitung gewählt werden, um zusätzlichen Text zu formatieren.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1409\"/>\n        <source>Add character styles</source>\n        <translation>Zeichenvorlagen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1418\"/>\n        <source>Page size:</source>\n        <translation>Papierformat:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1425\"/>\n        <source>Select a page size.</source>\n        <translation>Wähle eine Seitengröße aus.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1432\"/>\n        <source>A3</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1437\"/>\n        <source>A4</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1442\"/>\n        <source>A5</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1447\"/>\n        <source>B4</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1452\"/>\n        <source>B5</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1457\"/>\n        <source>B6</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1462\"/>\n        <source>Letter</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1467\"/>\n        <source>Legal</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>SVG options</source>\n        <translation type=\"obsolete\">SVG Optionen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1494\"/>\n        <source>Image size:</source>\n        <translation>Bildgröße:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1503\"/>\n        <source>Width:</source>\n        <translation>Breite:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1519\"/>\n        <source>Enter the SVG width (may contain units).</source>\n        <translation>Gib die Bildbreite ein (kann Größeneinheiten enthalten).</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1526\"/>\n        <source>Height:</source>\n        <translation>Höhe:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1536\"/>\n        <source>Enter the SVG height (may contain units).</source>\n        <translation>Gib die Bildhöhe ein (kann Größeneinheiten enthalten).</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1641\"/>\n        <source>No options defined.</source>\n        <translation>Keine Optionen vorhanden.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1666\"/>\n        <source>Formatting</source>\n        <translation>Formatierung</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1680\"/>\n        <source>Color theme:</source>\n        <translation>Farbschema:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1696\"/>\n        <source>Select a colour theme.</source>\n        <translation>Wähle ein Farbschema.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1710\"/>\n        <source>Reformat and indent your code.\nThis feature is enabled tor C, C++, C# and Java code.</source>\n        <translation>Formatiere den Eingabecode.\nDiese Funktion kann auf C, C++, C# und Java-Code angewandt werden.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1714\"/>\n        <source>Reformat:</source>\n        <translation>Formatieren:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1727\"/>\n        <source>Choose a formatting scheme.</source>\n        <translation>Wähle ein Formatierungs-Schema.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1741\"/>\n        <source>Change the keyword case.</source>\n        <translation>Ändere die Groß- und Kleinschreibung, wenn die Eingabesyntax nicht case-sensitive ist.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1744\"/>\n        <source>Keyword case:</source>\n        <translation>Schlüsselwort Case:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1757\"/>\n        <source>Select a keyword case.</source>\n        <translation>Wähle einen Typ der Groß- und Kleinschreibung.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1761\"/>\n        <source>UPPER</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1766\"/>\n        <source>lower</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1771\"/>\n        <source>Capitalize</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1789\"/>\n        <source>Tab width:</source>\n        <translation>Tabulatorbreite:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1799\"/>\n        <source>Enter the number of spaces which replace a tab.\nSet the width to 0 to keep tabs.</source>\n        <translation>Gib die Anzahl der Leerzeichen an, die ein Tab ersetzen.\nSetze die Anzahl auf Null, um Tabs auszugeben.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1816\"/>\n        <source>Enable line wrapping.</source>\n        <translation>Aktiviere den automatischen Zeilenumbruch.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1819\"/>\n        <source>Line wrapping</source>\n        <translation>Zeilenumbruch</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1824\"/>\n        <source>Enter the maximum line length.</source>\n        <translation>Gib die maximale Zeilenlänge ein.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1852\"/>\n        <source>Indent statements and function parameters after wrapping.</source>\n        <translation>Rücke Kommandos und Funktionsparameter nach dem Umbruch ein.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1855\"/>\n        <source>Intelligent wrapping</source>\n        <translation>Intelligenter Umbruch</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1881\"/>\n        <source>Font name:</source>\n        <translation>Schriftart:</translation>\n    </message>\n    <message>\n        <source>Select or enter the font name.</source>\n        <translation type=\"obsolete\">Wähle oder gib die Schriftart an.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1908\"/>\n        <source>Font size:</source>\n        <translation>Schriftgröße:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1924\"/>\n        <source>Enter the font size.</source>\n        <translation>Gib die Schriftgröße ein.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1997\"/>\n        <source>Visit andre-simon.de</source>\n        <translation>Besuche andre-simon.de</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"2008\"/>\n        <source>&amp;Dock floating panels</source>\n        <translation>&amp;Schwebende Fenster andocken</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"33\"/>\n        <source>Preview</source>\n        <translation>Vorschau</translation>\n    </message>\n    <message>\n        <source>Visit website</source>\n        <translation type=\"obsolete\">Website aufrufen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"341\"/>\n        <source>Start the conversion of your input files.</source>\n        <translation>Starte die Konvertierung der Eingabedateien.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"344\"/>\n        <source>Convert files</source>\n        <translation>Konvertieren</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"354\"/>\n        <source>Copy highlighted code of the seleted file into the clipboard.</source>\n        <translation>Kopiere den Inhalt der ausgewählten Datei mit Highlighting in die Zwischenablage.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"365\"/>\n        <source>Clipboard</source>\n        <translation>Zwischenablage</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"357\"/>\n        <source>Copy file to clipboard</source>\n        <translation>Datei in Zwischenablage</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"446\"/>\n        <source>Choose a plug-in script.</source>\n        <translation>Wähle ein Plug-In Skript aus.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"460\"/>\n        <source>List of plug-ins. Toggle checkbox to enable the scripts.</source>\n        <translation>Liste der Plug-Ins. Klicke auf die Checkboxen um Skripte zu aktivieren.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"475\"/>\n        <source>Remove the selected plug-ins.</source>\n        <translation>Entferne ausgewählte Plug-Ins aus der Liste.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"485\"/>\n        <source>Remove all plug-ins.</source>\n        <translation>Entferne alle Plug-Ins.</translation>\n    </message>\n    <message>\n        <source>Use the selected plugin.</source>\n        <translation type=\"obsolete\">Benutze das ausgewählte Plug-In.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"61\"/>\n        <source>Output progress:</source>\n        <translation>Ausgabefortschritt:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"89\"/>\n        <source>&amp;File</source>\n        <translation>&amp;Datei</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"97\"/>\n        <source>&amp;Help</source>\n        <translation>&amp;Hilfe</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"111\"/>\n        <source>&amp;Windows</source>\n        <translation>&amp;Fenster</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"131\"/>\n        <source>Highlighting options</source>\n        <translation>Hervorhebungs-Optionen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"497\"/>\n        <source>Description</source>\n        <translation>Beschreibung</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"503\"/>\n        <source>Shows decription of a selected plug-in script.</source>\n        <translation>Zeigt Beschreibung des ausgewählten Plug-In Skripts.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"506\"/>\n        <source>Plug-In description</source>\n        <translation>Plug-In Beschreibung</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"534\"/>\n        <source>Plug-in input file</source>\n        <translation>Plug-In Eingabedatei</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"543\"/>\n        <source>Optional path to a plug-in input file</source>\n        <translation>Optionaler Pfad zu einer Eingabedatei für Plug-In Skripte</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"550\"/>\n        <source>Select the plug-in input file.</source>\n        <translation>Wähle eine Plug-In Eingabedatei.</translation>\n    </message>\n    <message>\n        <source>Replace spaces by nbsp entities.</source>\n        <oldsource>Replace spaces by &amp;nbsp; entities.</oldsource>\n        <translation type=\"obsolete\">Ersetze Leerzeichen durch nbsp-Codes.</translation>\n    </message>\n    <message>\n        <source>Use non breaking spaces</source>\n        <translation type=\"obsolete\">Benutze geschützte Leerzeichen</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1860\"/>\n        <source>Do not add line numbering to lines which were automatically wrapped.</source>\n        <translation>Gib bei automatisch umgebrochenen Zeilen keine Nummerierung aus.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1863\"/>\n        <source>Omit line numbers of wrapped lines</source>\n        <translation>Keine Nummerierung bei Umbruch</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1896\"/>\n        <source>Select or enter the font name. HTML supports a list of fonts, separated with comma.</source>\n        <translation>Wähle oder gib den Fontnamen ein. HTML unterstützt auch eine mit Komma getrennte Liste von Fonts.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1939\"/>\n        <source>&amp;Open files</source>\n        <translation>Öffne &amp;Dateien</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1944\"/>\n        <source>&amp;Exit</source>\n        <translation>&amp;Beenden</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1949\"/>\n        <source>&amp;Load</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1954\"/>\n        <source>&amp;Save</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1959\"/>\n        <source>Load &amp;default project</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1964\"/>\n        <source>Readme</source>\n        <translation>Handbuch</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1969\"/>\n        <source>&amp;Tips</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1977\"/>\n        <source>&amp;Changelog</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1982\"/>\n        <source>&amp;License</source>\n        <translation>&amp;Lizenz</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1987\"/>\n        <source>&amp;About Highlight</source>\n        <translation>&amp;Über Highlight</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1992\"/>\n        <source>About &amp;translations</source>\n        <translation>&amp;Infos zu Übersetzungen</translation>\n    </message>\n</context>\n<context>\n    <name>ShowTextFile</name>\n    <message>\n        <location filename=\"showtextfile.ui\" line=\"17\"/>\n        <source>Show text</source>\n        <translation>Textanzeige</translation>\n    </message>\n    <message>\n        <location filename=\"showtextfile.ui\" line=\"37\"/>\n        <source>TextLabel</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"showtextfile.ui\" line=\"69\"/>\n        <source>OK</source>\n        <translation>OK</translation>\n    </message>\n</context>\n<context>\n    <name>io_report</name>\n    <message>\n        <location filename=\"io_report.ui\" line=\"14\"/>\n        <source>Error summary</source>\n        <translation>Fehlerübersicht</translation>\n    </message>\n    <message>\n        <location filename=\"io_report.ui\" line=\"24\"/>\n        <source>Input errors:</source>\n        <translation>Eingabefehler:</translation>\n    </message>\n    <message>\n        <location filename=\"io_report.ui\" line=\"34\"/>\n        <source>Remove files above from input file list</source>\n        <translation>Obige Dateien aus der Eingabeliste löschen</translation>\n    </message>\n    <message>\n        <location filename=\"io_report.ui\" line=\"48\"/>\n        <source>Output errors:</source>\n        <translation>Ausgabefehler:</translation>\n    </message>\n    <message>\n        <location filename=\"io_report.ui\" line=\"65\"/>\n        <source>Reformatting not possible:</source>\n        <translation>Neuformatierung nicht möglich:</translation>\n    </message>\n</context>\n</TS>\n"
  },
  {
    "path": "jni/highlight/gui-qt/highlight_es_ES.ts",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE TS>\n<TS version=\"2.0\" language=\"es_MX\">\n<context>\n    <name>MainWindow</name>\n    <message>\n        <source>Themes or indent schemes not found.\nCheck installation.</source>\n        <translation type=\"obsolete\">Temas o esquemas de indentación no encontrados\nRevise su instalación.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"94\"/>\n        <source>Initialization error</source>\n        <translation>Error de inicialización</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"95\"/>\n        <source>Could not find syntax definitions. Check installation.</source>\n        <translation>Definiciones de sintaxis no encontradas.\nRevise su instalacion.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"157\"/>\n        <source>Select one or more files to open</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"189\"/>\n        <source>Select destination directory</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <source>Tags file error</source>\n        <translation type=\"obsolete\">Error de archivo de etiquetas</translation>\n    </message>\n    <message>\n        <source>Could not read tags information in &quot;%1&quot;</source>\n        <translation type=\"obsolete\">No se pudieron leer las etiquetas de &quot;%1&quot;</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"700\"/>\n        <location filename=\"mainwindow.cpp\" line=\"731\"/>\n        <source>Output error</source>\n        <translation>Error de salida</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"700\"/>\n        <source>Output directory does not exist!</source>\n        <translation>¡Directorio de salida no existe!</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"731\"/>\n        <source>You must define a style output file!</source>\n        <translation>¡Debe especificar un archivo de estilo de salida!</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"770\"/>\n        <source>Language definition error</source>\n        <translation>Error de definición de lenguaje</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"771\"/>\n        <source>Invalid regular expression in %1:\n%2</source>\n        <translation>Expresión regular inválida en %1:\n%2</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"775\"/>\n        <source>Unknown syntax</source>\n        <translation>Sintaxis desconocida</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"775\"/>\n        <source>Could not convert %1</source>\n        <translation>No se pudo convertir %1</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"778\"/>\n        <source>Lua error</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"778\"/>\n        <source>Could not convert %1:\nLua Syntax error: %2</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"847\"/>\n        <source>Converted %1 files in %2 ms</source>\n        <translation>Se convirtieron%1 archivos en %2 ms</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"932\"/>\n        <source>Conversion of &quot;%1&quot; not possible.</source>\n        <translation>No es posible la conversión de &quot;%1&quot;.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"932\"/>\n        <location filename=\"mainwindow.cpp\" line=\"1036\"/>\n        <location filename=\"mainwindow.cpp\" line=\"1059\"/>\n        <source>clipboard data</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"990\"/>\n        <source>%1 options</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1035\"/>\n        <source>Preview (%1):</source>\n        <translation>Previsualización (%1):</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1038\"/>\n        <source>Current syntax: %1</source>\n        <translation>Sintaxis actual: %1</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1059\"/>\n        <source>Preview of &quot;%1&quot; not possible.</source>\n        <translation>No es posible previsualizar &quot;%1&quot;.</translation>\n    </message>\n    <message>\n        <source>Choose a ctags file</source>\n        <translation type=\"obsolete\">Elija un archivo de ctags</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1092\"/>\n        <location filename=\"mainwindow.cpp\" line=\"1096\"/>\n        <location filename=\"mainwindow.cpp\" line=\"1100\"/>\n        <location filename=\"mainwindow.cpp\" line=\"1105\"/>\n        <source>Choose a style include file</source>\n        <translation>Elija un archivo de inclusión de estilo</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1110\"/>\n        <source>About providing translations</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1111\"/>\n        <source>The GUI was developed using the Qt toolkit, and translations may be provided using the tools Qt Linguist and lrelease.\nThe highlight.ts file for Linguist resides in the src/gui-qt subdirectory.\nThe qm file generated by lrelease has to be saved in gui-files/l10n.\n\nPlease send a note to as (at) andre-simon (dot) de if you have issues during translating or if you have finished or updated a translation.</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1176\"/>\n        <source>Select one or more plug-ins</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"1214\"/>\n        <source>Choose a plug-in input file</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n</context>\n<context>\n    <name>MainWindowClass</name>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"163\"/>\n        <source>Choose the source code files you want to convert.</source>\n        <translation>Elijir los archivos fuente que desea convertir.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"169\"/>\n        <source>Choose input files</source>\n        <translation>Elijir archivos de entrada</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"195\"/>\n        <source>List of input files.</source>\n        <translation>Lista de archivos de entrada.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"219\"/>\n        <source>Remove the selected input files.</source>\n        <translation>Remover los archivos de entrada seleccionados.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"222\"/>\n        <location filename=\"mainwindow.ui\" line=\"478\"/>\n        <source>Clear selection</source>\n        <translation>Remover seleccionados</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"229\"/>\n        <source>Remove all input files.</source>\n        <translation>Remover todos los archivos de entrada.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"232\"/>\n        <location filename=\"mainwindow.ui\" line=\"488\"/>\n        <source>Clear all</source>\n        <translation>Remover todos</translation>\n    </message>\n    <message>\n        <source>Output destination</source>\n        <translation type=\"obsolete\">Destino de salida</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"271\"/>\n        <source>Output directory</source>\n        <translation>Directorio de salida</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"290\"/>\n        <source>Select the output directory.</source>\n        <translation>Elijir el directorio de salida.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"293\"/>\n        <location filename=\"mainwindow.ui\" line=\"553\"/>\n        <location filename=\"mainwindow.ui\" line=\"1046\"/>\n        <location filename=\"mainwindow.ui\" line=\"1283\"/>\n        <location filename=\"mainwindow.ui\" line=\"1379\"/>\n        <location filename=\"mainwindow.ui\" line=\"1615\"/>\n        <source>...</source>\n        <translation>...</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"302\"/>\n        <source>Save output in the input file directories.</source>\n        <translation>Guardar salida en los directorios de entrada de cada archivo.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"305\"/>\n        <source>Write to source directories</source>\n        <translation>Guardar a los directorios de origen</translation>\n    </message>\n    <message>\n        <source>Output options</source>\n        <translation type=\"obsolete\">Opciones de salida</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"598\"/>\n        <source>General</source>\n        <translation>General</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"618\"/>\n        <source>Output format:</source>\n        <translation>Formato de salida:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"640\"/>\n        <source>Choose an output format.</source>\n        <translation>Elija un formato de salida.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"644\"/>\n        <source>HTML</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"649\"/>\n        <source>XHTML</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"654\"/>\n        <source>LaTeX</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"659\"/>\n        <source>TeX</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"664\"/>\n        <source>RTF</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"669\"/>\n        <source>ODT</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"674\"/>\n        <source>SVG</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"698\"/>\n        <source>Add line numbers to the output.</source>\n        <translation>Agregar números de linea a la salida.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"701\"/>\n        <source>Add line numbers</source>\n        <translation>Agregar números de linea</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"721\"/>\n        <source>Set line numbering start</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"740\"/>\n        <source>Select the line number width.</source>\n        <translation>Seleccione el ancho de número de linea.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"761\"/>\n        <source>Fill leading space of line numbers with zeroes.</source>\n        <translation>Llenar espacio antes de los números de lineas con ceros.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"764\"/>\n        <source>Pad with zeroes</source>\n        <translation>Rellenar con ceros</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"777\"/>\n        <source>Generate output without document header and footer.</source>\n        <translation>Generar documento de salida con cabecera y pie de página.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"780\"/>\n        <source>Omit header and footer</source>\n        <translation>Omitir cabecera y pie de página</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"787\"/>\n        <source>Test if input data is not binary.\nRemoves Unicode BOM mark.</source>\n        <translation>Probar si los datos de entrada no son binarios.\nRemueve marca BOM de Unicode.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"791\"/>\n        <source>Validate input data</source>\n        <translation>Validar datos de entrada</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"800\"/>\n        <source>Set the output file ancoding.</source>\n        <translation>Ajuste la codificación del archivo de salida.</translation>\n    </message>\n    <message>\n        <source>Encoding:</source>\n        <translation type=\"obsolete\">Codificación:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"810\"/>\n        <source>Select or define the encoding.\nThe result has to match the input file encoding.</source>\n        <translation>Elija o defina la codificación.\nEl resultado tiene que corresponder a la codificación del archivo de entrada.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"821\"/>\n        <source>ISO-8859-1</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"826\"/>\n        <source>ISO-8859-2</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"831\"/>\n        <source>ISO-8859-3</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"836\"/>\n        <source>ISO-8859-4</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"841\"/>\n        <source>ISO-8859-5</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"846\"/>\n        <source>ISO-8859-6</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"851\"/>\n        <source>ISO-8859-7</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"856\"/>\n        <source>ISO-8859-8</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"861\"/>\n        <source>ISO-8859-9</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"866\"/>\n        <source>ISO-8859-10</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"871\"/>\n        <source>ISO-8859-11</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"876\"/>\n        <source>ISO-8859-12</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"881\"/>\n        <source>ISO-8859-13</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"886\"/>\n        <source>ISO-8859-14</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"891\"/>\n        <source>ISO-8859-15</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"896\"/>\n        <source>UTF-8</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"920\"/>\n        <source>Output specific</source>\n        <translation>Esoecificas de salida</translation>\n    </message>\n    <message>\n        <source>HTML options</source>\n        <translation type=\"obsolete\">Opciones de HTML</translation>\n    </message>\n    <message>\n        <source>Style</source>\n        <translation type=\"obsolete\">Hoja de estilo</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"969\"/>\n        <location filename=\"mainwindow.ui\" line=\"1213\"/>\n        <location filename=\"mainwindow.ui\" line=\"1309\"/>\n        <location filename=\"mainwindow.ui\" line=\"1545\"/>\n        <source>Include the style information in each output file.</source>\n        <translation>Incluir la información de estilo en cada archivo de salida.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"972\"/>\n        <location filename=\"mainwindow.ui\" line=\"1548\"/>\n        <source>Embed style (CSS)</source>\n        <translation>Incrustar estilo (CSS)</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"985\"/>\n        <source>Add CSS information to each tag (do not use CSS class definitions).</source>\n        <translation>Agregar información de CSS a cada etiqueta (no utilizar definiciones de clase de CSS).</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"988\"/>\n        <source>Inline CSS</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>Style file:</source>\n        <translation type=\"obsolete\">Archivo de estilo:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1015\"/>\n        <location filename=\"mainwindow.ui\" line=\"1331\"/>\n        <location filename=\"mainwindow.ui\" line=\"1567\"/>\n        <source>Name of the referenced style file.</source>\n        <translation>Nombre del archivo de estilo citado.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1018\"/>\n        <location filename=\"mainwindow.ui\" line=\"1570\"/>\n        <source>highlight.css</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>Style include file:</source>\n        <translation type=\"obsolete\">Archivo de estilo a incluir:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1036\"/>\n        <location filename=\"mainwindow.ui\" line=\"1605\"/>\n        <source>Path of the CSS include file.</source>\n        <translation>Ruta del archivo CSS a incluir.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1043\"/>\n        <source>Select a CSS include file.</source>\n        <translation>Seleccionar un archivo CSS a incluir.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1057\"/>\n        <source>CSS class prefix:</source>\n        <translation>Prefijo de clase de CSS:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1064\"/>\n        <source>Add a CSS class name prefix to avoid namespace clashes.</source>\n        <translation>Agregue un prefijo de nombre de clase de CSS para evitar conflictos.</translation>\n    </message>\n    <message>\n        <source>Tags and index files</source>\n        <translation type=\"obsolete\">Archivos de etiquetas e índice</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1142\"/>\n        <source>Generate an index file with hyperlinks to all outputted files.</source>\n        <translation>Generar un archivo de indice con enlaces a todos los archivos de salida.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1145\"/>\n        <source>Generate index file</source>\n        <translation>Generar archivo de índice</translation>\n    </message>\n    <message>\n        <source>Read a ctags file and add the included metainformation as tooltips.\nSee ctags.sf.net for details.</source>\n        <translation type=\"obsolete\">Leer un archivo de ctags y agregar la metainformación incluida como aviso emergente.\nVea ctags.sf.net para más detalles.</translation>\n    </message>\n    <message>\n        <source>Ctags file:</source>\n        <translation type=\"obsolete\">Archivo de ctags:</translation>\n    </message>\n    <message>\n        <source>Path of the ctags file.</source>\n        <translation type=\"obsolete\">Ruta del archivo de ctags.</translation>\n    </message>\n    <message>\n        <source>Choose a ctags file.</source>\n        <translation type=\"obsolete\">Elijir un archivo de ctags.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1093\"/>\n        <source>Misc</source>\n        <translation>Miscelaneo</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1112\"/>\n        <source>Add an achor to each line.</source>\n        <translation>Agregar una ancla a cada linea.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1115\"/>\n        <source>Add line anchors</source>\n        <translation>Agregar ancla por linea</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1122\"/>\n        <source>Add the filename as prefix to the anchors.</source>\n        <translation>Agregar el nombre de archivo como prefijo a las anclas.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1125\"/>\n        <source>Include file name in anchor</source>\n        <translation>Incluir el nombre de archivo en el ancla</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1132\"/>\n        <source>Output the lines within an ordered list.</source>\n        <translation>Producir las lineas de salida dentro de una lista ordenada.</translation>\n    </message>\n    <message>\n        <source>Ordered list</source>\n        <translation type=\"obsolete\">Lista ordenada</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1152\"/>\n        <source>Add &amp;lt;pre&amp;gt; tags to the output, if the flag &quot;No document header and footer&quot; is selected.</source>\n        <translation>Agregar etiquetas &amp;lt;pre&amp;gt; a la salida, si la opción &quot;Sin cabecera ni pie de página&quot; está seleccionada.</translation>\n    </message>\n    <message>\n        <source>Enclose in &lt;pre&gt;</source>\n        <translation type=\"obsolete\">Meter entre &amp;lt;pre&amp;gt;</translation>\n    </message>\n    <message>\n        <source>LaTeX options</source>\n        <translation type=\"obsolete\">Opciones de LaTeX</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1183\"/>\n        <source>Replace quotes by dq sequences.</source>\n        <translation>Reemplazar comillas por sucesiones de dobles comillas.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1186\"/>\n        <source>Escape quotes</source>\n        <translation>Sobrepasar comillas</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1193\"/>\n        <source>Make output Babel compatible.</source>\n        <translation>Hacer que la salida se compatible con Babel.</translation>\n    </message>\n    <message>\n        <source>Babel compatibility</source>\n        <translation type=\"obsolete\">Compatibilidad con Babel</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1203\"/>\n        <source>Replace default symbols (brackets, tilde) by nice redefinitions.</source>\n        <translation>Reemplazar símbolos por defecto (llaves, corchetes, tildes) por redefiniciones apropiadas.</translation>\n    </message>\n    <message>\n        <source>Pretty symbols</source>\n        <translation type=\"obsolete\">Símbolos lindos</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1216\"/>\n        <source>Embed style (defs)</source>\n        <translation>Incrustar estilo</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1235\"/>\n        <source>Name of the referenced  style file.</source>\n        <translation>Nombre del archivo de estilo citado.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1238\"/>\n        <location filename=\"mainwindow.ui\" line=\"1334\"/>\n        <source>highlight.sty</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>Style include:</source>\n        <translation type=\"obsolete\">Incluir estilo:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"803\"/>\n        <source>Set encoding:</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"256\"/>\n        <source>Output destination:</source>\n        <translation>Destino de salida</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1002\"/>\n        <location filename=\"mainwindow.ui\" line=\"1225\"/>\n        <location filename=\"mainwindow.ui\" line=\"1321\"/>\n        <location filename=\"mainwindow.ui\" line=\"1557\"/>\n        <source>Stylesheet file:</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1249\"/>\n        <location filename=\"mainwindow.ui\" line=\"1345\"/>\n        <location filename=\"mainwindow.ui\" line=\"1581\"/>\n        <source>Stylesheet include file:</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"20\"/>\n        <source>Highlight</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"157\"/>\n        <source>Files</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"371\"/>\n        <source>Paste clipboard content into the preview window.</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"374\"/>\n        <source>Paste from clipboard</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"416\"/>\n        <source>Copy highlighted code into the clipboard.</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"419\"/>\n        <source>Copy preview to clipboard</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"387\"/>\n        <source>Select syntax:</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"111\"/>\n        <source>&amp;Windows</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"131\"/>\n        <source>Highlighting options</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"394\"/>\n        <source>Select the correct syntax of the code snippet.</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"440\"/>\n        <source>Plug-ins</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"449\"/>\n        <source>Add plug-in to pool</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"497\"/>\n        <source>Description</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"503\"/>\n        <source>Shows decription of a selected plug-in script.</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"506\"/>\n        <source>Plug-In description</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"534\"/>\n        <source>Plug-in input file</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"543\"/>\n        <source>Optional path to a plug-in input file</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"550\"/>\n        <source>Select the plug-in input file.</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"679\"/>\n        <source>BBCode</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"961\"/>\n        <source>Stylesheets</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1029\"/>\n        <source>Include:</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1105\"/>\n        <source>Line numbering options:</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1135\"/>\n        <source>Output as ordered list</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1155\"/>\n        <source>Enclose in pre tags</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1196\"/>\n        <source>Add Babel compatibility</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1206\"/>\n        <source>Add pretty symbols</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1273\"/>\n        <location filename=\"mainwindow.ui\" line=\"1369\"/>\n        <source>Path of the style include file.</source>\n        <translation>Ruta del archivo de estilo a incluir.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1280\"/>\n        <location filename=\"mainwindow.ui\" line=\"1376\"/>\n        <location filename=\"mainwindow.ui\" line=\"1612\"/>\n        <source>Select a style include file.</source>\n        <translation>Seleccione un archivo de estilo a incluir.</translation>\n    </message>\n    <message>\n        <source>TeX options</source>\n        <translation type=\"obsolete\">Opciones de TeX</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1312\"/>\n        <source>Embed style (macros)</source>\n        <translation>Estilo de incrustación (macros)</translation>\n    </message>\n    <message>\n        <source>RTF options</source>\n        <translation type=\"obsolete\">Opciones de RTF</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1405\"/>\n        <source>Add character stylesheets with formatting information.\nYou can select the stylesheets in your word processor to reformat additional text.</source>\n        <translation>Agregar hojas de estilo de caracteres con informacion de formato.\nPuede selecionar la hoja de estilo en su procesador de textos para dar formato nuevamente a texto adicional.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1409\"/>\n        <source>Add character styles</source>\n        <translation>Agregar estilos de caracteres</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1418\"/>\n        <source>Page size:</source>\n        <translation>Tamaño de paǵina:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1425\"/>\n        <source>Select a page size.</source>\n        <translation>Seleccionar un tamaño de página.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1432\"/>\n        <source>A3</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1437\"/>\n        <source>A4</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1442\"/>\n        <source>A5</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1447\"/>\n        <source>B4</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1452\"/>\n        <source>B5</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1457\"/>\n        <source>B6</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1462\"/>\n        <source>Letter</source>\n        <translation>Carta</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1467\"/>\n        <source>Legal</source>\n        <translation>Oficio</translation>\n    </message>\n    <message>\n        <source>SVG options</source>\n        <translation type=\"obsolete\">Opciones de SVG</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1494\"/>\n        <source>Image size:</source>\n        <translation>Tamaño de la imagen:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1503\"/>\n        <source>Width:</source>\n        <translation>Ancho:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1519\"/>\n        <source>Enter the SVG width (may contain units).</source>\n        <translation>Introducir el ancho de SVG (puede incluir unidades).</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1526\"/>\n        <source>Height:</source>\n        <translation>Alto:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1536\"/>\n        <source>Enter the SVG height (may contain units).</source>\n        <translation>Introducir el alto de SVG (puede incluir unidades).</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1641\"/>\n        <source>No options defined.</source>\n        <translation>No hay opciones definidas.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1666\"/>\n        <source>Formatting</source>\n        <translation>Formato</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1680\"/>\n        <source>Color theme:</source>\n        <translation>Tema de color:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1696\"/>\n        <source>Select a colour theme.</source>\n        <translation>Seleccionar un tema de color.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1710\"/>\n        <source>Reformat and indent your code.\nThis feature is enabled tor C, C++, C# and Java code.</source>\n        <translation>Dar formato nuevamente e indentar su código.\nEsta propiedad esta habilitada para código en C, C++, C# y Java.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1714\"/>\n        <source>Reformat:</source>\n        <translation>Dar formato nuevamente:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1727\"/>\n        <source>Choose a formatting scheme.</source>\n        <translation>Elija un esquema de formato.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1741\"/>\n        <source>Change the keyword case.</source>\n        <translation>Cambiar mayúsculas/minúsculas en palabras reservadas.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1744\"/>\n        <source>Keyword case:</source>\n        <translation>Mayúsculas/minúsculas de palabras reservadas:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1757\"/>\n        <source>Select a keyword case.</source>\n        <translation>Seleccione un estilo de mayúsculas/minúsculas.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1761\"/>\n        <source>UPPER</source>\n        <translation>MAYÚSCULAS</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1766\"/>\n        <source>lower</source>\n        <translation>minúsculas</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1771\"/>\n        <source>Capitalize</source>\n        <translation>Primera Letra Mayúscula</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1789\"/>\n        <source>Tab width:</source>\n        <translation>Ancho de tabulador:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1799\"/>\n        <source>Enter the number of spaces which replace a tab.\nSet the width to 0 to keep tabs.</source>\n        <translation>Introducir el número de espacios que reemplazaran un tabulador.\nEn caso de ser 0 se mantendrán los tabuladores.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1816\"/>\n        <source>Enable line wrapping.</source>\n        <translation>Habilitar romper lineas.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1819\"/>\n        <source>Line wrapping</source>\n        <translation>Romper lineas</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1824\"/>\n        <source>Enter the maximum line length.</source>\n        <translation>Introducir longitud máxima de linea.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1852\"/>\n        <source>Indent statements and function parameters after wrapping.</source>\n        <translation>Indentar instrucciones y parámetros de funciones después de romper la linea.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1855\"/>\n        <source>Intelligent wrapping</source>\n        <translation>Rompido inteligente</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1881\"/>\n        <source>Font name:</source>\n        <translation>Nombre de la fuente:</translation>\n    </message>\n    <message>\n        <source>Select or enter the font name.</source>\n        <translation type=\"obsolete\">Seleccionar o introduzcir el nombre de la fuente.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1908\"/>\n        <source>Font size:</source>\n        <translation>Tamaño de la fuente:</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1924\"/>\n        <source>Enter the font size.</source>\n        <translation>Introducir el tamaño de la fuente.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1997\"/>\n        <source>Visit andre-simon.de</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"2008\"/>\n        <source>&amp;Dock floating panels</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"33\"/>\n        <source>Preview</source>\n        <translation>Previsualización</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"341\"/>\n        <source>Start the conversion of your input files.</source>\n        <translation>Comenzar la conversión de los archivos de entrada.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"344\"/>\n        <source>Convert files</source>\n        <translation>Convertir archivos</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"354\"/>\n        <source>Copy highlighted code of the seleted file into the clipboard.</source>\n        <translation>Copiar codigo resaltado del archivo seleccionado al portapapeles.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"365\"/>\n        <source>Clipboard</source>\n        <translation>Portapapeles</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"357\"/>\n        <source>Copy file to clipboard</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"446\"/>\n        <source>Choose a plug-in script.</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"460\"/>\n        <source>List of plug-ins. Toggle checkbox to enable the scripts.</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"475\"/>\n        <source>Remove the selected plug-ins.</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"485\"/>\n        <source>Remove all plug-ins.</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"61\"/>\n        <source>Output progress:</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"89\"/>\n        <source>&amp;File</source>\n        <translation>&amp;Archivo</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"97\"/>\n        <source>&amp;Help</source>\n        <translation>Ay&amp;uda</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1860\"/>\n        <source>Do not add line numbering to lines which were automatically wrapped.</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1863\"/>\n        <source>Omit line numbers of wrapped lines</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1896\"/>\n        <source>Select or enter the font name. HTML supports a list of fonts, separated with comma.</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1939\"/>\n        <source>&amp;Open files</source>\n        <translation>Ab&amp;rir archivos</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1944\"/>\n        <source>&amp;Exit</source>\n        <translation>&amp;Salir</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1949\"/>\n        <source>&amp;Load</source>\n        <translation>&amp;Cargar</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1954\"/>\n        <source>&amp;Save</source>\n        <translation>&amp;Guardar</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1959\"/>\n        <source>Load &amp;default project</source>\n        <translation>Cargar proyecto por &amp;defecto</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1964\"/>\n        <source>Readme</source>\n        <translation>Leeme</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1969\"/>\n        <source>&amp;Tips</source>\n        <translation>A&amp;visos</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1977\"/>\n        <source>&amp;Changelog</source>\n        <translation>&amp;Bitácora de cambios</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1982\"/>\n        <source>&amp;License</source>\n        <translation>&amp;Licencia</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1987\"/>\n        <source>&amp;About Highlight</source>\n        <translation>&amp;Acerca de Highlight</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"1992\"/>\n        <source>About &amp;translations</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n</context>\n<context>\n    <name>ShowTextFile</name>\n    <message>\n        <location filename=\"showtextfile.ui\" line=\"17\"/>\n        <source>Show text</source>\n        <translation>Mostrar texto</translation>\n    </message>\n    <message>\n        <location filename=\"showtextfile.ui\" line=\"37\"/>\n        <source>TextLabel</source>\n        <translation>EtiquetaDeTexto</translation>\n    </message>\n    <message>\n        <location filename=\"showtextfile.ui\" line=\"69\"/>\n        <source>OK</source>\n        <translation>OK</translation>\n    </message>\n</context>\n<context>\n    <name>io_report</name>\n    <message>\n        <location filename=\"io_report.ui\" line=\"14\"/>\n        <source>Error summary</source>\n        <translation>Resumen de Error</translation>\n    </message>\n    <message>\n        <location filename=\"io_report.ui\" line=\"24\"/>\n        <source>Input errors:</source>\n        <translation>Errores de entrada:</translation>\n    </message>\n    <message>\n        <location filename=\"io_report.ui\" line=\"34\"/>\n        <source>Remove files above from input file list</source>\n        <translation>Remover archivos mencionados de la lista de archivos de entrada</translation>\n    </message>\n    <message>\n        <location filename=\"io_report.ui\" line=\"48\"/>\n        <source>Output errors:</source>\n        <translation>Errores de salida:</translation>\n    </message>\n    <message>\n        <location filename=\"io_report.ui\" line=\"65\"/>\n        <source>Reformatting not possible:</source>\n        <translation>No es posible dar formato nuevamente:</translation>\n    </message>\n</context>\n</TS>\n"
  },
  {
    "path": "jni/highlight/gui-qt/highlight_zh_CN.ts",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE TS>\n<TS version=\"2.0\" language=\"zh_CN\">\n<context>\n    <name>@default</name>\n    <message>\n        <source>Initialization error</source>\n        <translation type=\"obsolete\">初始化错误</translation>\n    </message>\n    <message>\n        <source>Could not find syntax definitions. Check installation.</source>\n        <translation type=\"obsolete\">找不到语法定义文件.请检查安装.</translation>\n    </message>\n    <message>\n        <source>Select one or more files to open</source>\n        <translation type=\"obsolete\">选择一个或多个文件打开</translation>\n    </message>\n    <message>\n        <source>Select destination directory</source>\n        <translation type=\"obsolete\">选择目标路径</translation>\n    </message>\n    <message>\n        <source>Tags file error</source>\n        <translation type=\"obsolete\">Tags文件错误</translation>\n    </message>\n    <message>\n        <source>Could not read tags information in &quot;%1&quot;</source>\n        <translation type=\"obsolete\">无法读取 &quot;%1&quot; 的Tag信息</translation>\n    </message>\n    <message>\n        <source>Output error</source>\n        <translation type=\"obsolete\">输出错误</translation>\n    </message>\n    <message>\n        <source>Output directory does not exist!</source>\n        <translation type=\"obsolete\">输出目录错误！</translation>\n    </message>\n    <message>\n        <source>You must define a style output file!</source>\n        <translation type=\"obsolete\">你必须等译一个style输出文件！</translation>\n    </message>\n    <message>\n        <source>Language definition error</source>\n        <translation type=\"obsolete\">语言定义错误</translation>\n    </message>\n    <message>\n        <source>Invalid regular expression in %1:\n%2</source>\n        <translation type=\"obsolete\">错误的正则表达式 %1:\n%2</translation>\n    </message>\n    <message>\n        <source>Unknown syntax</source>\n        <translation type=\"obsolete\">未知的语法定义</translation>\n    </message>\n    <message>\n        <source>Could not convert %1</source>\n        <translation type=\"obsolete\">%1转换失败</translation>\n    </message>\n    <message>\n        <source>Converted %1 files in %2 ms</source>\n        <translation type=\"obsolete\">文件%1 转换完毕，用时 %2 ms</translation>\n    </message>\n    <message>\n        <source>Conversion of &quot;%1&quot; not possible.</source>\n        <translation type=\"obsolete\">%1 转换不可用.</translation>\n    </message>\n    <message>\n        <source>clipboard data</source>\n        <translation type=\"obsolete\">剪贴板数据</translation>\n    </message>\n    <message>\n        <source>%1 options</source>\n        <translation type=\"obsolete\">%1 选项</translation>\n    </message>\n    <message>\n        <source>Preview (%1):</source>\n        <translation type=\"obsolete\">预览 (%1):</translation>\n    </message>\n    <message>\n        <source>Current syntax: %1</source>\n        <translation type=\"obsolete\">当前语言: %1</translation>\n    </message>\n    <message>\n        <source>Preview of &quot;%1&quot; not possible.</source>\n        <translation type=\"obsolete\">&quot;%1&quot;.的预览不可用.</translation>\n    </message>\n    <message>\n        <source>Choose a ctags file</source>\n        <translation type=\"obsolete\">选择一个ctags文件</translation>\n    </message>\n    <message>\n        <source>Choose a style include file</source>\n        <translation type=\"obsolete\">选择一个style文件</translation>\n    </message>\n    <message>\n        <source>About providing translations</source>\n        <translation type=\"obsolete\">关于提供翻译文件</translation>\n    </message>\n    <message>\n        <source>The GUI was developed using the Qt toolkit, and translations may be provided using the tools Qt Linguist and lrelease.\nThe highlight.ts file for Linguist resides in the src/gui-qt subdirectory.\nThe qm file generated by lrelease has to be saved in gui-files/l10n.\n\nPlease send a note to as (at) andre-simon (dot) de if you have issues during translating or if you have finished or updated a translation.</source>\n        <translation type=\"obsolete\">这个GUI界面程序使用Qt开发，翻译可以通过Qt开发工具中的Qt Linguist和lrelease.\n用于翻译的highlight.ts文件保存在src/gui-qt子目录中.\n通过lrelease生成的qm文件需要保存在gui-files/l10n目录下.\n如果你在翻译过程中遇到了问题，或者你弯沉或者更新了翻译\n请通过as (at) andre-simon (dot) de联系我.</translation>\n    </message>\n    <message>\n        <source>Select one or more plug-ins</source>\n        <translation type=\"obsolete\">选择一个或多个插件</translation>\n    </message>\n    <message>\n        <source>Choose a plug-in input file</source>\n        <translation type=\"obsolete\">选择插件输入目录</translation>\n    </message>\n</context>\n<context>\n    <name>MainWindow</name>\n    <message>\n        <source>Themes or indent schemes not found.\nCheck installation.</source>\n        <translation type=\"obsolete\">Temas o esquemas de indentación no encontrados\nRevise su instalación.</translation>\n    </message>\n    <message>\n        <location filename=\"mainwindow.cpp\" line=\"+94\"/>\n        <source>Initialization error</source>\n        <translation type=\"unfinished\">初始化错误</translation>\n    </message>\n    <message>\n        <location line=\"+1\"/>\n        <source>Could not find syntax definitions. Check installation.</source>\n        <translation type=\"unfinished\">找不到语法定义文件.请检查安装.</translation>\n    </message>\n    <message>\n        <location line=\"+62\"/>\n        <source>Select one or more files to open</source>\n        <translation type=\"unfinished\">选择一个或多个文件打开</translation>\n    </message>\n    <message>\n        <location line=\"+32\"/>\n        <source>Select destination directory</source>\n        <translation type=\"unfinished\">选择目标路径</translation>\n    </message>\n    <message>\n        <source>Tags file error</source>\n        <translation type=\"obsolete\">Tags文件错误</translation>\n    </message>\n    <message>\n        <source>Could not read tags information in &quot;%1&quot;</source>\n        <translation type=\"obsolete\">无法读取 &quot;%1&quot; 的Tag信息</translation>\n    </message>\n    <message>\n        <location line=\"+511\"/>\n        <location line=\"+31\"/>\n        <source>Output error</source>\n        <translation type=\"unfinished\">输出错误</translation>\n    </message>\n    <message>\n        <location line=\"-31\"/>\n        <source>Output directory does not exist!</source>\n        <translation type=\"unfinished\">输出目录错误！</translation>\n    </message>\n    <message>\n        <location line=\"+31\"/>\n        <source>You must define a style output file!</source>\n        <translation type=\"unfinished\">你必须等译一个style输出文件！</translation>\n    </message>\n    <message>\n        <location line=\"+39\"/>\n        <source>Language definition error</source>\n        <translation type=\"unfinished\">语言定义错误</translation>\n    </message>\n    <message>\n        <location line=\"+1\"/>\n        <source>Invalid regular expression in %1:\n%2</source>\n        <translation type=\"unfinished\">错误的正则表达式 %1:\n%2</translation>\n    </message>\n    <message>\n        <location line=\"+4\"/>\n        <source>Unknown syntax</source>\n        <translation type=\"unfinished\">未知的语法定义</translation>\n    </message>\n    <message>\n        <location line=\"+0\"/>\n        <source>Could not convert %1</source>\n        <translation type=\"unfinished\">%1转换失败</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Lua error</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location line=\"+0\"/>\n        <source>Could not convert %1:\nLua Syntax error: %2</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location line=\"+69\"/>\n        <source>Converted %1 files in %2 ms</source>\n        <translation type=\"unfinished\">文件%1 转换完毕，用时 %2 ms</translation>\n    </message>\n    <message>\n        <location line=\"+85\"/>\n        <source>Conversion of &quot;%1&quot; not possible.</source>\n        <translation type=\"unfinished\">No es posible la conversión de &quot;%1&quot;.</translation>\n    </message>\n    <message>\n        <location line=\"+0\"/>\n        <location line=\"+104\"/>\n        <location line=\"+23\"/>\n        <source>clipboard data</source>\n        <translation type=\"unfinished\">剪贴板数据</translation>\n    </message>\n    <message>\n        <location line=\"-69\"/>\n        <source>%1 options</source>\n        <translation type=\"unfinished\">%1 选项</translation>\n    </message>\n    <message>\n        <location line=\"+45\"/>\n        <source>Preview (%1):</source>\n        <translation type=\"unfinished\">预览 (%1):</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Current syntax: %1</source>\n        <translation type=\"unfinished\">当前语言: %1</translation>\n    </message>\n    <message>\n        <location line=\"+21\"/>\n        <source>Preview of &quot;%1&quot; not possible.</source>\n        <translation type=\"unfinished\">&quot;%1&quot;.的预览不可用.</translation>\n    </message>\n    <message>\n        <source>Choose a ctags file</source>\n        <translation type=\"obsolete\">选择一个ctags文件</translation>\n    </message>\n    <message>\n        <location line=\"+33\"/>\n        <location line=\"+4\"/>\n        <location line=\"+4\"/>\n        <location line=\"+5\"/>\n        <source>Choose a style include file</source>\n        <translation type=\"unfinished\">选择一个style文件</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>About providing translations</source>\n        <translation type=\"unfinished\">关于提供翻译文件</translation>\n    </message>\n    <message>\n        <location line=\"+1\"/>\n        <source>The GUI was developed using the Qt toolkit, and translations may be provided using the tools Qt Linguist and lrelease.\nThe highlight.ts file for Linguist resides in the src/gui-qt subdirectory.\nThe qm file generated by lrelease has to be saved in gui-files/l10n.\n\nPlease send a note to as (at) andre-simon (dot) de if you have issues during translating or if you have finished or updated a translation.</source>\n        <translation type=\"unfinished\">这个GUI界面程序使用Qt开发，翻译可以通过Qt开发工具中的Qt Linguist和lrelease.\n用于翻译的highlight.ts文件保存在src/gui-qt子目录中.\n通过lrelease生成的qm文件需要保存在gui-files/l10n目录下.\n如果你在翻译过程中遇到了问题，或者你弯沉或者更新了翻译\n请通过as (at) andre-simon (dot) de联系我.</translation>\n    </message>\n    <message>\n        <location line=\"+65\"/>\n        <source>Select one or more plug-ins</source>\n        <translation type=\"unfinished\">选择一个或多个插件</translation>\n    </message>\n    <message>\n        <location line=\"+38\"/>\n        <source>Choose a plug-in input file</source>\n        <translation type=\"unfinished\">选择插件输入目录</translation>\n    </message>\n</context>\n<context>\n    <name>MainWindowClass</name>\n    <message>\n        <location filename=\"mainwindow.ui\" line=\"+163\"/>\n        <source>Choose the source code files you want to convert.</source>\n        <translation>选择你想要转换的代码文件.</translation>\n    </message>\n    <message>\n        <location line=\"+6\"/>\n        <source>Choose input files</source>\n        <translation>选择输入文件</translation>\n    </message>\n    <message>\n        <location line=\"+26\"/>\n        <source>List of input files.</source>\n        <translation>输入文件列表.</translation>\n    </message>\n    <message>\n        <location line=\"+24\"/>\n        <source>Remove the selected input files.</source>\n        <translation>移除选中的输入文件.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <location line=\"+256\"/>\n        <source>Clear selection</source>\n        <translation>移除选中项</translation>\n    </message>\n    <message>\n        <location line=\"-249\"/>\n        <source>Remove all input files.</source>\n        <translation>清除所有输入文件.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <location line=\"+256\"/>\n        <source>Clear all</source>\n        <translation>移除所有</translation>\n    </message>\n    <message>\n        <source>Output destination</source>\n        <translation type=\"obsolete\">Destino de salida</translation>\n    </message>\n    <message>\n        <location line=\"-217\"/>\n        <source>Output directory</source>\n        <translation>输出目录</translation>\n    </message>\n    <message>\n        <location line=\"+19\"/>\n        <source>Select the output directory.</source>\n        <translation>选择输出路径.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <location line=\"+260\"/>\n        <location line=\"+493\"/>\n        <location line=\"+237\"/>\n        <location line=\"+96\"/>\n        <location line=\"+236\"/>\n        <source>...</source>\n        <translation>...</translation>\n    </message>\n    <message>\n        <location line=\"-1313\"/>\n        <source>Save output in the input file directories.</source>\n        <translation>将输出保存在输入路径中.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Write to source directories</source>\n        <translation>输出到源文件目录</translation>\n    </message>\n    <message>\n        <source>Output options</source>\n        <translation type=\"obsolete\">Opciones de salida</translation>\n    </message>\n    <message>\n        <location line=\"+293\"/>\n        <source>General</source>\n        <translation>通用</translation>\n    </message>\n    <message>\n        <location line=\"+20\"/>\n        <source>Output format:</source>\n        <translation>输出格式：</translation>\n    </message>\n    <message>\n        <location line=\"+22\"/>\n        <source>Choose an output format.</source>\n        <translation>选择一个输出格式.</translation>\n    </message>\n    <message>\n        <location line=\"+4\"/>\n        <source>HTML</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>XHTML</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>LaTeX</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>TeX</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>RTF</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ODT</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>SVG</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+24\"/>\n        <source>Add line numbers to the output.</source>\n        <translation>给输出添加代码行号.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Add line numbers</source>\n        <translation>添加行号</translation>\n    </message>\n    <message>\n        <location line=\"+20\"/>\n        <source>Set line numbering start</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location line=\"+19\"/>\n        <source>Select the line number width.</source>\n        <translation>选择行号宽度.</translation>\n    </message>\n    <message>\n        <location line=\"+21\"/>\n        <source>Fill leading space of line numbers with zeroes.</source>\n        <translation>行号用0补齐.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Pad with zeroes</source>\n        <translation>行号用0补齐</translation>\n    </message>\n    <message>\n        <location line=\"+13\"/>\n        <source>Generate output without document header and footer.</source>\n        <translation>去掉输出文件的头部和尾部声明部分,便于将其插入其他文档中.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Omit header and footer</source>\n        <translation>去掉文档的头部和尾部声明</translation>\n    </message>\n    <message>\n        <location line=\"+7\"/>\n        <source>Test if input data is not binary.\nRemoves Unicode BOM mark.</source>\n        <translation>检测输入文件是否是二进制.\n清除Unicode的BOM标记.</translation>\n    </message>\n    <message>\n        <location line=\"+4\"/>\n        <source>Validate input data</source>\n        <translation>验证输入文件</translation>\n    </message>\n    <message>\n        <location line=\"+9\"/>\n        <source>Set the output file ancoding.</source>\n        <translation>设置输出文件的编码格式.</translation>\n    </message>\n    <message>\n        <source>Encoding:</source>\n        <translation type=\"obsolete\">Codificación:</translation>\n    </message>\n    <message>\n        <location line=\"+10\"/>\n        <source>Select or define the encoding.\nThe result has to match the input file encoding.</source>\n        <translation>选择或者定义编码格式.\n结果必须和输出文件的编码格式相符合.</translation>\n    </message>\n    <message>\n        <location line=\"+11\"/>\n        <source>ISO-8859-1</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-2</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-3</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-4</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-5</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-6</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-7</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-8</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-9</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-10</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-11</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-12</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-13</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-14</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>ISO-8859-15</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>UTF-8</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+24\"/>\n        <source>Output specific</source>\n        <translation>输出细节</translation>\n    </message>\n    <message>\n        <source>HTML options</source>\n        <translation type=\"obsolete\">Opciones de HTML</translation>\n    </message>\n    <message>\n        <source>Style</source>\n        <translation type=\"obsolete\">Hoja de estilo</translation>\n    </message>\n    <message>\n        <location line=\"+49\"/>\n        <location line=\"+244\"/>\n        <location line=\"+96\"/>\n        <location line=\"+236\"/>\n        <source>Include the style information in each output file.</source>\n        <translation>将样式表信息保存到每个输出文件中.</translation>\n    </message>\n    <message>\n        <location line=\"-573\"/>\n        <location line=\"+576\"/>\n        <source>Embed style (CSS)</source>\n        <translation>内嵌样式表 (CSS)</translation>\n    </message>\n    <message>\n        <location line=\"-563\"/>\n        <source>Add CSS information to each tag (do not use CSS class definitions).</source>\n        <translation>CSS信息保存到每个Tag中(不使用CSS的类定义).</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Inline CSS</source>\n        <translation>Inline CSS</translation>\n    </message>\n    <message>\n        <source>Style file:</source>\n        <translation type=\"obsolete\">Archivo de estilo:</translation>\n    </message>\n    <message>\n        <location line=\"+27\"/>\n        <location line=\"+316\"/>\n        <location line=\"+236\"/>\n        <source>Name of the referenced style file.</source>\n        <translation>外链样式表文件的名字.</translation>\n    </message>\n    <message>\n        <location line=\"-549\"/>\n        <location line=\"+552\"/>\n        <source>highlight.css</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>Style include file:</source>\n        <translation type=\"obsolete\">Archivo de estilo a incluir:</translation>\n    </message>\n    <message>\n        <location line=\"-534\"/>\n        <location line=\"+569\"/>\n        <source>Path of the CSS include file.</source>\n        <translation>外链样式表的路径.</translation>\n    </message>\n    <message>\n        <location line=\"-562\"/>\n        <source>Select a CSS include file.</source>\n        <translation>选择一个外链的样式表.</translation>\n    </message>\n    <message>\n        <location line=\"+14\"/>\n        <source>CSS class prefix:</source>\n        <translation>CSS类前缀:</translation>\n    </message>\n    <message>\n        <location line=\"+7\"/>\n        <source>Add a CSS class name prefix to avoid namespace clashes.</source>\n        <translation>给CSS类添加前缀以避免由于命名空间引起的冲突..</translation>\n    </message>\n    <message>\n        <source>Tags and index files</source>\n        <translation type=\"obsolete\">Archivos de etiquetas e índice</translation>\n    </message>\n    <message>\n        <location line=\"+78\"/>\n        <source>Generate an index file with hyperlinks to all outputted files.</source>\n        <translation>生成一个包含所有输出文件超链接的index文件.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Generate index file</source>\n        <translation>生成index文件</translation>\n    </message>\n    <message>\n        <source>Read a ctags file and add the included metainformation as tooltips.\nSee ctags.sf.net for details.</source>\n        <translatorcomment>This text will be emoved soon</translatorcomment>\n        <translation type=\"obsolete\">根据读取的一个ctags文件添加提示.\n更多详情请访问 ctags.sf.net.</translation>\n    </message>\n    <message>\n        <source>Ctags file:</source>\n        <translation type=\"obsolete\">Archivo de ctags:</translation>\n    </message>\n    <message>\n        <source>Path of the ctags file.</source>\n        <translation type=\"obsolete\">ctags文件路径..</translation>\n    </message>\n    <message>\n        <source>Choose a ctags file.</source>\n        <translation type=\"obsolete\">选择一个ctags文件.</translation>\n    </message>\n    <message>\n        <location line=\"-52\"/>\n        <source>Misc</source>\n        <translation>杂项</translation>\n    </message>\n    <message>\n        <location line=\"+19\"/>\n        <source>Add an achor to each line.</source>\n        <translation>给每一行代码添加锚点..</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Add line anchors</source>\n        <translation>给每一行代码添加Anchor(锚点)</translation>\n    </message>\n    <message>\n        <location line=\"+7\"/>\n        <source>Add the filename as prefix to the anchors.</source>\n        <translation>将文件名作为Anchors(锚点)的前缀.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Include file name in anchor</source>\n        <translation>将文件名包含在Anchor(锚点)中</translation>\n    </message>\n    <message>\n        <location line=\"+7\"/>\n        <source>Output the lines within an ordered list.</source>\n        <translation>根据列表顺序输出文档..</translation>\n    </message>\n    <message>\n        <source>Ordered list</source>\n        <translation type=\"obsolete\">Lista ordenada</translation>\n    </message>\n    <message>\n        <location line=\"+20\"/>\n        <source>Add &amp;lt;pre&amp;gt; tags to the output, if the flag &quot;No document header and footer&quot; is selected.</source>\n        <translation>当选中“忽略文档的header和footer”时，给输出添加&lt;pre&gt;标签.</translation>\n    </message>\n    <message>\n        <source>Enclose in &lt;pre&gt;</source>\n        <translation type=\"obsolete\">Meter entre &amp;lt;pre&amp;gt;</translation>\n    </message>\n    <message>\n        <source>LaTeX options</source>\n        <translation type=\"obsolete\">Opciones de LaTeX</translation>\n    </message>\n    <message>\n        <location line=\"+31\"/>\n        <source>Replace quotes by dq sequences.</source>\n        <translatorcomment>Replace apostrophes by dq strings</translatorcomment>\n        <translation>用dq序列替换引号.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Escape quotes</source>\n        <translatorcomment>Replace apostrophes</translatorcomment>\n        <translation>替换引号</translation>\n    </message>\n    <message>\n        <location line=\"+7\"/>\n        <source>Make output Babel compatible.</source>\n        <translatorcomment>Make output work with Babel package</translatorcomment>\n        <translation>使输出与Babel宏包兼容.</translation>\n    </message>\n    <message>\n        <source>Babel compatibility</source>\n        <translation type=\"obsolete\">Compatibilidad con Babel</translation>\n    </message>\n    <message>\n        <location line=\"+10\"/>\n        <source>Replace default symbols (brackets, tilde) by nice redefinitions.</source>\n        <translatorcomment>User more pleasant symbols</translatorcomment>\n        <translation>用更友好的定义替换默认符号 (如：括号, 波浪符号).</translation>\n    </message>\n    <message>\n        <source>Pretty symbols</source>\n        <translation type=\"obsolete\">Símbolos lindos</translation>\n    </message>\n    <message>\n        <location line=\"+13\"/>\n        <source>Embed style (defs)</source>\n        <translatorcomment>Include style information in output</translatorcomment>\n        <translation>内嵌页面样式 (defs)</translation>\n    </message>\n    <message>\n        <location line=\"+19\"/>\n        <source>Name of the referenced  style file.</source>\n        <translatorcomment>Name of external style file</translatorcomment>\n        <translation>被引用的样式表的文件名.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <location line=\"+96\"/>\n        <source>highlight.sty</source>\n        <translation></translation>\n    </message>\n    <message>\n        <source>Style include:</source>\n        <translation type=\"obsolete\">Incluir estilo:</translation>\n    </message>\n    <message>\n        <location line=\"-531\"/>\n        <source>Set encoding:</source>\n        <translation>编码设置：</translation>\n    </message>\n    <message>\n        <location line=\"-547\"/>\n        <source>Output destination:</source>\n        <translation>输出路径：</translation>\n    </message>\n    <message>\n        <location line=\"+746\"/>\n        <location line=\"+223\"/>\n        <location line=\"+96\"/>\n        <location line=\"+236\"/>\n        <source>Stylesheet file:</source>\n        <translation>外链样式表文件名：</translation>\n    </message>\n    <message>\n        <location line=\"-308\"/>\n        <location line=\"+96\"/>\n        <location line=\"+236\"/>\n        <source>Stylesheet include file:</source>\n        <translation>包含的样式表文件：</translation>\n    </message>\n    <message>\n        <source>Read ctags file:</source>\n        <translation type=\"obsolete\">读取ctags文件：</translation>\n    </message>\n    <message>\n        <location line=\"-1561\"/>\n        <source>Highlight</source>\n        <translation>Highlight</translation>\n    </message>\n    <message>\n        <location line=\"+137\"/>\n        <source>Files</source>\n        <translation>文件</translation>\n    </message>\n    <message>\n        <location line=\"+214\"/>\n        <source>Paste clipboard content into the preview window.</source>\n        <translation>将剪贴板中的代码粘贴到预览窗口.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Paste from clipboard</source>\n        <translation>从剪贴板获取代码</translation>\n    </message>\n    <message>\n        <location line=\"+42\"/>\n        <source>Copy highlighted code into the clipboard.</source>\n        <translation>将高亮代码复制到剪贴板.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Copy preview to clipboard</source>\n        <translation>将预览结果复制到剪贴板</translation>\n    </message>\n    <message>\n        <location line=\"-32\"/>\n        <source>Select syntax:</source>\n        <translation>代码语言：</translation>\n    </message>\n    <message>\n        <location line=\"-276\"/>\n        <source>&amp;Windows</source>\n        <translation>窗口(&amp;W)</translation>\n    </message>\n    <message>\n        <location line=\"+20\"/>\n        <source>Highlighting options</source>\n        <translation>代码高亮选项</translation>\n    </message>\n    <message>\n        <location line=\"+263\"/>\n        <source>Select the correct syntax of the code snippet.</source>\n        <translation>给代码片段选择对应的语言格式.</translation>\n    </message>\n    <message>\n        <location line=\"+46\"/>\n        <source>Plug-ins</source>\n        <translation>插件</translation>\n    </message>\n    <message>\n        <location line=\"+9\"/>\n        <source>Add plug-in to pool</source>\n        <translation>添加插件</translation>\n    </message>\n    <message>\n        <location line=\"+48\"/>\n        <source>Description</source>\n        <translation>描述</translation>\n    </message>\n    <message>\n        <location line=\"+6\"/>\n        <source>Shows decription of a selected plug-in script.</source>\n        <translation>显示选中插件的描述.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Plug-In description</source>\n        <translation>插件描述</translation>\n    </message>\n    <message>\n        <location line=\"+28\"/>\n        <source>Plug-in input file</source>\n        <translation>输入插件的文件</translation>\n    </message>\n    <message>\n        <location line=\"+9\"/>\n        <source>Optional path to a plug-in input file</source>\n        <translation>传递给插件的一个可选路径</translation>\n    </message>\n    <message>\n        <location line=\"+7\"/>\n        <source>Select the plug-in input file.</source>\n        <translation>选择传递给插件的文件.</translation>\n    </message>\n    <message>\n        <location line=\"+129\"/>\n        <source>BBCode</source>\n        <translation>BBCode</translation>\n    </message>\n    <message>\n        <location line=\"+282\"/>\n        <source>Stylesheets</source>\n        <translation>样式表</translation>\n    </message>\n    <message>\n        <location line=\"+68\"/>\n        <source>Include:</source>\n        <translation>包含：</translation>\n    </message>\n    <message>\n        <source>Index/ctags</source>\n        <translation type=\"obsolete\">Index/ctags</translation>\n    </message>\n    <message>\n        <location line=\"+76\"/>\n        <source>Line numbering options:</source>\n        <translation>行号选项：</translation>\n    </message>\n    <message>\n        <location line=\"+30\"/>\n        <source>Output as ordered list</source>\n        <translation>根据列表顺序输出</translation>\n    </message>\n    <message>\n        <location line=\"+20\"/>\n        <source>Enclose in pre tags</source>\n        <translation>包含在pre标记中</translation>\n    </message>\n    <message>\n        <location line=\"+41\"/>\n        <source>Add Babel compatibility</source>\n        <translation>兼容Babel宏包</translation>\n    </message>\n    <message>\n        <location line=\"+10\"/>\n        <source>Add pretty symbols</source>\n        <translatorcomment>User nicer symbols</translatorcomment>\n        <translation>使用更友好的符号</translation>\n    </message>\n    <message>\n        <location line=\"+67\"/>\n        <location line=\"+96\"/>\n        <source>Path of the style include file.</source>\n        <translatorcomment>Ptah of file to be included in document style</translatorcomment>\n        <translation>外链样式表的路径.</translation>\n    </message>\n    <message>\n        <location line=\"-89\"/>\n        <location line=\"+96\"/>\n        <location line=\"+236\"/>\n        <source>Select a style include file.</source>\n        <translation>选择一个样式表文件.</translation>\n    </message>\n    <message>\n        <source>TeX options</source>\n        <translation type=\"obsolete\">Opciones de TeX</translation>\n    </message>\n    <message>\n        <location line=\"-300\"/>\n        <source>Embed style (macros)</source>\n        <translation>内嵌页面样式 (macros)</translation>\n    </message>\n    <message>\n        <source>RTF options</source>\n        <translation type=\"obsolete\">Opciones de RTF</translation>\n    </message>\n    <message>\n        <location line=\"+93\"/>\n        <source>Add character stylesheets with formatting information.\nYou can select the stylesheets in your word processor to reformat additional text.</source>\n        <translatorcomment>For RTF output, Openoffice supports character stylesheets</translatorcomment>\n        <translation>将高亮风格的格式信息添加到字体样式中.\n你可以在你的文字处理软件中通过选择对应的样式来格式化附加的文字.</translation>\n    </message>\n    <message>\n        <location line=\"+4\"/>\n        <source>Add character styles</source>\n        <translation>添加字体样式</translation>\n    </message>\n    <message>\n        <location line=\"+9\"/>\n        <source>Page size:</source>\n        <translation>页面大小：</translation>\n    </message>\n    <message>\n        <location line=\"+7\"/>\n        <source>Select a page size.</source>\n        <translation>设置页面大小.</translation>\n    </message>\n    <message>\n        <location line=\"+7\"/>\n        <source>A3</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>A4</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>A5</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>B4</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>B5</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>B6</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>Letter</source>\n        <translation>Letter</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>Legal</source>\n        <translation>正规</translation>\n    </message>\n    <message>\n        <source>SVG options</source>\n        <translation type=\"obsolete\">Opciones de SVG</translation>\n    </message>\n    <message>\n        <location line=\"+27\"/>\n        <source>Image size:</source>\n        <translation>图像大小：</translation>\n    </message>\n    <message>\n        <location line=\"+9\"/>\n        <source>Width:</source>\n        <translation>宽度：</translation>\n    </message>\n    <message>\n        <location line=\"+16\"/>\n        <source>Enter the SVG width (may contain units).</source>\n        <translatorcomment>Input SVG image width</translatorcomment>\n        <translation>输入SVG图像宽度.</translation>\n    </message>\n    <message>\n        <location line=\"+7\"/>\n        <source>Height:</source>\n        <translation>高度：</translation>\n    </message>\n    <message>\n        <location line=\"+10\"/>\n        <source>Enter the SVG height (may contain units).</source>\n        <translatorcomment>Input SVG image height</translatorcomment>\n        <translation>输入SVG图像高度.</translation>\n    </message>\n    <message>\n        <location line=\"+105\"/>\n        <source>No options defined.</source>\n        <translation>没有可供选择的选项..</translation>\n    </message>\n    <message>\n        <location line=\"+25\"/>\n        <source>Formatting</source>\n        <translation>格式化</translation>\n    </message>\n    <message>\n        <location line=\"+14\"/>\n        <source>Color theme:</source>\n        <translation>高亮主题：</translation>\n    </message>\n    <message>\n        <location line=\"+16\"/>\n        <source>Select a colour theme.</source>\n        <translation>选择一个用于高亮的颜色主题.</translation>\n    </message>\n    <message>\n        <location line=\"+14\"/>\n        <source>Reformat and indent your code.\nThis feature is enabled tor C, C++, C# and Java code.</source>\n        <translation>重新格式化排版你的代码.\n这项功能仅支持 C, C++, C# 和 Java.</translation>\n    </message>\n    <message>\n        <location line=\"+4\"/>\n        <source>Reformat:</source>\n        <translation>格式化代码:</translation>\n    </message>\n    <message>\n        <location line=\"+13\"/>\n        <source>Choose a formatting scheme.</source>\n        <translation>选择一种代码格式化风格.</translation>\n    </message>\n    <message>\n        <source>Linux</source>\n        <translation type=\"obsolete\">Linux</translation>\n    </message>\n    <message>\n        <location line=\"+14\"/>\n        <source>Change the keyword case.</source>\n        <translation>改变关键字大小写.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Keyword case:</source>\n        <translation>关键字大小写：</translation>\n    </message>\n    <message>\n        <location line=\"+13\"/>\n        <source>Select a keyword case.</source>\n        <translation>这是关键字大小写.</translation>\n    </message>\n    <message>\n        <location line=\"+4\"/>\n        <source>UPPER</source>\n        <translation>大写</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>lower</source>\n        <translation>小写</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>Capitalize</source>\n        <translation>首字母大写</translation>\n    </message>\n    <message>\n        <location line=\"+18\"/>\n        <source>Tab width:</source>\n        <translation>制表符(Tab)宽度：</translation>\n    </message>\n    <message>\n        <location line=\"+10\"/>\n        <source>Enter the number of spaces which replace a tab.\nSet the width to 0 to keep tabs.</source>\n        <translation>设置多少个空格替换一个制表符(Tab).\n设置为0时保留制表符(Tab).</translation>\n    </message>\n    <message>\n        <location line=\"+17\"/>\n        <source>Enable line wrapping.</source>\n        <translation>启用自动换行.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Line wrapping</source>\n        <translation>自动换行</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>Enter the maximum line length.</source>\n        <translation>设定每行代码的最大长度.</translation>\n    </message>\n    <message>\n        <location line=\"+28\"/>\n        <source>Indent statements and function parameters after wrapping.</source>\n        <translation>换行后自动缩进语句和函数参数.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Intelligent wrapping</source>\n        <translation>自动缩进</translation>\n    </message>\n    <message>\n        <location line=\"+26\"/>\n        <source>Font name:</source>\n        <translation>字体：</translation>\n    </message>\n    <message>\n        <source>Select or enter the font name.</source>\n        <translation type=\"obsolete\">Seleccionar o introduzcir el nombre de la fuente.</translation>\n    </message>\n    <message>\n        <location line=\"+27\"/>\n        <source>Font size:</source>\n        <translation>字体大小：</translation>\n    </message>\n    <message>\n        <location line=\"+16\"/>\n        <source>Enter the font size.</source>\n        <translation>输入字体大小.</translation>\n    </message>\n    <message>\n        <location line=\"+73\"/>\n        <source>Visit andre-simon.de</source>\n        <translation>访问 andre-simon.de</translation>\n    </message>\n    <message>\n        <location line=\"+11\"/>\n        <source>&amp;Dock floating panels</source>\n        <translation>停靠浮动面板(&amp;D)</translation>\n    </message>\n    <message>\n        <location line=\"-1975\"/>\n        <source>Preview</source>\n        <translation>预览</translation>\n    </message>\n    <message>\n        <location line=\"+308\"/>\n        <source>Start the conversion of your input files.</source>\n        <translation>点击按钮开始转换文件.</translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Convert files</source>\n        <translation>转换文件</translation>\n    </message>\n    <message>\n        <location line=\"+10\"/>\n        <source>Copy highlighted code of the seleted file into the clipboard.</source>\n        <translation>将选中文件的高亮代码复制到剪贴板中.</translation>\n    </message>\n    <message>\n        <location line=\"+11\"/>\n        <source>Clipboard</source>\n        <translation>剪贴板</translation>\n    </message>\n    <message>\n        <location line=\"-8\"/>\n        <source>Copy file to clipboard</source>\n        <translation>将输出文件内容复制到剪贴板</translation>\n    </message>\n    <message>\n        <location line=\"+89\"/>\n        <source>Choose a plug-in script.</source>\n        <translation>选择一个插件脚本.</translation>\n    </message>\n    <message>\n        <location line=\"+14\"/>\n        <source>List of plug-ins. Toggle checkbox to enable the scripts.</source>\n        <translation>插件列表. 打钩激活对应脚本.</translation>\n    </message>\n    <message>\n        <location line=\"+15\"/>\n        <source>Remove the selected plug-ins.</source>\n        <translation>移除所有选中的插件.</translation>\n    </message>\n    <message>\n        <location line=\"+10\"/>\n        <source>Remove all plug-ins.</source>\n        <translation>移除所有插件.</translation>\n    </message>\n    <message>\n        <location line=\"-424\"/>\n        <source>Output progress:</source>\n        <translation>输出进度：</translation>\n    </message>\n    <message>\n        <location line=\"+28\"/>\n        <source>&amp;File</source>\n        <translation>文件(&amp;F)</translation>\n    </message>\n    <message>\n        <location line=\"+8\"/>\n        <source>&amp;Help</source>\n        <translation>帮助(&amp;H)</translation>\n    </message>\n    <message>\n        <location line=\"+1763\"/>\n        <source>Do not add line numbering to lines which were automatically wrapped.</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location line=\"+3\"/>\n        <source>Omit line numbers of wrapped lines</source>\n        <translation type=\"unfinished\"></translation>\n    </message>\n    <message>\n        <location line=\"+33\"/>\n        <source>Select or enter the font name. HTML supports a list of fonts, separated with comma.</source>\n        <translation>选择或者输入字体名. HTML支持用逗号分隔的字体列表.</translation>\n    </message>\n    <message>\n        <location line=\"+43\"/>\n        <source>&amp;Open files</source>\n        <translation>打开(&amp;O)</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>&amp;Exit</source>\n        <translation>退出(&amp;E)</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>&amp;Load</source>\n        <translation>加载(&amp;L)</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>&amp;Save</source>\n        <translation>保存(&amp;S)</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>Load &amp;default project</source>\n        <translation>加载默认工程(&amp;D)</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>Readme</source>\n        <translation>ReadMe</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>&amp;Tips</source>\n        <translation>小贴士(&amp;T)</translation>\n    </message>\n    <message>\n        <location line=\"+8\"/>\n        <source>&amp;Changelog</source>\n        <translation>查看变更(&amp;C)</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>&amp;License</source>\n        <translation>许可证(&amp;L)</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>&amp;About Highlight</source>\n        <translation>关于Highlight(&amp;A)</translation>\n    </message>\n    <message>\n        <location line=\"+5\"/>\n        <source>About &amp;translations</source>\n        <translation>关于翻译(&amp;T)</translation>\n    </message>\n</context>\n<context>\n    <name>ShowTextFile</name>\n    <message>\n        <location filename=\"showtextfile.ui\" line=\"+17\"/>\n        <source>Show text</source>\n        <translation>文本显示</translation>\n    </message>\n    <message>\n        <location line=\"+20\"/>\n        <source>TextLabel</source>\n        <translation></translation>\n    </message>\n    <message>\n        <location line=\"+32\"/>\n        <source>OK</source>\n        <translation>确定</translation>\n    </message>\n</context>\n<context>\n    <name>io_report</name>\n    <message>\n        <location filename=\"io_report.ui\" line=\"+14\"/>\n        <source>Error summary</source>\n        <translatorcomment>错误总结</translatorcomment>\n        <translation>Resumen de Error</translation>\n    </message>\n    <message>\n        <location line=\"+10\"/>\n        <source>Input errors:</source>\n        <translation>输入错误:</translation>\n    </message>\n    <message>\n        <location line=\"+10\"/>\n        <source>Remove files above from input file list</source>\n        <translation>将以上文件从输入文件列表中移除</translation>\n    </message>\n    <message>\n        <location line=\"+14\"/>\n        <source>Output errors:</source>\n        <translation>输出错误:</translation>\n    </message>\n    <message>\n        <location line=\"+17\"/>\n        <source>Reformatting not possible:</source>\n        <translation>不支持代码格式化的文件:</translation>\n    </message>\n</context>\n</TS>\n"
  },
  {
    "path": "jni/highlight/gui-qt/io_report.cpp",
    "content": "/***************************************************************************\r\n                               io_report.cpp\r\n                             -------------------\r\n    begin                : Mo 16.03.2009\r\n    copyright            : (C) 2009 by Andre Simon\r\n    email                : andre.simon1@gmx.de\r\n ***************************************************************************/\r\n\r\n/*\r\nThis file is part of Highlight.\r\n\r\nHighlight is free software: you can redistribute it and/or modify\r\nit under the terms of the GNU General Public License as published by\r\nthe Free Software Foundation, either version 3 of the License, or\r\n(at your option) any later version.\r\n\r\nHighlight is distributed in the hope that it will be useful,\r\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\r\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\nGNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License\r\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\r\n*/\r\n\r\n#include \"io_report.h\"\r\n#include \"ui_io_report.h\"\r\n\r\nio_report::io_report(QWidget *parent) :\r\n    QDialog(parent),\r\n    m_ui(new Ui::io_report)\r\n{\r\n    m_ui->setupUi(this);\r\n}\r\n\r\nio_report::~io_report()\r\n{\r\n    delete m_ui;\r\n}\r\n\r\nvoid io_report::changeEvent(QEvent *e)\r\n{\r\n    switch (e->type()) {\r\n    case QEvent::LanguageChange:\r\n        m_ui->retranslateUi(this);\r\n        break;\r\n    default:\r\n        break;\r\n    }\r\n}\r\n\r\nvoid io_report::addInputErrors(QStringList & list){\r\n    m_ui->listInputErrors->clear();\r\n    m_ui->listInputErrors->addItems(list);\r\n}\r\n\r\n    void io_report::addOutputErrors(QStringList & list){\r\n            m_ui->listOutputErrors->clear();\r\n    m_ui->listOutputErrors->addItems(list);\r\n    }\r\n    void io_report::addReformatErrors(QStringList & list){\r\n            m_ui->listReformatErrors->clear();\r\n    m_ui->listReformatErrors->addItems(list);\r\n    }\r\n\r\nbool io_report::removeInputErrorFiles() {\r\n       return m_ui->cbRemoveFiles->isChecked();\r\n}\r\n"
  },
  {
    "path": "jni/highlight/gui-qt/io_report.h",
    "content": "/***************************************************************************\r\n                               io_report.h\r\n                             -------------------\r\n    begin                : Mo 16.03.2009\r\n    copyright            : (C) 2009 by Andre Simon\r\n    email                : andre.simon1@gmx.de\r\n ***************************************************************************/\r\n\r\n/*\r\nThis file is part of Highlight.\r\n\r\nHighlight is free software: you can redistribute it and/or modify\r\nit under the terms of the GNU General Public License as published by\r\nthe Free Software Foundation, either version 3 of the License, or\r\n(at your option) any later version.\r\n\r\nHighlight is distributed in the hope that it will be useful,\r\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\r\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\nGNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License\r\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\r\n*/\r\n\r\n#ifndef IO_REPORT_H\r\n#define IO_REPORT_H\r\n#include <QtGlobal>\r\n\r\n#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))\r\n#include <QtGui/QDialog>\r\n#else\r\n#include <QtWidgets/QDialog>\r\n#endif\r\n\r\nnamespace Ui {\r\n    class io_report;\r\n}\r\n\r\nclass io_report : public QDialog {\r\n    Q_OBJECT\r\n    Q_DISABLE_COPY(io_report)\r\npublic:\r\n    explicit io_report(QWidget *parent = 0);\r\n    virtual ~io_report();\r\n\r\n    void addInputErrors(QStringList & list);\r\n    void addOutputErrors(QStringList & list);\r\n    void addReformatErrors(QStringList & list);\r\n\r\n    bool removeInputErrorFiles();\r\n\r\n\r\nprotected:\r\n    virtual void changeEvent(QEvent *e);\r\n\r\nprivate:\r\n    Ui::io_report *m_ui;\r\n};\r\n\r\n#endif // IO_REPORT_H\r\n"
  },
  {
    "path": "jni/highlight/gui-qt/io_report.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<ui version=\"4.0\">\r\n <class>io_report</class>\r\n <widget class=\"QDialog\" name=\"io_report\">\r\n  <property name=\"geometry\">\r\n   <rect>\r\n    <x>0</x>\r\n    <y>0</y>\r\n    <width>436</width>\r\n    <height>372</height>\r\n   </rect>\r\n  </property>\r\n  <property name=\"windowTitle\">\r\n   <string>Error summary</string>\r\n  </property>\r\n  <property name=\"windowIcon\">\r\n   <iconset resource=\"highlight-gui.qrc\">\r\n    <normaloff>:/hl_icon2.png</normaloff>:/hl_icon2.png</iconset>\r\n  </property>\r\n  <layout class=\"QVBoxLayout\" name=\"verticalLayout\">\r\n   <item>\r\n    <widget class=\"QLabel\" name=\"label_2\">\r\n     <property name=\"text\">\r\n      <string>Input errors:</string>\r\n     </property>\r\n    </widget>\r\n   </item>\r\n   <item>\r\n    <widget class=\"QListWidget\" name=\"listInputErrors\"/>\r\n   </item>\r\n   <item>\r\n    <widget class=\"QCheckBox\" name=\"cbRemoveFiles\">\r\n     <property name=\"text\">\r\n      <string>Remove files above from input file list</string>\r\n     </property>\r\n    </widget>\r\n   </item>\r\n   <item>\r\n    <widget class=\"Line\" name=\"line\">\r\n     <property name=\"orientation\">\r\n      <enum>Qt::Horizontal</enum>\r\n     </property>\r\n    </widget>\r\n   </item>\r\n   <item>\r\n    <widget class=\"QLabel\" name=\"label\">\r\n     <property name=\"text\">\r\n      <string>Output errors:</string>\r\n     </property>\r\n    </widget>\r\n   </item>\r\n   <item>\r\n    <widget class=\"QListWidget\" name=\"listOutputErrors\"/>\r\n   </item>\r\n   <item>\r\n    <widget class=\"Line\" name=\"line_2\">\r\n     <property name=\"orientation\">\r\n      <enum>Qt::Horizontal</enum>\r\n     </property>\r\n    </widget>\r\n   </item>\r\n   <item>\r\n    <widget class=\"QLabel\" name=\"label_3\">\r\n     <property name=\"text\">\r\n      <string>Reformatting not possible:</string>\r\n     </property>\r\n    </widget>\r\n   </item>\r\n   <item>\r\n    <widget class=\"QListWidget\" name=\"listReformatErrors\"/>\r\n   </item>\r\n   <item>\r\n    <widget class=\"QDialogButtonBox\" name=\"buttonBox\">\r\n     <property name=\"orientation\">\r\n      <enum>Qt::Horizontal</enum>\r\n     </property>\r\n     <property name=\"standardButtons\">\r\n      <set>QDialogButtonBox::Ok</set>\r\n     </property>\r\n    </widget>\r\n   </item>\r\n  </layout>\r\n </widget>\r\n <resources>\r\n  <include location=\"highlight-gui.qrc\"/>\r\n </resources>\r\n <connections>\r\n  <connection>\r\n   <sender>buttonBox</sender>\r\n   <signal>accepted()</signal>\r\n   <receiver>io_report</receiver>\r\n   <slot>accept()</slot>\r\n   <hints>\r\n    <hint type=\"sourcelabel\">\r\n     <x>248</x>\r\n     <y>254</y>\r\n    </hint>\r\n    <hint type=\"destinationlabel\">\r\n     <x>157</x>\r\n     <y>274</y>\r\n    </hint>\r\n   </hints>\r\n  </connection>\r\n  <connection>\r\n   <sender>buttonBox</sender>\r\n   <signal>rejected()</signal>\r\n   <receiver>io_report</receiver>\r\n   <slot>reject()</slot>\r\n   <hints>\r\n    <hint type=\"sourcelabel\">\r\n     <x>316</x>\r\n     <y>260</y>\r\n    </hint>\r\n    <hint type=\"destinationlabel\">\r\n     <x>286</x>\r\n     <y>274</y>\r\n    </hint>\r\n   </hints>\r\n  </connection>\r\n </connections>\r\n</ui>\r\n"
  },
  {
    "path": "jni/highlight/gui-qt/main.cpp",
    "content": "/***************************************************************************\r\n                               main.cpp\r\n                             -------------------\r\n    begin                : Mo 16.03.2009\r\n    copyright            : (C) 2009 by Andre Simon\r\n    email                : andre.simon1@gmx.de\r\n ***************************************************************************/\r\n\r\n\r\n/*\r\nThis file is part of Highlight.\r\n\r\nHighlight is free software: you can redistribute it and/or modify\r\nit under the terms of the GNU General Public License as published by\r\nthe Free Software Foundation, either version 3 of the License, or\r\n(at your option) any later version.\r\n\r\nHighlight is distributed in the hope that it will be useful,\r\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\r\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\nGNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License\r\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\r\n*/\r\n\r\n\r\n//?? https://codereview.qt-project.org/#change,51048\r\n\r\n#include <QtGlobal>\r\n\r\n#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))\r\n#include <QtGui/QApplication>\r\n#else\r\n#include <QtWidgets/QApplication>\r\n#endif\r\n#include <QTranslator>\r\n#include <QLocale>\r\n#include <QDir>\r\n\r\n#include \"mainwindow.h\"\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    QApplication app(argc, argv);\r\n    QTranslator translator;\r\n    #ifdef DATA_DIR\r\n     translator.load(QString(\"%1/gui_files/l10n/highlight_%2\").arg(DATA_DIR).arg(QLocale::system().name()));\r\n    #else\r\n     translator.load(QString(\"%1/gui_files/l10n/highlight_%2\").arg(QDir::currentPath()).arg(QLocale::system().name()));\r\n    #endif\r\n    app.installTranslator(&translator);\r\n\r\n    if (QCoreApplication::arguments().contains(\"--portable\")){\r\n        QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, QDir::currentPath());\r\n    }\r\n\r\n    MainWindow w;\r\n/*\r\n    QStringList args=QCoreApplication::arguments();\r\n    if (args.count()>1){\r\n        args.removeFirst(); // drop highlight-gui.exe path\r\n        w.addInputFiles(args);\r\n    }\r\n*/\r\n    w.show();\r\n    return app.exec();\r\n}\r\n"
  },
  {
    "path": "jni/highlight/gui-qt/mainwindow.cpp",
    "content": "/***************************************************************************\n                               mainwindow.cpp\n                             -------------------\n    begin                : Mo 16.03.2009\n    copyright            : (C) 2009-2010 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n#include <memory>\n#include <algorithm>\n\n#include <Diluculum/LuaState.hpp>\n\n#include \"mainwindow.h\"\n#include \"ui_mainwindow.h\"\n#include \"version.h\"\n#include \"showtextfile.h\"\n\n//#include \"debuginfo.h\"\n#include \"io_report.h\"\n\n//#undef DATA_DIR\n\nMainWindow::MainWindow(QWidget *parent)\n    : QMainWindow(parent), ui(new Ui::MainWindowClass), getDataFromCP(false)\n{\n    ui->setupUi(this);\n    this->setWindowTitle(QString(\"Highlight %1\").arg( HIGHLIGHT_VERSION));\n\n    // Read file open filter\n#ifdef DATA_DIR\n     QFile filterDef(QString(DATA_DIR) + \"/gui_files/ext/fileopenfilter.conf\");\n#else\n     QFile filterDef(QDir::currentPath()+\"/gui_files/ext/fileopenfilter.conf\");\n#endif\n\n     QRegExp rx(\"(\\\\S+)\\\\s?\\\\(\\\\*\\\\.([\\\\w\\\\d]+)\");\n\n     if (filterDef.open(QIODevice::ReadOnly | QIODevice::Text)){\n           QTextStream in(&filterDef);\n           QString line;\n\n           QStringList syntaxPair;\n           while (!in.atEnd()) {\n               line = in.readLine();\n               fileOpenFilter+=line;\n               fileOpenFilter+=\";;\";\n               if( rx.indexIn(line)!=-1){\n                 syntaxPair = rx.capturedTexts();\n                 ui->comboSelectSyntax->addItem(syntaxPair[1], syntaxPair[2]);\n               }\n            }\n     } else {\n         fileOpenFilter=\"All files (*)\";\n    }\n     // fill themes combo\n#ifdef DATA_DIR\n     QDir themesDir(QString(DATA_DIR) + \"/themes\");\n#else\n     QDir themesDir(QDir::currentPath()+\"/themes\");\n#endif\n    QStringList themes = themesDir.entryList(QStringList(\"*.theme\"), QDir::Files, QDir::Name);\n    for (QStringList::const_iterator constIterator = themes.constBegin();\n          constIterator != themes.constEnd(); ++constIterator) {\n             ui->comboTheme->addItem(QString(*constIterator).section('.',0, 0));\n    }\n    ui->comboTheme->setCurrentIndex(0);\n\n    //does not work in GUI editor when adding > 10 items ?!?\n    QStringList fmts;\n    fmts << \"Allman\" << \"Banner\" << \"GNU\" <<\"Google\"<< \"Horstmann\"<<\"Lisp\"<<\"Java\"<<\"K&R\"<<\"Linux\"<<\"OTBS\"<<\"Pico\"<<\"Stroustrup\"<<\"VTK\"<<\"Whitesmith\";\n    ui->comboReformat->clear();\n    ui->comboReformat->addItems(fmts);\n\n    // load syntax mappings\n   if (!loadFileTypeConfig(&extensions, &shebangs)){\n     QMessageBox::warning(this, tr(\"Initialization error\"),\n                          tr(\"Could not find syntax definitions. Check installation.\"));\n   }\n\n    QObject::connect(ui->pbOpenFiles, SIGNAL(clicked()), this, SLOT(openFiles()));\n    QObject::connect(ui->action_Open_files, SIGNAL(triggered()), this, SLOT(openFiles()));\n\n    QObject::connect(ui->cbWrite2Src, SIGNAL(clicked()), this, SLOT(plausibility()));\n    QObject::connect(ui->cbIncLineNo, SIGNAL(clicked()), this, SLOT(plausibility()));\n    QObject::connect(ui->cbWrapping, SIGNAL(clicked()), this, SLOT(plausibility()));\n    QObject::connect(ui->cbEncoding, SIGNAL(clicked()), this, SLOT(plausibility()));\n\n    QObject::connect(ui->comboFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(plausibility()));\n    QObject::connect(ui->cbReformat, SIGNAL(clicked()), this, SLOT(plausibility()));\n    QObject::connect(ui->cbKwCase, SIGNAL(clicked()), this, SLOT(plausibility()));\n    QObject::connect(ui->cbHTMLEmbedStyle, SIGNAL(clicked()), this, SLOT(plausibility()));\n    QObject::connect(ui->cbHTMLAnchors, SIGNAL(clicked()), this, SLOT(plausibility()));\n    QObject::connect(ui->cbHTMLInlineCSS, SIGNAL(clicked()), this, SLOT(plausibility()));\n    QObject::connect(ui->cbLATEXEmbedStyle, SIGNAL(clicked()), this, SLOT(plausibility()));\n    QObject::connect(ui->cbTEXEmbedStyle, SIGNAL(clicked()), this, SLOT(plausibility()));\n    QObject::connect(ui->cbSVGEmbedStyle, SIGNAL(clicked()), this, SLOT(plausibility()));\n    QObject::connect(ui->cbFragment, SIGNAL(clicked()), this, SLOT(plausibility()));\n    QObject::connect(ui->tabIOSelection, SIGNAL(currentChanged(int)), this, SLOT(plausibility()));\n\n    QObject::connect(ui->lvInputFiles, SIGNAL(itemSelectionChanged()), this, SLOT(updatePreview()));\n    QObject::connect(ui->lvPluginScripts, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(updatePreview()));\n    QObject::connect(ui->cbIncLineNo, SIGNAL(clicked()), this, SLOT(updatePreview()));\n    QObject::connect(ui->cbKwCase, SIGNAL(clicked()), this, SLOT(updatePreview()));\n    QObject::connect(ui->cbPadZeroes, SIGNAL(clicked()), this, SLOT(updatePreview()));\n    QObject::connect(ui->cbReformat, SIGNAL(clicked()), this, SLOT(updatePreview()));\n    QObject::connect(ui->cbWrapping, SIGNAL(clicked()), this, SLOT(updatePreview()));\n    QObject::connect(ui->cbAdvWrapping, SIGNAL(clicked()), this, SLOT(updatePreview()));\n    QObject::connect(ui->cbValidateInput, SIGNAL(clicked()), this, SLOT(updatePreview()));\n    QObject::connect(ui->cbEncoding, SIGNAL(clicked()), this, SLOT(updatePreview()));\n    QObject::connect(ui->comboEncoding, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreview()));\n\n    QObject::connect(ui->comboFontName, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreview()));\n    QObject::connect(ui->comboKwCase, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreview()));\n    QObject::connect(ui->comboReformat, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreview()));\n    QObject::connect(ui->comboTheme, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreview()));\n    QObject::connect(ui->comboSelectSyntax, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreview()));\n\n    QObject::connect(ui->sbLineNoWidth, SIGNAL(valueChanged(int)), this, SLOT(updatePreview()));\n    QObject::connect(ui->sbLineNoStart, SIGNAL(valueChanged(int)), this, SLOT(updatePreview()));\n    QObject::connect(ui->leFontSize, SIGNAL(textChanged(QString)), this, SLOT(updatePreview()));\n    QObject::connect(ui->cbOmitWrappedLineNumbers, SIGNAL(clicked()), this, SLOT(updatePreview()));\n\n    setAcceptDrops(true);\n\n    readSettings();\n    plausibility();\n}\n\nMainWindow::~MainWindow()\n{\n    writeSettings();\n    delete ui;\n}\n\nvoid MainWindow::openFiles(){\n\n    QStringList files = QFileDialog::getOpenFileNames(\n                            this,\n                            tr(\"Select one or more files to open\"),\n                            \"\",\n                            fileOpenFilter);\n\n     addInputFiles(files, ui->lvInputFiles);\n}\n\nvoid MainWindow::selectSingleFile(QLineEdit* edit, const QString& title, const QString& filter){\n    QString fileName = QFileDialog::getOpenFileName(this, title, \"\", filter);\n    if (!fileName.isEmpty()) edit->setText(fileName);\n}\n\nvoid MainWindow::addInputFiles(const QStringList& list, QListWidget* listWidget, const QString& iconName, bool checkable ){\n       QListWidgetItem *listItem;\n       for (QStringList::const_iterator constIterator = list.constBegin();\n          constIterator != list.constEnd(); ++constIterator) {\n          if (listWidget->findItems ( *constIterator, Qt::MatchExactly ).empty()) {\n              listItem=new QListWidgetItem(QIcon(iconName), *constIterator);\n              if (checkable) listItem->setCheckState( Qt::Unchecked);\n              listWidget->addItem(listItem );\n          }\n       }\n}\n\nvoid MainWindow::on_pbClearSelection_clicked(){\n    QList<QListWidgetItem *> selectedItems = ui->lvInputFiles->selectedItems();\n    for (int i = 0; i < selectedItems.size(); ++i) {\n        delete selectedItems.at(i);\n    }\n}\n\nvoid MainWindow::on_pbOutputDest_clicked(){\n     QFileDialog dialog(this, tr(\"Select destination directory\"), \"\");\n     dialog.setFileMode(QFileDialog::Directory);\n     if (dialog.exec() && !dialog.selectedFiles().empty()) {\n       ui->leOutputDest->setText(dialog.selectedFiles().at(0));\n     }\n}\n\n void MainWindow::writeSettings()\n {\n     QSettings settings(QSettings::IniFormat, QSettings::UserScope,\n                        \"andre-simon.de\", \"highlight-gui\");\n\n     settings.beginGroup(\"MainWindow\");\n     settings.setValue(\"geometry\", saveGeometry());\n     settings.setValue(\"windowState\", saveState());\n     settings.endGroup();\n\n     settings.beginGroup(\"input\");\n     QStringList inFiles;\n     for (int i=0;i<ui->lvInputFiles->count();i++){\n         inFiles<<ui->lvInputFiles->item(i)->text();\n     }\n\n     QStringList plugins;\n     for (int i=0;i<ui->lvPluginScripts->count();i++){\n         plugins<<ui->lvPluginScripts->item(i)->text();\n     }\n\n     QVariantList selectedPlugins;\n     for (int i=0;i<ui->lvPluginScripts->count();i++){\n         if (ui->lvPluginScripts->item(i)->checkState()==Qt::Checked )\n             selectedPlugins.push_back(QVariant(i));\n     }\n\n     const char* name=\"objectName\";\n     settings.setValue(ui->lvInputFiles->property(name).toString(),\n                       inFiles);\n     settings.setValue(ui->lvPluginScripts->property(name).toString(),\n                       plugins);\n     settings.setValue(\"selectedPlugins\",\n                       selectedPlugins);\n     settings.setValue(ui->leOutputDest->property(name).toString(),\n                       ui->leOutputDest->text());\n     settings.setValue(ui->cbWrite2Src->property(name).toString(),\n                       ui->cbWrite2Src->isChecked());\n     settings.setValue(ui->cbAdvWrapping->property(name).toString(),\n                       ui->cbAdvWrapping->isChecked());\n     settings.setValue(ui->cbEncoding->property(name).toString(),\n                       ui->cbEncoding->isChecked());\n     settings.setValue(ui->cbFragment->property(name).toString(),\n                       ui->cbFragment->isChecked());\n     settings.setValue(ui->cbHTMLAnchors->property(name).toString(),\n                       ui->cbHTMLAnchors->isChecked());\n\n     settings.setValue(ui->cbHTMLEmbedStyle->property(name).toString(),\n                       ui->cbHTMLEmbedStyle->isChecked());\n     settings.setValue(ui->cbHTMLEnclosePreTags->property(name).toString(),\n                       ui->cbHTMLEnclosePreTags->isChecked());\n     settings.setValue(ui->cbHTMLFileNameAnchor->property(name).toString(),\n                       ui->cbHTMLFileNameAnchor->isChecked());\n     settings.setValue(ui->cbHTMLIndex->property(name).toString(),\n                       ui->cbHTMLIndex->isChecked());\n     settings.setValue(ui->cbHTMLInlineCSS->property(name).toString(),\n                       ui->cbHTMLInlineCSS->isChecked());\n     settings.setValue(ui->cbHTMLOrderedList->property(name).toString(),\n                       ui->cbHTMLOrderedList->isChecked());\n     settings.setValue(ui->cbIncLineNo->property(name).toString(),\n                       ui->cbIncLineNo->isChecked());\n     settings.setValue(ui->cbKwCase->property(name).toString(),\n                       ui->cbKwCase->isChecked());\n     settings.setValue(ui->cbLATEXBabel->property(name).toString(),\n                       ui->cbLATEXBabel->isChecked());\n     settings.setValue(ui->cbLATEXEscQuotes->property(name).toString(),\n                       ui->cbLATEXEscQuotes->isChecked());\n     settings.setValue(ui->cbLATEXPrettySymbols->property(name).toString(),\n                       ui->cbLATEXPrettySymbols->isChecked());\n     settings.setValue(ui->cbPadZeroes->property(name).toString(),\n                       ui->cbPadZeroes->isChecked());\n     settings.setValue(ui->cbReformat->property(name).toString(),\n                       ui->cbReformat->isChecked());\n     settings.setValue(ui->cbRTFCharStyles->property(name).toString(),\n                       ui->cbRTFCharStyles->isChecked());\n     settings.setValue(ui->cbWrapping->property(name).toString(),\n                       ui->cbWrapping->isChecked());\n    settings.setValue(ui->cbValidateInput->property(name).toString(),\n                       ui->cbValidateInput->isChecked());\n\n     settings.setValue(ui->comboFormat->property(name).toString(),\n                       ui->comboFormat->currentIndex());\n     settings.setValue(ui->comboKwCase->property(name).toString(),\n                       ui->comboKwCase->currentIndex());\n     settings.setValue(ui->comboReformat->property(name).toString(),\n                       ui->comboReformat->currentIndex());\n     settings.setValue(ui->comboRTFPageSize->property(name).toString(),\n                       ui->comboRTFPageSize->currentIndex());\n     settings.setValue(ui->comboTheme->property(name).toString(),\n                       ui->comboTheme->currentIndex());\n     settings.setValue(ui->comboEncoding->property(name).toString(),\n                       ui->comboEncoding->currentText());\n     settings.setValue(ui->comboFontName->property(name).toString(),\n                       ui->comboFontName->currentText());\n     settings.setValue(ui->comboSelectSyntax->property(name).toString(),\n                       ui->comboSelectSyntax->currentIndex());\n\n     settings.setValue(ui->leHTMLStyleFile->property(name).toString(),\n                       ui->leHTMLStyleFile->text());\n     settings.setValue(ui->leHTMLStyleIncFile->property(name).toString(),\n                       ui->leHTMLStyleIncFile->text());\n     settings.setValue(ui->leLATEXStyleFile->property(name).toString(),\n                       ui->leLATEXStyleFile->text());\n     settings.setValue(ui->leLATEXStyleIncFile->property(name).toString(),\n                       ui->leLATEXStyleIncFile->text());\n     settings.setValue(ui->leTEXStyleFile->property(name).toString(),\n                       ui->leTEXStyleFile->text());\n     settings.setValue(ui->leTEXStyleIncFile->property(name).toString(),\n                       ui->leTEXStyleIncFile->text());\n     settings.setValue(ui->leSVGStyleFile->property(name).toString(),\n                       ui->leSVGStyleFile->text());\n     settings.setValue(ui->leSVGStyleIncFile->property(name).toString(),\n                       ui->leSVGStyleIncFile->text());\n    settings.setValue(ui->lePluginReadFilePath->property(name).toString(),\n                       ui->lePluginReadFilePath->text());\n     \n     settings.setValue(ui->cbSVGEmbedStyle->property(name).toString(),\n                       ui->cbSVGEmbedStyle->isChecked());\n     settings.setValue(ui->cbLATEXEmbedStyle->property(name).toString(),\n                       ui->cbLATEXEmbedStyle->isChecked());\n     settings.setValue(ui->cbTEXEmbedStyle->property(name).toString(),\n                       ui->cbTEXEmbedStyle->isChecked());\n     settings.setValue(ui->leSVGHeight->property(name).toString(),\n                       ui->leSVGHeight->text());\n     settings.setValue(ui->leSVGWidth->property(name).toString(),\n                       ui->leSVGWidth->text());\n     settings.setValue(ui->leFontSize->property(name).toString(),\n                       ui->leFontSize->text());\n     settings.setValue(ui->sbLineLength->property(name).toString(),\n                       ui->sbLineLength->value());\n     settings.setValue(ui->sbTabWidth->property(name).toString(),\n                       ui->sbTabWidth->value());\n     settings.setValue(ui->tabWidget->property(name).toString(),\n                       ui->tabWidget->currentIndex());\n     settings.setValue(ui->leHTMLCssPrefix->property(name).toString(),\n                       ui->leHTMLCssPrefix->text());\n     settings.setValue(ui->tabIOSelection->property(name).toString(),\n                       ui->tabIOSelection->currentIndex());\n\n     settings.setValue(ui->sbLineNoWidth->property(name).toString(),\n                       ui->sbLineNoWidth->value());\n\n     settings.setValue(ui->sbLineNoStart->property(name).toString(),\n                       ui->sbLineNoStart->value());\n\n     settings.endGroup();\n }\n\n void MainWindow::readSettings()\n {\n     ui->tabIOSelection->setCurrentIndex(0); // wie default setzen?\n     QSettings settings(QSettings::IniFormat, QSettings::UserScope,\n                        \"andre-simon.de\", \"highlight-gui\");\n\n     //QMessageBox::information(this, \"path\", settings.fileName());\n     if (!QFile(settings.fileName()).exists()) return;\n\n     settings.beginGroup(\"MainWindow\");\n\n     restoreGeometry(settings.value(\"geometry\").toByteArray());\n         restoreState(settings.value(\"windowState\").toByteArray());\n\n     settings.endGroup();\n\n     settings.beginGroup(\"input\");\n     const char*  name=\"objectName\";\n\n     addInputFiles(settings.value(ui->lvInputFiles->property(name).toString()).toStringList(), ui->lvInputFiles ) ;\n     addInputFiles(settings.value(ui->lvPluginScripts->property(name).toString()).toStringList(), ui->lvPluginScripts, \":/plugin.png\", true ) ;\n\n     QVariantList selectedPlugins=settings.value(\"selectedPlugins\").toList();\n     for (int i=0;i<selectedPlugins.size();i++){\n            ui->lvPluginScripts->item(selectedPlugins[i].toInt())->setCheckState(Qt::Checked);\n     }\n\n     ui->leOutputDest->setText(settings.value(ui->leOutputDest->property(name).toString()).toString());\n     ui->cbWrite2Src->setChecked(settings.value(ui->cbWrite2Src->property(name).toString()).toBool());\n     ui->cbAdvWrapping->setChecked(settings.value(ui->cbAdvWrapping->property(name).toString()).toBool());\n     ui->cbEncoding->setChecked(settings.value(ui->cbEncoding->property(name).toString()).toBool());\n     ui->cbFragment->setChecked(settings.value(ui->cbFragment->property(name).toString()).toBool());\n     ui->cbHTMLAnchors->setChecked(settings.value(ui->cbHTMLAnchors->property(name).toString()).toBool());\n     ui->cbHTMLEmbedStyle->setChecked(settings.value(ui->cbHTMLEmbedStyle->property(name).toString()).toBool());\n     ui->cbHTMLEnclosePreTags->setChecked(settings.value(ui->cbHTMLEnclosePreTags->property(name).toString()).toBool());\n     ui->cbHTMLFileNameAnchor->setChecked(settings.value(ui->cbHTMLFileNameAnchor->property(name).toString()).toBool());\n     ui->cbHTMLIndex->setChecked(settings.value(ui->cbHTMLIndex->property(name).toString()).toBool());\n     ui->cbHTMLInlineCSS->setChecked(settings.value(ui->cbHTMLInlineCSS->property(name).toString()).toBool());\n     ui->cbHTMLOrderedList->setChecked(settings.value(ui->cbHTMLOrderedList->property(name).toString()).toBool());\n     ui->cbIncLineNo->setChecked(settings.value(ui->cbIncLineNo->property(name).toString()).toBool());\n     ui->cbKwCase->setChecked(settings.value(ui->cbKwCase->property(name).toString()).toBool());\n     ui->cbLATEXBabel->setChecked(settings.value(ui->cbLATEXBabel->property(name).toString()).toBool());\n     ui->cbLATEXEscQuotes->setChecked(settings.value(ui->cbLATEXEscQuotes->property(name).toString()).toBool());\n     ui->cbLATEXPrettySymbols->setChecked(settings.value(ui->cbLATEXPrettySymbols->property(name).toString()).toBool());\n\n     ui->cbPadZeroes->setChecked(settings.value(ui->cbPadZeroes->property(name).toString()).toBool());\n     ui->cbReformat->setChecked(settings.value(ui->cbReformat->property(name).toString()).toBool());\n     ui->cbRTFCharStyles->setChecked(settings.value(ui->cbRTFCharStyles->property(name).toString()).toBool());\n     ui->cbWrapping->setChecked(settings.value(ui->cbWrapping->property(name).toString()).toBool());\n     ui->cbValidateInput->setChecked(settings.value(ui->cbValidateInput->property(name).toString()).toBool());\n\n     ui->comboEncoding->insertItem(0, settings.value(ui->comboEncoding->property(name).toString()).toString());\n     ui->comboEncoding->setCurrentIndex(0);\n     ui->comboFontName->insertItem(0, settings.value(ui->comboFontName->property(name).toString()).toString());\n     ui->comboFontName->setCurrentIndex(0);\n     ui->comboFormat->setCurrentIndex(settings.value(ui->comboFormat->property(name).toString()).toInt());\n     ui->comboKwCase->setCurrentIndex(settings.value(ui->comboKwCase->property(name).toString()).toInt());\n     ui->comboReformat->setCurrentIndex(settings.value(ui->comboReformat->property(name).toString()).toInt());\n     ui->comboRTFPageSize->setCurrentIndex(settings.value(ui->comboRTFPageSize->property(name).toString()).toInt());\n     ui->comboTheme->setCurrentIndex(settings.value(ui->comboTheme->property(name).toString()).toInt());\n     ui->comboSelectSyntax->setCurrentIndex(settings.value(ui->comboSelectSyntax->property(name).toString()).toInt());\n\n     ui->leHTMLStyleFile->setText(settings.value(ui->leHTMLStyleFile->property(name).toString()).toString());\n     ui->leHTMLStyleIncFile->setText(settings.value(ui->leHTMLStyleIncFile->property(name).toString()).toString());\n     ui->leLATEXStyleFile->setText(settings.value(ui->leLATEXStyleFile->property(name).toString()).toString());\n     ui->leTEXStyleFile->setText(settings.value(ui->leTEXStyleFile->property(name).toString()).toString());\n     ui->leLATEXStyleIncFile->setText(settings.value(ui->leLATEXStyleIncFile->property(name).toString()).toString());\n     ui->leTEXStyleIncFile->setText(settings.value(ui->leTEXStyleIncFile->property(name).toString()).toString());\n     ui->leSVGHeight->setText(settings.value(ui->leSVGHeight->property(name).toString()).toString());\n     ui->leSVGWidth->setText(settings.value(ui->leSVGWidth->property(name).toString()).toString());\n     ui->leFontSize->setText(settings.value(ui->leFontSize->property(name).toString()).toString());\n     ui->leHTMLCssPrefix->setText(settings.value(ui->leHTMLCssPrefix->property(name).toString()).toString());\n     ui->lePluginReadFilePath->setText(settings.value(ui->lePluginReadFilePath->property(name).toString()).toString());\n     \n     ui->sbLineLength->setValue(settings.value(ui->sbLineLength->property(name).toString()).toInt());\n     ui->sbTabWidth->setValue(settings.value(ui->sbTabWidth->property(name).toString()).toInt());\n     ui->cbTEXEmbedStyle->setChecked(settings.value(ui->cbTEXEmbedStyle->property(name).toString()).toBool());\n     ui->cbLATEXEmbedStyle->setChecked(settings.value(ui->cbLATEXEmbedStyle->property(name).toString()).toBool());\n     ui->cbSVGEmbedStyle->setChecked(settings.value(ui->cbSVGEmbedStyle->property(name).toString()).toBool());\n     ui->tabWidget->setCurrentIndex(settings.value(ui->tabWidget->property(name).toString()).toInt());\n     ui->tabIOSelection->setCurrentIndex(settings.value(ui->tabIOSelection->property(name).toString()).toInt());\n\n     ui->sbLineNoWidth->setValue(settings.value(ui->sbLineNoWidth->property(name).toString(), 2).toInt());\n     ui->sbLineNoStart->setValue(settings.value(ui->sbLineNoStart->property(name).toString(), 1).toInt());\n\n\n     settings.endGroup();\n }\n\nbool MainWindow::loadFileTypeConfig(StringMap* extMap, StringMap* shebangMap) {\n  if (!extMap || !shebangMap) return false;\n\n#ifdef CONFIG_DIR\n   QString filetypesPath = QDir::toNativeSeparators(QString(\"%1/filetypes.conf\").arg(CONFIG_DIR));\n#else\n    QString filetypesPath = QDir::toNativeSeparators(QString(\"%1/filetypes.conf\").arg(QDir::currentPath()));\n#endif\n\n    try {\n        Diluculum::LuaState ls;\n        ls.doFile (filetypesPath.toStdString());\n        int idx=1;\n        string langName;\n    Diluculum::LuaValue mapEntry;\n        while ((mapEntry = ls[\"FileMapping\"][idx].value()) !=Diluculum::Nil) {\n            langName = mapEntry[\"Lang\"].asString();\n            if (mapEntry[\"Extensions\"] !=Diluculum::Nil) {\n                int extIdx=1;\n                while (mapEntry[\"Extensions\"][extIdx] !=Diluculum::Nil) {\n                    extMap->insert ( make_pair ( mapEntry[\"Extensions\"][extIdx].asString(),  langName ) );\n                    extIdx++;\n                }\n            } else if (mapEntry[\"Shebang\"] !=Diluculum::Nil) {\n                shebangMap->insert ( make_pair ( mapEntry[\"Shebang\"].asString(),  langName ) );\n            }\n            idx++;\n        }\n    }\n    catch (Diluculum::LuaError err) {\n        QMessageBox::warning(this, \"Configuration error\", QString::fromStdString( err.what()));\n        return false;\n    }\n    return true;\n}\n\n string MainWindow::analyzeFile(const string& file){\n    ifstream inFile(file.c_str());\n    string firstLine;\n    getline (inFile, firstLine);\n    StringMap::iterator it;\n\n    \n    boost::xpressive::sregex rex;\n    boost::xpressive::smatch what;\n    for ( it=shebangs.begin(); it!=shebangs.end();it++ )\n    {\n        rex = boost::xpressive::sregex::compile( it->first );\n        if ( boost::xpressive::regex_search( firstLine, what, rex )  ) return it->second;\n    }\n    return \"\";\n}\n\nstring MainWindow::getFileType(const string& suffix, const string &inputFile)\n{\n    string lcSuffix = StringTools::change_case(suffix);    \n    if (extensions.count(lcSuffix))\n    {\n      return extensions[lcSuffix];\n    }\n\n //   if (!useUserSuffix){\n      string shebang =  analyzeFile(inputFile);\n      if (!shebang.empty()) return shebang;\n   // }\n    return lcSuffix;\n}\n\nstring MainWindow::getFileSuffix(const string& fileName)\n{\n  size_t ptPos=fileName.rfind(\".\");\n  size_t psPos = fileName.rfind ( /*Platform::pathSeparator*/ '/' );\n\n  if (ptPos == string::npos){\n     return  (psPos==string::npos) ? fileName : fileName.substr(psPos+1, fileName.length());\n  }\n  return (psPos!=string::npos && psPos>ptPos) ? fileName.substr(psPos+1, fileName.length()) : fileName.substr(ptPos+1, fileName.length());\n}\n\nvoid MainWindow::on_action_Exit_triggered()\n{\n    this->close();\n}\n\nvoid MainWindow::on_action_About_Highlight_triggered()\n{\n     QMessageBox::about( this, \"About Highlight\",\n                         QString(\"Highlight is a code to formatted text converter.\\n\\n\"\n                         \"Highlight GUI %1\\n\"\n                         \"(C) 2002-2015 Andre Simon <andre.simon1 at gmx.de>\\n\\n\"\n                         \"Artistic Style Classes\\n(C) 1998-2002 Tal Davidson\\n\"\n                         \"(C) 2006-2014 Jim Pattee <jimp03 at email.com>\\n\\n\"\n                         \"Diluculum Lua wrapper\\n\"\n\t\t\t \"(C) 2005-2013 by Leandro Motta Barros\\n\\n\"\n                         \"Built with Qt version %2\\n\\n\"\n                         \"Released under the terms of the GNU GPL license.\\n\\n\"\n                         \"The highlight logo is based on the image \\\"Alcedo Atthis\\\" by Lukasz Lukasik.\\n\"\n                         \"The original was published under the terms of the GNU FDL in the Wikimedia Commons database.\\n\\n\"\n                         ).arg(HIGHLIGHT_VERSION).arg(QString(qVersion ())) );\n}\n\n highlight::OutputType MainWindow::getOutputType(){\n\n    switch (ui->comboFormat->currentIndex()){\n     case 0: return highlight::HTML;\n     case 1: return highlight::XHTML;\n     case 2: return highlight::LATEX;\n     case 3: return highlight::TEX;\n     case 4: return highlight::RTF;\n     case 5: return highlight::ODTFLAT;\n     case 6: return highlight::SVG;\n     case 7: return highlight::BBCODE;\n    }\n    return highlight::HTML;\n}\n\n QString MainWindow::getOutFileSuffix(){\n  switch (ui->comboFormat->currentIndex()) {\n    case 0: return \".html\";\n    case 1: return \".xhtml\";\n    case 2:\n    case 3: return \".tex\";\n    case 4: return \".rtf\";\n    case 5: return \".fodt\";\n    case 6: return \".svg\";\n    case 7: return \".bbcode\";\n  }\n  return \".html\";\n}\n\nvoid MainWindow::applyCtrlValues(highlight::CodeGenerator* generator, bool previewMode){\n    if (!generator) return;\n\n    highlight::OutputType outType=getOutputType();\n\n    if (!previewMode){\n        QLineEdit * styleIncFile=NULL;\n        QLineEdit * styleOutFile=NULL;\n        QCheckBox * embedStyle=NULL;\n\n        switch(outType) {\n            case highlight::HTML:\n            case highlight::XHTML:  styleIncFile = ui->leHTMLStyleIncFile;\n                         styleOutFile = ui->leHTMLStyleFile;\n                         embedStyle  = ui->cbHTMLEmbedStyle;\n                         break;\n            case highlight::LATEX:\n                         styleIncFile = ui->leLATEXStyleIncFile;\n                         styleOutFile = ui->leLATEXStyleFile;\n                         embedStyle  = ui->cbLATEXEmbedStyle;\n                         break;\n            case highlight::TEX:    styleIncFile = ui->leTEXStyleIncFile;\n                         styleOutFile = ui->leTEXStyleFile;\n                         embedStyle  = ui->cbTEXEmbedStyle;\n                         break;\n            case highlight::SVG:    styleIncFile = ui->leSVGStyleIncFile;\n                         styleOutFile = ui->leSVGStyleFile;\n                         embedStyle  = ui->cbSVGEmbedStyle;\n                         break;\n            default: break;\n            }\n          if (styleIncFile)\n              generator->setStyleInputPath(QDir::toNativeSeparators(styleIncFile->text()).toStdString());\n          if (styleOutFile)\n              generator->setStyleOutputPath(styleOutFile->text().toStdString());\n          if (embedStyle)\n               generator->setIncludeStyle(embedStyle->isChecked());\n\n          generator->setFragmentCode(ui->cbFragment->isChecked());\n\n          generator->setHTMLAttachAnchors(ui->cbHTMLAnchors->isChecked());\n          generator->setHTMLOrderedList(ui->cbHTMLOrderedList->isChecked());\n          generator->setHTMLInlineCSS(ui->cbHTMLInlineCSS->isChecked() && ui->cbHTMLInlineCSS->isEnabled());\n          generator->setHTMLEnclosePreTag(ui->cbHTMLEnclosePreTags->isChecked());\n        //  generator->setHTMLUseNonBreakingSpace(ui->cbHTMLNonBreakingSpace->isChecked());\n\n          if (ui->leHTMLCssPrefix->text().size())\n              generator->setHTMLClassName(ui->leHTMLCssPrefix->text().toStdString());\n\n          generator->setLATEXReplaceQuotes(ui->cbLATEXEscQuotes->isChecked());\n          generator->setLATEXNoShorthands(ui->cbLATEXBabel->isChecked());\n          generator->setLATEXPrettySymbols(ui->cbLATEXPrettySymbols->isChecked());\n\n          generator->setRTFPageSize(ui->comboRTFPageSize->currentText().toLower().toStdString());\n          generator->setRTFCharStyles(ui->cbRTFCharStyles->isChecked());\n\n          generator->setSVGSize(ui->leSVGWidth->text().toStdString(), ui->leSVGHeight->text().toStdString());\n    }\n\n    generator->setPrintLineNumbers( ui->cbIncLineNo->isChecked(), ui->sbLineNoStart->value());\n    generator->setPrintZeroes(ui->cbPadZeroes->isEnabled() && ui->cbPadZeroes->isChecked());\n    generator->setPluginReadFile(ui->lePluginReadFilePath->text().toStdString());\n\n#ifdef DATA_DIR\n      QString themePath = QString(\"%1themes/%2.theme\").arg(\n              DATA_DIR).arg(ui->comboTheme->currentText());\n#else\n      QString themePath = QString(\"%1/themes/%2.theme\").arg(\n              QDir::currentPath()).arg(ui->comboTheme->currentText());\n#endif\n\n    for (int i=0;i<ui->lvPluginScripts->count();i++){\n       if (ui->lvPluginScripts->item(i)->checkState()==Qt::Checked){\n           if (!generator->initPluginScript(ui->lvPluginScripts->item(i)->text().toStdString()) )\n           {\n              QMessageBox::critical(this,\"Plug-In init error\", QString::fromStdString(generator->getPluginScriptError()));\n           }\n       }\n    }\n\n    if (!generator->initTheme(themePath.toStdString())){\n        QMessageBox::critical(this,\"Theme init error\", QString::fromStdString(generator->getThemeInitError()));\n    }\n\n    if (ui->cbEncoding->isChecked()) {\n        generator->setEncoding(ui->comboEncoding->currentText().toStdString());\n    } else {\n        generator->setEncoding(\"none\");\n    }\n    generator->setValidateInput(ui->cbValidateInput->isChecked());\n    generator->setLineNumberWidth(ui->sbLineNoWidth->value());\n    generator->setNumberWrappedLines(!ui->cbOmitWrappedLineNumbers->isChecked());\n\n    if (getOutputType()!=highlight::LATEX && getOutputType()!=highlight::TEX){\n      string fntName=ui->comboFontName->currentText().toStdString();\n      if(fntName.size()) generator->setBaseFont(fntName);\n      string fntSize=ui->leFontSize->text().toStdString();\n      if(fntSize.size()) generator->setBaseFontSize(fntSize);\n    }\n\n    int lineLength = 0;\n    if (ui->cbWrapping->isChecked()){\n         lineLength = (   ui->cbIncLineNo->isChecked()\n                       && ui->sbLineNoWidth->value() >  ui->sbLineLength->value())?\n                          ui->sbLineLength->value() - ui->sbLineNoWidth->value()\n                       :  ui->sbLineLength->value();\n    }\n    generator->setPreformatting(getWrappingStyle(), lineLength, ui->sbTabWidth->value());\n\n    if(ui->cbKwCase->isChecked()){\n        StringTools::KeywordCase kwCase=StringTools::CASE_UNCHANGED;\n        switch (ui->comboKwCase->currentIndex()){\n                case 0: kwCase=StringTools::CASE_UPPER; break;\n                case 1: kwCase=StringTools::CASE_LOWER; break;\n                case 2: kwCase=StringTools::CASE_CAPITALIZE; break;\n        }\n        generator->setKeyWordCase(kwCase);\n    }\n\n   if (ui->cbReformat->isChecked()){\n       generator->initIndentationScheme(ui->comboReformat->currentText().toLower().toStdString());\n\n    }\n}\n\nhighlight::WrapMode MainWindow::getWrappingStyle(){\n  if (!ui->cbAdvWrapping->isChecked() && ui->cbAdvWrapping->isEnabled())\n     return highlight::WRAP_SIMPLE;\n  return (ui->cbWrapping->isChecked())?highlight::WRAP_DEFAULT:highlight::WRAP_DISABLED;\n}\n\n\nvoid MainWindow::on_pbStartConversion_clicked(){\n\n    if (!ui->lvInputFiles->count()) return;\n\n    if (!ui->cbWrite2Src->isChecked() && !QDir(ui->leOutputDest->text()).exists()){\n        QMessageBox::warning(this, tr(\"Output error\"), tr(\"Output directory does not exist!\"));\n        ui->leOutputDest->setFocus();\n        return;\n    }\n    highlight::OutputType outType = getOutputType();\n    QCheckBox* cbEmbed=NULL;\n    QLineEdit* leStyleFile=NULL;\n\n    if ( outType==highlight::HTML || outType==highlight::XHTML) {\n        cbEmbed = ui->cbHTMLEmbedStyle;\n        leStyleFile = ui->leHTMLStyleFile;\n    }\n    else if ( outType==highlight::LATEX ) {\n         cbEmbed = ui->cbLATEXEmbedStyle;\n        leStyleFile = ui->leLATEXStyleFile;\n    }\n    else if (outType==highlight::TEX ) {\n        cbEmbed = ui->cbTEXEmbedStyle;\n        leStyleFile = ui->leTEXStyleFile;\n    }    else if (outType==highlight::SVG ) {\n        cbEmbed = ui->cbSVGEmbedStyle;\n        leStyleFile = ui->leSVGStyleFile;\n    }\n\n    if (cbEmbed && leStyleFile ) {\n       if ( !cbEmbed->isChecked() && leStyleFile->text().isEmpty()){\n         ui->tabWidget->setCurrentIndex(1);\n         if ( outType==highlight::HTML || outType==highlight::XHTML){\n                 ui->tabWidget->setCurrentIndex(0);\n          }\n         leStyleFile->setFocus();\n         QMessageBox::warning(this, tr(\"Output error\"), tr(\"You must define a style output file!\"));\n         return;\n       }\n    }\n    ui->pbStartConversion->setDisabled(true);\n    ui->pbCopyFile2CP->setDisabled(true);\n    this->setCursor(Qt::WaitCursor);\n\n    QTime t;\n    t.start();\n\n    auto_ptr<highlight::CodeGenerator> generator(highlight::CodeGenerator::getInstance(outType));\n\n    applyCtrlValues(generator.get(), false);\n    string currentFile;\n    string outfileName;\n    highlight::ParseError error;\n    highlight::LoadResult loadRes;\n    \n    QString langDefPath;\n    QString inFileName, inFilePath;\n    QSet<QString> usedFileNames;\n\n    QStringList inputErrors, outputErrors, reformatErrors;\n\n    for (int i=0; i<ui->lvInputFiles->count(); i++){\n     inFilePath =  ui->lvInputFiles->item(i)->text();\n     currentFile = inFilePath.toStdString();\n     \n#ifdef DATA_DIR\n    langDefPath = QDir::toNativeSeparators(QString(\"%1/langDefs/%2.lang\").arg(DATA_DIR).arg(\n      QString::fromStdString(getFileType(getFileSuffix(currentFile), currentFile))));\n#else\n     langDefPath = QDir::toNativeSeparators(QString(\"%1/langDefs/%2.lang\").arg(QDir::currentPath()).arg(\n       QString::fromStdString(getFileType(getFileSuffix(currentFile), currentFile))));\n#endif\n\n     loadRes=generator->loadLanguage(langDefPath.toStdString());\n     if (loadRes==highlight::LOAD_FAILED_REGEX){\n             QMessageBox::warning(this, tr(\"Language definition error\"),\n                         tr(\"Invalid regular expression in %1:\\n%2\").arg(langDefPath).arg(\n                         QString::fromStdString( generator->getSyntaxRegexError())));\n             break;\n        } else  if (loadRes==highlight::LOAD_FAILED) {\n           QMessageBox::warning(this, tr(\"Unknown syntax\"), tr(\"Could not convert %1\").arg(inFilePath));\n           inputErrors.append(inFilePath);\n       } else  if (loadRes==highlight::LOAD_FAILED_LUA) {\n           QMessageBox::warning(this, tr(\"Lua error\"), tr(\"Could not convert %1:\\nLua Syntax error: %2\").arg(inFilePath).arg(QString::fromStdString(generator->getSyntaxLuaError())) );\n           inputErrors.append(inFilePath);\n       } else {\n\n          if (ui->cbReformat->isChecked()&& !generator->formattingIsPossible()){\n             reformatErrors.append(inFilePath);\n          }\n          \n          inFileName = QFileInfo(inFilePath).fileName();\n          \n\t  if (ui->cbWrite2Src->isChecked()) {\n            outfileName = currentFile;\n          } else {\n              QFileInfo outFileInfo;\n\t      QString fName=inFileName;\n\t      if (usedFileNames.contains(fName)){\n\t\tQString prefix=QFileInfo(inFilePath).canonicalPath()+ QDir::separator();\n\t\tprefix.replace(QDir::separator(), '_');\n\t\tfName.insert(0, prefix);\n\t      } else {\n\t\tusedFileNames.insert(fName);\n\t      }\n              outFileInfo.setFile(ui->leOutputDest->text(),fName);\n              outfileName = outFileInfo.absoluteFilePath().toStdString();\n          }\n          outfileName +=  getOutFileSuffix().toStdString();;\n\n\n          if (ui->cbHTMLFileNameAnchor->isChecked()){\n            generator->setHTMLAnchorPrefix(inFileName.toStdString());\n          }\n          generator->setTitle(inFileName.toStdString());\n          error = generator->generateFile(currentFile, outfileName );\n          if (error != highlight::PARSE_OK){\n            if (error == highlight::BAD_INPUT) {\n              inputErrors.append(inFilePath);\n            }\n            else {\n              outputErrors.append(inFilePath);\n            }\n          }\n          ui->progressBar->setValue(100*i / ui->lvInputFiles->count());\n        }\n   }\n\n   // write external Stylesheet\n   if (cbEmbed && leStyleFile && !cbEmbed->isChecked()) {\n       QString stylePath=QFileInfo(ui->leOutputDest->text(),   leStyleFile->text()).absoluteFilePath();\n       bool styleFileOK=generator -> printExternalStyle(QDir::toNativeSeparators(stylePath).toStdString());\n       if (!styleFileOK) {\n           outputErrors.append(stylePath);\n       }\n   }\n\n   // write HTML index file\n   if (    (outType==highlight::HTML || outType==highlight::XHTML)\n        && ui->cbHTMLIndex->isChecked() && !ui->cbWrite2Src->isChecked()) {\n      vector <string>  fileList;\n      for (int i=0;i<ui->lvInputFiles->count();i++){\n         fileList.push_back(QDir::toNativeSeparators(ui->lvInputFiles->item(i)->text()).toStdString());\n      }\n      QString outPath = QDir::toNativeSeparators(ui->leOutputDest->text());\n      if (!outPath.endsWith(QDir::separator())) outPath.append(QDir::separator());\n      bool indexFileOK=generator->printIndexFile(fileList,  outPath.toStdString());\n      if (!indexFileOK) {\n           outputErrors.append(outPath+ ((outType==highlight::HTML)?\"index.html\":\"index.xhtml\"));\n      }\n   }\n\n   statusBar()->showMessage(tr(\"Converted %1 files in %2 ms\").arg(ui->lvInputFiles->count()).arg(t.elapsed()));\n   ui->progressBar->reset();\n   this->setCursor(Qt::ArrowCursor);\n   ui->pbStartConversion->setEnabled(true);\n   ui->pbCopyFile2CP->setEnabled(true);\n\n   if (!inputErrors.isEmpty() || !outputErrors.isEmpty() || !reformatErrors.isEmpty()){\n       io_report report;\n       report.addInputErrors(inputErrors);\n       report.addOutputErrors(outputErrors);\n       report.addReformatErrors(reformatErrors);\n       report.exec();\n       if (report.removeInputErrorFiles()){\n           QList<QListWidgetItem*> items;\n           for (int i=0;i<inputErrors.count();i++){\n               items=ui->lvInputFiles->findItems(inputErrors.at(i),Qt::MatchExactly);\n               for (int j=0;j<items.count();j++){\n                   delete items.at(j);\n               }\n           }\n       }\n   }\n}\n\nvoid MainWindow::on_pbCopyFile2CP_clicked(){\n\n    highlight2Clipboard(false);\n}\n\nvoid MainWindow::highlight2Clipboard(bool getDataFromCP){\n\n    if ((!getDataFromCP &&NULL==ui->lvInputFiles->currentItem())\n        || (getDataFromCP && savedClipboardContent.isEmpty())) return;\n\n     this->setCursor(Qt::WaitCursor);\n\n     auto_ptr<highlight::CodeGenerator> generator(\n             highlight::CodeGenerator::getInstance(getOutputType()));\n\n     applyCtrlValues(generator.get(), false);\n\n     string suffix;\n     if (getDataFromCP){\n         suffix= getFileType((ui->comboSelectSyntax->itemData(ui->comboSelectSyntax->currentIndex())).toString().toStdString(),\"\");\n     }else {\n         string currentFile = ui->lvInputFiles->currentItem()->text().toStdString();\n         suffix = getFileType(getFileSuffix(currentFile), currentFile);\n\n         QString inFileName = QFileInfo(ui->lvInputFiles->currentItem()->text()).fileName();\n         generator->setTitle(inFileName.toStdString());\n     }\n\n#ifdef DATA_DIR\n QString langPath = QDir::toNativeSeparators(QString(\"%1/langDefs/%2.lang\").arg(\n         DATA_DIR).arg(QString::fromStdString(suffix)));\n#else\n     QString langPath = QDir::toNativeSeparators(QString(\"%1/langDefs/%2.lang\").arg(\n             QDir::currentPath()).arg(QString::fromStdString(suffix)));\n#endif\n\n     if ( generator->loadLanguage(langPath.toStdString()) != highlight::LOAD_FAILED){\n          QString clipBoardData;\n          if (getDataFromCP){\n               clipBoardData= QString::fromStdString( generator->generateString(savedClipboardContent.toStdString()));\n           } else {\n                clipBoardData= QString::fromStdString( generator->generateStringFromFile(ui->lvInputFiles->currentItem()->text().toStdString()));\n          }\n\n          QClipboard *clipboard = QApplication::clipboard();\n          if (clipboard) {\n              highlight::OutputType outputType = getOutputType();\n              if ( outputType==highlight::RTF){\n                   QMimeData *mimeData = new QMimeData();\n#ifdef Q_OS_WIN32\n                  mimeData->setData(\"Rich Text Format\", clipBoardData.toLatin1());\n#else\n                  mimeData->setData(\"text/rtf\", clipBoardData.toLatin1());\n#endif\n                  clipboard->setMimeData(mimeData);\n              } else {\n                   clipboard->setText(clipBoardData);\n              }\n          }\n     } else {\n           statusBar()->showMessage(\n                   tr(\"Conversion of \\\"%1\\\" not possible.\").arg((getDataFromCP)?tr(\"clipboard data\"):ui->lvInputFiles->currentItem()->text()));\n     }\n    this->setCursor(Qt::ArrowCursor);\n}\n\n void MainWindow::plausibility(){\n     ui->leOutputDest->setEnabled(!ui->cbWrite2Src->isChecked());\n     ui->pbOutputDest->setEnabled(!ui->cbWrite2Src->isChecked());\n     ui->pbOutputDest->setEnabled(!ui->cbWrite2Src->isChecked());\n     ui->leOutputDest->setEnabled(!ui->cbWrite2Src->isChecked());\n     ui->cbPadZeroes->setEnabled(ui->cbIncLineNo->isChecked());\n     ui->cbAdvWrapping->setEnabled(ui->cbWrapping->isChecked());\n     ui->comboEncoding->setEnabled(ui->cbEncoding->isChecked());\n\n     ui->comboReformat->setEnabled(ui->cbReformat->isChecked());\n     ui->comboKwCase->setEnabled(ui->cbKwCase->isChecked());\n     ui->cbHTMLInlineCSS->setEnabled(ui->cbHTMLEmbedStyle->isChecked());\n     ui->cbHTMLFileNameAnchor->setEnabled(ui->cbHTMLAnchors->isChecked());\n     ui->leHTMLStyleFile->setEnabled(!ui->cbHTMLEmbedStyle->isChecked());\n     ui->leHTMLStyleIncFile->setEnabled(ui->cbHTMLEmbedStyle->isChecked() && !ui->cbHTMLInlineCSS->isChecked());\n     ui->pbHTMLChooseStyleIncFile->setEnabled(ui->cbHTMLEmbedStyle->isChecked() &&!ui->cbHTMLInlineCSS->isChecked());\n     ui->leHTMLCssPrefix->setEnabled(!ui->cbHTMLInlineCSS->isChecked());\n     ui->leLATEXStyleFile->setEnabled(!ui->cbLATEXEmbedStyle->isChecked());\n     ui->leTEXStyleFile->setEnabled(!ui->cbTEXEmbedStyle->isChecked());\n     ui->leSVGStyleFile->setEnabled(!ui->cbSVGEmbedStyle->isChecked());\n\n     ui->cbFragment->setEnabled( getOutputType()!=highlight::RTF && getOutputType()!=highlight::SVG );\n     ui->sbLineNoWidth->setEnabled(ui->cbIncLineNo->isChecked());\n     ui->sbLineNoStart->setEnabled(ui->cbIncLineNo->isChecked());\n     ui->cbHTMLIndex->setEnabled(!ui->cbWrite2Src->isChecked());\n     ui->cbHTMLEnclosePreTags->setEnabled(ui->cbFragment->isChecked());\n     ui->cbHTMLAnchors->setEnabled(ui->cbIncLineNo->isChecked());\n     ui->cbHTMLFileNameAnchor->setEnabled(ui->cbIncLineNo->isChecked());\n     ui->cbHTMLOrderedList->setEnabled(ui->cbIncLineNo->isChecked());\n\n      ui->pbCopyToCP->setEnabled(!savedClipboardContent.isEmpty());\n\n     switch (ui->comboFormat->currentIndex()) {\n    case 0:\n    case 1:\n         ui->stackedSpecificOptions->setCurrentIndex(0);\n         break;\n    case 2:\n         ui->stackedSpecificOptions->setCurrentIndex(1);\n         break;\n    case 3:\n         ui->stackedSpecificOptions->setCurrentIndex(2);\n         break;\n    case 4:\n         ui->stackedSpecificOptions->setCurrentIndex(3);\n         break;\n    case 6:\n         ui->stackedSpecificOptions->setCurrentIndex(4);\n         break;\n    default:\n         ui->stackedSpecificOptions->setCurrentIndex(5);\n         break;\n  }\n     ui->tabWidgetOptions->setTabText(1, tr(\"%1 options\").arg(ui->comboFormat->currentText() ));\n     //ui->tabWidget->setTabText(1, tr(\"%1 options\").arg(ui->comboFormat->currentText() ));\n }\n\n void MainWindow::updatePreview() {\n\n     //toggle input source flag if file is selcetd or clipboard is pasted\n     if (sender()== ui->pbPasteFromCB|| sender()==ui->lvInputFiles){\n        getDataFromCP = sender()==ui->pbPasteFromCB;\n    }\n\n     if ((!getDataFromCP && NULL==ui->lvInputFiles->currentItem())\n         || (getDataFromCP && savedClipboardContent.isEmpty())) return;\n\n     int vScroll = ui->browserPreview->verticalScrollBar()->value();\n     int hScroll = ui->browserPreview->horizontalScrollBar()->value();\n     this->setCursor(Qt::WaitCursor);\n     highlight::HtmlGenerator pwgenerator;\n     pwgenerator.setIncludeStyle(true);\n     pwgenerator.setHTMLInlineCSS(true);\n     if (!getDataFromCP){\n         pwgenerator.setMaxInputLineCnt(1000);\n     }\n\n     applyCtrlValues(&pwgenerator, true);\n\n     string suffix;\n\n     if (getDataFromCP){\n          suffix= getFileType((ui->comboSelectSyntax->itemData(ui->comboSelectSyntax->currentIndex())).toString().toStdString(),\"\");\n     } else {\n         string currentFile = ui->lvInputFiles->currentItem()->text().toStdString();\n         suffix = getFileType(getFileSuffix(currentFile), currentFile);\n     }\n#ifdef DATA_DIR\n QString langPath = QDir::toNativeSeparators(QString(\"%1/langDefs/%2.lang\").arg(\n         DATA_DIR).arg(QString::fromStdString(suffix)));\n#else\n     QString langPath = QDir::toNativeSeparators(QString(\"%1/langDefs/%2.lang\").arg(\n             QDir::currentPath()).arg(QString::fromStdString(suffix)));\n#endif\n\n\n     if ( pwgenerator.loadLanguage(langPath.toStdString()) != highlight::LOAD_FAILED){\n\n          ui->lbPreview->setText(tr(\"Preview (%1):\").arg(\n                  (getDataFromCP)?tr(\"clipboard data\"):ui->lvInputFiles->currentItem()->text()) );\n\n          statusBar()->showMessage(tr(\"Current syntax: %1\").arg(QString::fromStdString(pwgenerator.getSyntaxDescription())));\n          QString previewData;\n\n          // fix utf-8 data preview - to be improved (other encodings??)\n          if (ui->cbEncoding->isChecked() && ui->comboEncoding->currentText().toLower()==\"utf-8\"){\n              if (getDataFromCP){\n                   previewData= QString::fromUtf8( pwgenerator.generateString(savedClipboardContent.toStdString()).c_str());\n              } else {\n                    previewData= QString::fromUtf8( pwgenerator.generateStringFromFile(ui->lvInputFiles->currentItem()->text().toStdString()).c_str());\n              }\n          }\n          else {\n              if (getDataFromCP){\n                   previewData= QString::fromStdString( pwgenerator.generateString(savedClipboardContent.toStdString()));\n              } else {\n                    previewData= QString::fromStdString( pwgenerator.generateStringFromFile(ui->lvInputFiles->currentItem()->text().toStdString()));\n              }\n          }\n\n          ui->browserPreview->setHtml(previewData);\n     } else {\n         statusBar()->showMessage(tr(\"Preview of \\\"%1\\\" not possible.\").arg((getDataFromCP)?tr(\"clipboard data\"):ui->lvInputFiles->currentItem()->text()));\n     }\n     ui->browserPreview->verticalScrollBar()->setValue(vScroll);\n     ui->browserPreview->horizontalScrollBar()->setValue(hScroll);\n     this->setCursor(Qt::ArrowCursor);\n }\n\n\nvoid MainWindow::on_action_Manual_triggered()\n{\n    ShowTextFile show;\n    show.setFileName(\"README\");\n    show.exec();\n}\n\nvoid MainWindow::on_action_Changelog_triggered()\n{\n    ShowTextFile show;\n    show.setFileName(\"ChangeLog\");\n    show.exec();\n}\n\nvoid MainWindow::on_action_License_triggered()\n{\n    ShowTextFile show;\n    show.setFileName(\"COPYING\");\n    show.exec();\n}\n\n\n\nvoid MainWindow::on_pbHTMLChooseStyleIncFile_clicked()\n{\n        selectSingleFile(ui->leHTMLStyleIncFile, tr(\"Choose a style include file\"), \"*.css\");\n}\nvoid MainWindow::on_pbSVGChooseStyleIncFile_clicked()\n{\n        selectSingleFile(ui->leSVGStyleIncFile, tr(\"Choose a style include file\"), \"*.css\");\n}\nvoid MainWindow::on_pbLATEXChooseStyleIncFile_clicked()\n{\n    selectSingleFile(ui->leLATEXStyleIncFile, tr(\"Choose a style include file\"), \"*.sty\");\n}\n\nvoid MainWindow::on_pbTEXChooseStyleIncFile_clicked()\n{\n        selectSingleFile(ui->leTEXStyleIncFile, tr(\"Choose a style include file\"), \"*.sty\");\n}\n\nvoid MainWindow::on_actionAbout_translations_triggered()\n{\n    QMessageBox::information(this, tr(\"About providing translations\"),\n                             tr(\"The GUI was developed using the Qt toolkit, and \"\n                                \"translations may be provided using the tools Qt Linguist and lrelease.\\n\"\n                                \"The highlight.ts file for Linguist resides in the src/gui-qt subdirectory.\\n\"\n                                \"The qm file generated by lrelease has to be saved in gui-files/l10n.\\n\\n\"\n                                \"Please send a note to as (at) andre-simon (dot) de if you have issues during translating \"\n                                \"or if you have finished or updated a translation.\"));\n}\n\n void MainWindow::dropEvent(QDropEvent *event)\n {\n     const QMimeData *mimeData = event->mimeData();\n\n     if (mimeData && mimeData->hasUrls()) {\n         QList<QUrl> urlList = mimeData->urls();\n         QString url;\n         for (int i = 0; i < urlList.size(); ++i) {\n             url=urlList.at(i).toLocalFile();\n             if (ui->lvInputFiles->findItems ( url, Qt::MatchExactly ).empty()) {\n               ui->lvInputFiles->addItem(url);\n             }\n         }\n     }\n     event->acceptProposedAction();\n }\n\n void MainWindow::dragEnterEvent(QDragEnterEvent *event)\n {\n     event->acceptProposedAction();\n }\n\n void MainWindow::dragMoveEvent(QDragMoveEvent *event)\n {\n     event->acceptProposedAction();\n }\n\n  void MainWindow::dragLeaveEvent(QDragLeaveEvent *event)\n {\n     event->accept();\n }\n\nvoid MainWindow::on_pbPasteFromCB_clicked()\n{\n    QClipboard *clipboard = QApplication::clipboard();\n    if (clipboard) {\n        savedClipboardContent = clipboard->text();\n        updatePreview();\n        ui->pbCopyToCP->setEnabled(!savedClipboardContent.isEmpty());\n   }\n}\n\nvoid MainWindow::on_pbCopyToCP_clicked()\n{\n    highlight2Clipboard(true);\n}\n\nvoid MainWindow::on_pbSelectPlugin_clicked()\n{\n#ifdef DATA_DIR\n    QString pluginsPath = QDir::toNativeSeparators(QString(\"%1/plugins\").arg(DATA_DIR));\n#else\n     QString pluginsPath = QDir::toNativeSeparators(QString(\"%1/plugins\").arg(QDir::currentPath()));\n#endif\n\n    QStringList files = QFileDialog::getOpenFileNames(\n                            this,\n                            tr(\"Select one or more plug-ins\"),\n                            pluginsPath,\n                            \"*.lua\");\n\n     addInputFiles(files, ui->lvPluginScripts, \":/plugin.png\",  true);\n}\n\nvoid MainWindow::on_pbClearSelPlugin_clicked()\n{\n    QList<QListWidgetItem *> selectedItems = ui->lvPluginScripts->selectedItems();\n    for (int i = 0; i < selectedItems.size(); ++i) {\n        delete selectedItems.at(i);\n    }\n}\n\nvoid MainWindow::on_pbClearAll_clicked()\n{\n    ui->lvInputFiles->clear();\n}\n\nvoid MainWindow::on_pbClearAllPlugins_clicked()\n{\n    ui->lvPluginScripts->clear();\n}\n\nvoid MainWindow::on_actionVisit_website_triggered()\n{\n    QDesktopServices::openUrl(QUrl(\"http://www.andre-simon.de/\"));\n}\n\n\nvoid MainWindow::on_actionDock_floating_panels_toggled(bool arg1)\n{\n    ui->dockWidget->setFloating(arg1);\n}\n\nvoid MainWindow::on_pbPluginReadFilePath_clicked()\n{\n       selectSingleFile(ui->lePluginReadFilePath, tr(\"Choose a plug-in input file\"), \"*\");\n}\n\nvoid MainWindow::on_lvPluginScripts_currentRowChanged(int currentRow)\n{\n    try {\n        Diluculum::LuaState ls;\n        ls.doFile ( ui->lvPluginScripts->item(currentRow)->text().toStdString());\n        ui->lblPluginDescription->setText(QString::fromStdString(ls[\"Description\"].value().asString()));\n    }\n    catch (Diluculum::LuaError err) {\n        QMessageBox::warning(this, \"Plug-In error\", QString::fromStdString( err.what()));\n    }\n}\n"
  },
  {
    "path": "jni/highlight/gui-qt/mainwindow.h",
    "content": "/***************************************************************************\n                               mainwindow.h\n                             -------------------\n    begin                : Mo 16.03.2009\n    copyright            : (C) 2009 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n#ifndef MAINWINDOW_H\n#define MAINWINDOW_H\n\n#include <QtGlobal>\n\n#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))\n#include <QtGui/QMainWindow>\n#include <QtGui/QMessageBox>\n#include <QtGui/QFileDialog>\n#include <QtGui/QListWidget>\n#include <QLineEdit>\n#include <QScrollBar>\n#include <QDropEvent>\n#else\n#include <QtWidgets/QMainWindow>\n#include <QtWidgets/QMessageBox>\n#include <QtWidgets/QFileDialog>\n#include <QtWidgets/QListWidget>\n#include <QtWidgets/QLineEdit>\n#include <QtWidgets/QScrollBar>\n#include <QDropEvent>\n#endif\n#include <QSettings>\n#include <QDir>\n#include <QClipboard>\n#include <QMimeData>\n#include <QTime>\n\n#include <QString>\n#include <QTextStream>\n\n#include <QDesktopServices>\n\n#include \"version.h\"\n#include \"codegenerator.h\"\n#include \"htmlgenerator.h\"\n\n\n#include \"enums.h\"\n\ntypedef map<string, string> StringMap;\n\nnamespace Ui\n{\n    class MainWindowClass;\n}\n\nclass MainWindow : public QMainWindow\n{\n    Q_OBJECT\n\npublic:\n    MainWindow(QWidget *parent = 0);\n    ~MainWindow();\n\n    void addInputFiles(const QStringList& list, QListWidget* listWidget, const QString &iconName=\":/file.png\", bool checkable=false);\n\nprivate:\n    Ui::MainWindowClass *ui;\n    StringMap extensions,  shebangs;\n    QString fileOpenFilter;\n    QString savedClipboardContent;\n    bool getDataFromCP;\n\n    void readSettings();\n    void writeSettings();\n    highlight::OutputType getOutputType();\n    highlight::WrapMode getWrappingStyle();\n    QString getOutFileSuffix();\n    void applyCtrlValues(highlight::CodeGenerator* generator, bool previewMode);\n    void selectSingleFile(QLineEdit*, const QString&, const QString&);\n    bool loadFileTypeConfig(StringMap* extMap, StringMap* shebangMap);\n    void highlight2Clipboard(bool getDataFromCP);\n\n    string analyzeFile(const string& file);\n    string getFileType(const string& suffix, const string &inputFile);\n    string getFileSuffix(const string& fileName);\n\n     void dragEnterEvent(QDragEnterEvent *event);\n     void dragMoveEvent(QDragMoveEvent *event);\n     void dragLeaveEvent(QDragLeaveEvent *event);\n     void dropEvent(QDropEvent *event);\n\npublic slots:\n    //This is a slot like the ones we used in our last tutorial\n    // The difference here that it gets automatically connect\n    // If you use on_objectname_signalname it's like connect(pushButton,SIGNAL(clicked()),this,SLOT(on_pushButton_clicked()))\n\n    void on_pbClearSelection_clicked();\n    void on_pbOutputDest_clicked();\n    void on_pbStartConversion_clicked();\n    void on_pbCopyFile2CP_clicked();\n\nprivate slots:\n\n    void on_actionVisit_website_triggered();\n    void on_pbClearAllPlugins_clicked();\n    void on_pbClearAll_clicked();\n    void on_pbClearSelPlugin_clicked();\n    void on_pbSelectPlugin_clicked();\n    void on_pbCopyToCP_clicked();\n    void on_pbPasteFromCB_clicked();\n    void on_actionAbout_translations_triggered();\n    void on_pbTEXChooseStyleIncFile_clicked();\n    void on_pbLATEXChooseStyleIncFile_clicked();\n    void on_pbHTMLChooseStyleIncFile_clicked();\n    void on_pbSVGChooseStyleIncFile_clicked();\n\n    void on_action_License_triggered();\n    void on_action_Changelog_triggered();\n    void on_action_Manual_triggered();\n    void on_action_About_Highlight_triggered();\n    void on_action_Exit_triggered();\n    void plausibility();\n    void updatePreview();\n    void openFiles();\n\n    void on_actionDock_floating_panels_toggled(bool arg1);\n    void on_pbPluginReadFilePath_clicked();\n\n    void on_lvPluginScripts_currentRowChanged(int currentRow);\n};\n\n#endif // MAINWINDOW_H\n"
  },
  {
    "path": "jni/highlight/gui-qt/mainwindow.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<ui version=\"4.0\">\r\n <class>MainWindowClass</class>\r\n <widget class=\"QMainWindow\" name=\"MainWindowClass\">\r\n  <property name=\"windowModality\">\r\n   <enum>Qt::ApplicationModal</enum>\r\n  </property>\r\n  <property name=\"geometry\">\r\n   <rect>\r\n    <x>0</x>\r\n    <y>0</y>\r\n    <width>957</width>\r\n    <height>775</height>\r\n   </rect>\r\n  </property>\r\n  <property name=\"acceptDrops\">\r\n   <bool>false</bool>\r\n  </property>\r\n  <property name=\"windowTitle\">\r\n   <string>Highlight</string>\r\n  </property>\r\n  <property name=\"windowIcon\">\r\n   <iconset resource=\"../w32-projects/highlight_gui/highlight-gui.qrc\">\r\n    <normaloff>:/hl_icon2.png</normaloff>:/hl_icon2.png</iconset>\r\n  </property>\r\n  <widget class=\"QWidget\" name=\"centralWidget\">\r\n   <layout class=\"QHBoxLayout\" name=\"horizontalLayout_25\">\r\n    <item>\r\n     <layout class=\"QVBoxLayout\" name=\"verticalLayout_13\">\r\n      <item>\r\n       <widget class=\"QLabel\" name=\"lbPreview\">\r\n        <property name=\"text\">\r\n         <string>Preview</string>\r\n        </property>\r\n       </widget>\r\n      </item>\r\n      <item>\r\n       <widget class=\"QTextBrowser\" name=\"browserPreview\">\r\n        <property name=\"sizePolicy\">\r\n         <sizepolicy hsizetype=\"Expanding\" vsizetype=\"Expanding\">\r\n          <horstretch>0</horstretch>\r\n          <verstretch>0</verstretch>\r\n         </sizepolicy>\r\n        </property>\r\n        <property name=\"toolTip\">\r\n         <string/>\r\n        </property>\r\n        <property name=\"whatsThis\">\r\n         <string/>\r\n        </property>\r\n        <property name=\"openExternalLinks\">\r\n         <bool>true</bool>\r\n        </property>\r\n       </widget>\r\n      </item>\r\n      <item>\r\n       <layout class=\"QHBoxLayout\" name=\"horizontalLayout_13\">\r\n        <item>\r\n         <widget class=\"QLabel\" name=\"label_14\">\r\n          <property name=\"text\">\r\n           <string>Output progress:</string>\r\n          </property>\r\n         </widget>\r\n        </item>\r\n        <item>\r\n         <widget class=\"QProgressBar\" name=\"progressBar\">\r\n          <property name=\"value\">\r\n           <number>0</number>\r\n          </property>\r\n         </widget>\r\n        </item>\r\n       </layout>\r\n      </item>\r\n     </layout>\r\n    </item>\r\n   </layout>\r\n  </widget>\r\n  <widget class=\"QMenuBar\" name=\"menuBar\">\r\n   <property name=\"geometry\">\r\n    <rect>\r\n     <x>0</x>\r\n     <y>0</y>\r\n     <width>957</width>\r\n     <height>21</height>\r\n    </rect>\r\n   </property>\r\n   <widget class=\"QMenu\" name=\"menu_File\">\r\n    <property name=\"title\">\r\n     <string>&amp;File</string>\r\n    </property>\r\n    <addaction name=\"action_Open_files\"/>\r\n    <addaction name=\"separator\"/>\r\n    <addaction name=\"action_Exit\"/>\r\n   </widget>\r\n   <widget class=\"QMenu\" name=\"menu_Help\">\r\n    <property name=\"title\">\r\n     <string>&amp;Help</string>\r\n    </property>\r\n    <addaction name=\"action_Tips\"/>\r\n    <addaction name=\"action_Manual\"/>\r\n    <addaction name=\"action_Changelog\"/>\r\n    <addaction name=\"action_License\"/>\r\n    <addaction name=\"separator\"/>\r\n    <addaction name=\"actionAbout_translations\"/>\r\n    <addaction name=\"separator\"/>\r\n    <addaction name=\"actionVisit_website\"/>\r\n    <addaction name=\"action_About_Highlight\"/>\r\n   </widget>\r\n   <widget class=\"QMenu\" name=\"menuWindows\">\r\n    <property name=\"title\">\r\n     <string>&amp;Windows</string>\r\n    </property>\r\n    <addaction name=\"actionDock_floating_panels\"/>\r\n   </widget>\r\n   <addaction name=\"menu_File\"/>\r\n   <addaction name=\"menuWindows\"/>\r\n   <addaction name=\"menu_Help\"/>\r\n  </widget>\r\n  <widget class=\"QStatusBar\" name=\"statusBar\"/>\r\n  <widget class=\"QDockWidget\" name=\"dockWidget\">\r\n   <property name=\"floating\">\r\n    <bool>false</bool>\r\n   </property>\r\n   <property name=\"features\">\r\n    <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>\r\n   </property>\r\n   <property name=\"allowedAreas\">\r\n    <set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>\r\n   </property>\r\n   <property name=\"windowTitle\">\r\n    <string>Highlighting options</string>\r\n   </property>\r\n   <attribute name=\"dockWidgetArea\">\r\n    <number>1</number>\r\n   </attribute>\r\n   <widget class=\"QWidget\" name=\"dockWidgetContents\">\r\n    <layout class=\"QVBoxLayout\" name=\"verticalLayout_16\">\r\n     <item>\r\n      <widget class=\"QTabWidget\" name=\"tabIOSelection\">\r\n       <property name=\"sizePolicy\">\r\n        <sizepolicy hsizetype=\"Minimum\" vsizetype=\"Expanding\">\r\n         <horstretch>0</horstretch>\r\n         <verstretch>0</verstretch>\r\n        </sizepolicy>\r\n       </property>\r\n       <property name=\"minimumSize\">\r\n        <size>\r\n         <width>0</width>\r\n         <height>0</height>\r\n        </size>\r\n       </property>\r\n       <property name=\"currentIndex\">\r\n        <number>0</number>\r\n       </property>\r\n       <widget class=\"QWidget\" name=\"tab_file_io\">\r\n        <attribute name=\"title\">\r\n         <string>Files</string>\r\n        </attribute>\r\n        <layout class=\"QVBoxLayout\" name=\"verticalLayout_3\">\r\n         <item>\r\n          <widget class=\"QPushButton\" name=\"pbOpenFiles\">\r\n           <property name=\"toolTip\">\r\n            <string>Choose the source code files you want to convert.</string>\r\n           </property>\r\n           <property name=\"whatsThis\">\r\n            <string/>\r\n           </property>\r\n           <property name=\"text\">\r\n            <string>Choose input files</string>\r\n           </property>\r\n           <property name=\"icon\">\r\n            <iconset resource=\"../w32-projects/highlight_gui/highlight-gui.qrc\">\r\n             <normaloff>:/file.png</normaloff>:/file.png</iconset>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <widget class=\"QListWidget\" name=\"lvInputFiles\">\r\n           <property name=\"sizePolicy\">\r\n            <sizepolicy hsizetype=\"Preferred\" vsizetype=\"MinimumExpanding\">\r\n             <horstretch>0</horstretch>\r\n             <verstretch>0</verstretch>\r\n            </sizepolicy>\r\n           </property>\r\n           <property name=\"minimumSize\">\r\n            <size>\r\n             <width>0</width>\r\n             <height>50</height>\r\n            </size>\r\n           </property>\r\n           <property name=\"acceptDrops\">\r\n            <bool>false</bool>\r\n           </property>\r\n           <property name=\"toolTip\">\r\n            <string>List of input files.</string>\r\n           </property>\r\n           <property name=\"dragDropMode\">\r\n            <enum>QAbstractItemView::DropOnly</enum>\r\n           </property>\r\n           <property name=\"alternatingRowColors\">\r\n            <bool>true</bool>\r\n           </property>\r\n           <property name=\"selectionMode\">\r\n            <enum>QAbstractItemView::ExtendedSelection</enum>\r\n           </property>\r\n           <property name=\"selectionBehavior\">\r\n            <enum>QAbstractItemView::SelectRows</enum>\r\n           </property>\r\n           <property name=\"sortingEnabled\">\r\n            <bool>true</bool>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <layout class=\"QHBoxLayout\" name=\"horizontalLayout\">\r\n           <item>\r\n            <widget class=\"QPushButton\" name=\"pbClearSelection\">\r\n             <property name=\"toolTip\">\r\n              <string>Remove the selected input files.</string>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Clear selection</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item>\r\n            <widget class=\"QPushButton\" name=\"pbClearAll\">\r\n             <property name=\"toolTip\">\r\n              <string>Remove all input files.</string>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Clear all</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n          </layout>\r\n         </item>\r\n         <item>\r\n          <widget class=\"Line\" name=\"line_11\">\r\n           <property name=\"orientation\">\r\n            <enum>Qt::Horizontal</enum>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <layout class=\"QVBoxLayout\" name=\"verticalLayout\">\r\n           <item>\r\n            <widget class=\"QLabel\" name=\"label_11\">\r\n             <property name=\"font\">\r\n              <font>\r\n               <weight>75</weight>\r\n               <bold>true</bold>\r\n              </font>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Output destination:</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item>\r\n            <layout class=\"QHBoxLayout\" name=\"horizontalLayout_22\">\r\n             <item>\r\n              <widget class=\"QLineEdit\" name=\"leOutputDest\">\r\n               <property name=\"sizePolicy\">\r\n                <sizepolicy hsizetype=\"Minimum\" vsizetype=\"Preferred\">\r\n                 <horstretch>0</horstretch>\r\n                 <verstretch>0</verstretch>\r\n                </sizepolicy>\r\n               </property>\r\n               <property name=\"toolTip\">\r\n                <string>Output directory</string>\r\n               </property>\r\n              </widget>\r\n             </item>\r\n             <item>\r\n              <widget class=\"QPushButton\" name=\"pbOutputDest\">\r\n               <property name=\"sizePolicy\">\r\n                <sizepolicy hsizetype=\"Fixed\" vsizetype=\"Fixed\">\r\n                 <horstretch>0</horstretch>\r\n                 <verstretch>0</verstretch>\r\n                </sizepolicy>\r\n               </property>\r\n               <property name=\"minimumSize\">\r\n                <size>\r\n                 <width>20</width>\r\n                 <height>0</height>\r\n                </size>\r\n               </property>\r\n               <property name=\"toolTip\">\r\n                <string>Select the output directory.</string>\r\n               </property>\r\n               <property name=\"text\">\r\n                <string>...</string>\r\n               </property>\r\n              </widget>\r\n             </item>\r\n            </layout>\r\n           </item>\r\n           <item>\r\n            <widget class=\"QCheckBox\" name=\"cbWrite2Src\">\r\n             <property name=\"toolTip\">\r\n              <string>Save output in the input file directories.</string>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Write to source directories</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n          </layout>\r\n         </item>\r\n         <item>\r\n          <widget class=\"Line\" name=\"line_2\">\r\n           <property name=\"orientation\">\r\n            <enum>Qt::Horizontal</enum>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <widget class=\"QPushButton\" name=\"pbStartConversion\">\r\n           <property name=\"sizePolicy\">\r\n            <sizepolicy hsizetype=\"Preferred\" vsizetype=\"Fixed\">\r\n             <horstretch>0</horstretch>\r\n             <verstretch>0</verstretch>\r\n            </sizepolicy>\r\n           </property>\r\n           <property name=\"minimumSize\">\r\n            <size>\r\n             <width>120</width>\r\n             <height>0</height>\r\n            </size>\r\n           </property>\r\n           <property name=\"font\">\r\n            <font>\r\n             <family>MS Shell Dlg 2</family>\r\n             <pointsize>10</pointsize>\r\n             <weight>75</weight>\r\n             <bold>true</bold>\r\n            </font>\r\n           </property>\r\n           <property name=\"toolTip\">\r\n            <string>Start the conversion of your input files.</string>\r\n           </property>\r\n           <property name=\"text\">\r\n            <string>Convert files</string>\r\n           </property>\r\n           <property name=\"default\">\r\n            <bool>true</bool>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <widget class=\"QPushButton\" name=\"pbCopyFile2CP\">\r\n           <property name=\"toolTip\">\r\n            <string>Copy highlighted code of the seleted file into the clipboard.</string>\r\n           </property>\r\n           <property name=\"text\">\r\n            <string>Copy file to clipboard</string>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n        </layout>\r\n       </widget>\r\n       <widget class=\"QWidget\" name=\"tab_clipboard\">\r\n        <attribute name=\"title\">\r\n         <string>Clipboard</string>\r\n        </attribute>\r\n        <layout class=\"QVBoxLayout\" name=\"verticalLayout_15\">\r\n         <item>\r\n          <widget class=\"QPushButton\" name=\"pbPasteFromCB\">\r\n           <property name=\"toolTip\">\r\n            <string>Paste clipboard content into the preview window.</string>\r\n           </property>\r\n           <property name=\"text\">\r\n            <string>Paste from clipboard</string>\r\n           </property>\r\n           <property name=\"icon\">\r\n            <iconset resource=\"../w32-projects/highlight_gui/highlight-gui.qrc\">\r\n             <normaloff>:/file.png</normaloff>:/file.png</iconset>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <layout class=\"QHBoxLayout\" name=\"horizontalLayout_23\">\r\n           <item>\r\n            <widget class=\"QLabel\" name=\"label_13\">\r\n             <property name=\"text\">\r\n              <string>Select syntax:</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item>\r\n            <widget class=\"QComboBox\" name=\"comboSelectSyntax\">\r\n             <property name=\"toolTip\">\r\n              <string>Select the correct syntax of the code snippet.</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n          </layout>\r\n         </item>\r\n         <item>\r\n          <widget class=\"Line\" name=\"line_14\">\r\n           <property name=\"orientation\">\r\n            <enum>Qt::Horizontal</enum>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <widget class=\"QPushButton\" name=\"pbCopyToCP\">\r\n           <property name=\"font\">\r\n            <font>\r\n             <weight>75</weight>\r\n             <bold>true</bold>\r\n            </font>\r\n           </property>\r\n           <property name=\"toolTip\">\r\n            <string>Copy highlighted code into the clipboard.</string>\r\n           </property>\r\n           <property name=\"text\">\r\n            <string>Copy preview to clipboard</string>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <spacer name=\"verticalSpacer_12\">\r\n           <property name=\"orientation\">\r\n            <enum>Qt::Vertical</enum>\r\n           </property>\r\n           <property name=\"sizeHint\" stdset=\"0\">\r\n            <size>\r\n             <width>20</width>\r\n             <height>106</height>\r\n            </size>\r\n           </property>\r\n          </spacer>\r\n         </item>\r\n        </layout>\r\n       </widget>\r\n       <widget class=\"QWidget\" name=\"tab_plugins\">\r\n        <attribute name=\"title\">\r\n         <string>Plug-ins</string>\r\n        </attribute>\r\n        <layout class=\"QVBoxLayout\" name=\"verticalLayout_7\">\r\n         <item>\r\n          <widget class=\"QPushButton\" name=\"pbSelectPlugin\">\r\n           <property name=\"toolTip\">\r\n            <string>Choose a plug-in script.</string>\r\n           </property>\r\n           <property name=\"text\">\r\n            <string>Add plug-in to pool</string>\r\n           </property>\r\n           <property name=\"icon\">\r\n            <iconset resource=\"../w32-projects/highlight_gui/highlight-gui.qrc\">\r\n             <normaloff>:/plugin.png</normaloff>:/plugin.png</iconset>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <widget class=\"QListWidget\" name=\"lvPluginScripts\">\r\n           <property name=\"toolTip\">\r\n            <string>List of plug-ins. Toggle checkbox to enable the scripts.</string>\r\n           </property>\r\n           <property name=\"alternatingRowColors\">\r\n            <bool>true</bool>\r\n           </property>\r\n           <property name=\"sortingEnabled\">\r\n            <bool>true</bool>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <layout class=\"QHBoxLayout\" name=\"horizontalLayout_24\">\r\n           <item>\r\n            <widget class=\"QPushButton\" name=\"pbClearSelPlugin\">\r\n             <property name=\"toolTip\">\r\n              <string>Remove the selected plug-ins.</string>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Clear selection</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item>\r\n            <widget class=\"QPushButton\" name=\"pbClearAllPlugins\">\r\n             <property name=\"toolTip\">\r\n              <string>Remove all plug-ins.</string>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Clear all</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n          </layout>\r\n         </item>\r\n         <item>\r\n          <widget class=\"QGroupBox\" name=\"groupPluginDescription\">\r\n           <property name=\"title\">\r\n            <string>Description</string>\r\n           </property>\r\n           <layout class=\"QGridLayout\" name=\"gridLayout_3\">\r\n            <item row=\"0\" column=\"0\">\r\n             <widget class=\"QLabel\" name=\"lblPluginDescription\">\r\n              <property name=\"toolTip\">\r\n               <string>Shows decription of a selected plug-in script.</string>\r\n              </property>\r\n              <property name=\"text\">\r\n               <string>Plug-In description</string>\r\n              </property>\r\n              <property name=\"textFormat\">\r\n               <enum>Qt::PlainText</enum>\r\n              </property>\r\n              <property name=\"wordWrap\">\r\n               <bool>true</bool>\r\n              </property>\r\n              <property name=\"margin\">\r\n               <number>2</number>\r\n              </property>\r\n              <property name=\"textInteractionFlags\">\r\n               <set>Qt::NoTextInteraction</set>\r\n              </property>\r\n             </widget>\r\n            </item>\r\n           </layout>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <widget class=\"QLabel\" name=\"label_15\">\r\n           <property name=\"font\">\r\n            <font>\r\n             <weight>75</weight>\r\n             <bold>true</bold>\r\n            </font>\r\n           </property>\r\n           <property name=\"text\">\r\n            <string>Plug-in input file</string>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <layout class=\"QHBoxLayout\" name=\"horizontalLayout_29\">\r\n           <item>\r\n            <widget class=\"QLineEdit\" name=\"lePluginReadFilePath\">\r\n             <property name=\"toolTip\">\r\n              <string>Optional path to a plug-in input file</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item>\r\n            <widget class=\"QPushButton\" name=\"pbPluginReadFilePath\">\r\n             <property name=\"toolTip\">\r\n              <string>Select the plug-in input file.</string>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>...</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n          </layout>\r\n         </item>\r\n        </layout>\r\n       </widget>\r\n      </widget>\r\n     </item>\r\n     <item>\r\n      <widget class=\"Line\" name=\"line_7\">\r\n       <property name=\"orientation\">\r\n        <enum>Qt::Horizontal</enum>\r\n       </property>\r\n      </widget>\r\n     </item>\r\n     <item>\r\n      <widget class=\"QTabWidget\" name=\"tabWidgetOptions\">\r\n       <property name=\"sizePolicy\">\r\n        <sizepolicy hsizetype=\"Preferred\" vsizetype=\"Minimum\">\r\n         <horstretch>0</horstretch>\r\n         <verstretch>0</verstretch>\r\n        </sizepolicy>\r\n       </property>\r\n       <property name=\"minimumSize\">\r\n        <size>\r\n         <width>0</width>\r\n         <height>0</height>\r\n        </size>\r\n       </property>\r\n       <property name=\"layoutDirection\">\r\n        <enum>Qt::LeftToRight</enum>\r\n       </property>\r\n       <property name=\"tabPosition\">\r\n        <enum>QTabWidget::North</enum>\r\n       </property>\r\n       <property name=\"tabShape\">\r\n        <enum>QTabWidget::Rounded</enum>\r\n       </property>\r\n       <property name=\"currentIndex\">\r\n        <number>0</number>\r\n       </property>\r\n       <widget class=\"QWidget\" name=\"page_general\">\r\n        <attribute name=\"title\">\r\n         <string>General</string>\r\n        </attribute>\r\n        <layout class=\"QVBoxLayout\" name=\"verticalLayout_2\">\r\n         <item>\r\n          <layout class=\"QHBoxLayout\" name=\"horizontalLayout_8\">\r\n           <item>\r\n            <widget class=\"QLabel\" name=\"label_2\">\r\n             <property name=\"sizePolicy\">\r\n              <sizepolicy hsizetype=\"Minimum\" vsizetype=\"Minimum\">\r\n               <horstretch>0</horstretch>\r\n               <verstretch>0</verstretch>\r\n              </sizepolicy>\r\n             </property>\r\n             <property name=\"font\">\r\n              <font>\r\n               <weight>75</weight>\r\n               <bold>true</bold>\r\n              </font>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Output format:</string>\r\n             </property>\r\n             <property name=\"buddy\">\r\n              <cstring>comboFormat</cstring>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item>\r\n            <widget class=\"QComboBox\" name=\"comboFormat\">\r\n             <property name=\"sizePolicy\">\r\n              <sizepolicy hsizetype=\"Preferred\" vsizetype=\"Fixed\">\r\n               <horstretch>0</horstretch>\r\n               <verstretch>0</verstretch>\r\n              </sizepolicy>\r\n             </property>\r\n             <property name=\"font\">\r\n              <font>\r\n               <weight>75</weight>\r\n               <bold>true</bold>\r\n              </font>\r\n             </property>\r\n             <property name=\"toolTip\">\r\n              <string>Choose an output format.</string>\r\n             </property>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>HTML</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>XHTML</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>LaTeX</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>TeX</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>RTF</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ODT</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>SVG</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>BBCode</string>\r\n              </property>\r\n             </item>\r\n            </widget>\r\n           </item>\r\n          </layout>\r\n         </item>\r\n         <item>\r\n          <widget class=\"Line\" name=\"line_9\">\r\n           <property name=\"orientation\">\r\n            <enum>Qt::Horizontal</enum>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <layout class=\"QHBoxLayout\" name=\"horizontalLayout_21\">\r\n           <item>\r\n            <widget class=\"QCheckBox\" name=\"cbIncLineNo\">\r\n             <property name=\"toolTip\">\r\n              <string>Add line numbers to the output.</string>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Add line numbers</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item>\r\n            <spacer name=\"horizontalSpacer_4\">\r\n             <property name=\"orientation\">\r\n              <enum>Qt::Horizontal</enum>\r\n             </property>\r\n             <property name=\"sizeHint\" stdset=\"0\">\r\n              <size>\r\n               <width>10</width>\r\n               <height>20</height>\r\n              </size>\r\n             </property>\r\n            </spacer>\r\n           </item>\r\n           <item>\r\n            <widget class=\"QSpinBox\" name=\"sbLineNoStart\">\r\n             <property name=\"toolTip\">\r\n              <string>Set line numbering start</string>\r\n             </property>\r\n             <property name=\"buttonSymbols\">\r\n              <enum>QAbstractSpinBox::UpDownArrows</enum>\r\n             </property>\r\n             <property name=\"accelerated\">\r\n              <bool>true</bool>\r\n             </property>\r\n             <property name=\"maximum\">\r\n              <number>500</number>\r\n             </property>\r\n             <property name=\"value\">\r\n              <number>1</number>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item>\r\n            <widget class=\"QSpinBox\" name=\"sbLineNoWidth\">\r\n             <property name=\"toolTip\">\r\n              <string>Select the line number width.</string>\r\n             </property>\r\n             <property name=\"minimum\">\r\n              <number>1</number>\r\n             </property>\r\n             <property name=\"maximum\">\r\n              <number>6</number>\r\n             </property>\r\n             <property name=\"value\">\r\n              <number>2</number>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n          </layout>\r\n         </item>\r\n         <item>\r\n          <widget class=\"QCheckBox\" name=\"cbPadZeroes\">\r\n           <property name=\"enabled\">\r\n            <bool>false</bool>\r\n           </property>\r\n           <property name=\"toolTip\">\r\n            <string>Fill leading space of line numbers with zeroes.</string>\r\n           </property>\r\n           <property name=\"text\">\r\n            <string>Pad with zeroes</string>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <widget class=\"QCheckBox\" name=\"cbFragment\">\r\n           <property name=\"sizePolicy\">\r\n            <sizepolicy hsizetype=\"Minimum\" vsizetype=\"Fixed\">\r\n             <horstretch>0</horstretch>\r\n             <verstretch>0</verstretch>\r\n            </sizepolicy>\r\n           </property>\r\n           <property name=\"toolTip\">\r\n            <string>Generate output without document header and footer.</string>\r\n           </property>\r\n           <property name=\"text\">\r\n            <string>Omit header and footer</string>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <widget class=\"QCheckBox\" name=\"cbValidateInput\">\r\n           <property name=\"toolTip\">\r\n            <string>Test if input data is not binary.\r\nRemoves Unicode BOM mark.</string>\r\n           </property>\r\n           <property name=\"text\">\r\n            <string>Validate input data</string>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <layout class=\"QHBoxLayout\" name=\"horizontalLayout_2\">\r\n           <item>\r\n            <widget class=\"QCheckBox\" name=\"cbEncoding\">\r\n             <property name=\"toolTip\">\r\n              <string>Set the output file ancoding.</string>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Set encoding:</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item>\r\n            <widget class=\"QComboBox\" name=\"comboEncoding\">\r\n             <property name=\"toolTip\">\r\n              <string>Select or define the encoding.\r\nThe result has to match the input file encoding.</string>\r\n             </property>\r\n             <property name=\"editable\">\r\n              <bool>true</bool>\r\n             </property>\r\n             <property name=\"insertPolicy\">\r\n              <enum>QComboBox::InsertAtBottom</enum>\r\n             </property>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-1</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-2</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-3</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-4</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-5</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-6</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-7</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-8</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-9</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-10</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-11</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-12</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-13</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-14</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>ISO-8859-15</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>UTF-8</string>\r\n              </property>\r\n             </item>\r\n            </widget>\r\n           </item>\r\n          </layout>\r\n         </item>\r\n         <item>\r\n          <spacer name=\"verticalSpacer_2\">\r\n           <property name=\"orientation\">\r\n            <enum>Qt::Vertical</enum>\r\n           </property>\r\n           <property name=\"sizeHint\" stdset=\"0\">\r\n            <size>\r\n             <width>20</width>\r\n             <height>40</height>\r\n            </size>\r\n           </property>\r\n          </spacer>\r\n         </item>\r\n        </layout>\r\n       </widget>\r\n       <widget class=\"QWidget\" name=\"page_output_spec\">\r\n        <attribute name=\"title\">\r\n         <string>Output specific</string>\r\n        </attribute>\r\n        <layout class=\"QGridLayout\" name=\"gridLayout\">\r\n         <item row=\"0\" column=\"0\">\r\n          <widget class=\"QStackedWidget\" name=\"stackedSpecificOptions\">\r\n           <property name=\"sizePolicy\">\r\n            <sizepolicy hsizetype=\"Preferred\" vsizetype=\"Ignored\">\r\n             <horstretch>0</horstretch>\r\n             <verstretch>0</verstretch>\r\n            </sizepolicy>\r\n           </property>\r\n           <property name=\"minimumSize\">\r\n            <size>\r\n             <width>0</width>\r\n             <height>0</height>\r\n            </size>\r\n           </property>\r\n           <property name=\"currentIndex\">\r\n            <number>0</number>\r\n           </property>\r\n           <widget class=\"QWidget\" name=\"HTMLOptions\">\r\n            <layout class=\"QVBoxLayout\" name=\"verticalLayout_5\">\r\n             <item>\r\n              <widget class=\"QTabWidget\" name=\"tabWidget\">\r\n               <property name=\"sizePolicy\">\r\n                <sizepolicy hsizetype=\"Minimum\" vsizetype=\"Minimum\">\r\n                 <horstretch>0</horstretch>\r\n                 <verstretch>0</verstretch>\r\n                </sizepolicy>\r\n               </property>\r\n               <property name=\"minimumSize\">\r\n                <size>\r\n                 <width>250</width>\r\n                 <height>0</height>\r\n                </size>\r\n               </property>\r\n               <property name=\"currentIndex\">\r\n                <number>1</number>\r\n               </property>\r\n               <widget class=\"QWidget\" name=\"tabWidgetPage1\">\r\n                <attribute name=\"title\">\r\n                 <string>Stylesheets</string>\r\n                </attribute>\r\n                <layout class=\"QGridLayout\" name=\"gridLayout_4\">\r\n                 <item row=\"0\" column=\"0\">\r\n                  <layout class=\"QHBoxLayout\" name=\"horizontalLayout_10\">\r\n                   <item>\r\n                    <widget class=\"QCheckBox\" name=\"cbHTMLEmbedStyle\">\r\n                     <property name=\"toolTip\">\r\n                      <string>Include the style information in each output file.</string>\r\n                     </property>\r\n                     <property name=\"text\">\r\n                      <string>Embed style (CSS)</string>\r\n                     </property>\r\n                     <property name=\"checked\">\r\n                      <bool>false</bool>\r\n                     </property>\r\n                    </widget>\r\n                   </item>\r\n                   <item>\r\n                    <widget class=\"QCheckBox\" name=\"cbHTMLInlineCSS\">\r\n                     <property name=\"enabled\">\r\n                      <bool>false</bool>\r\n                     </property>\r\n                     <property name=\"toolTip\">\r\n                      <string>Add CSS information to each tag (do not use CSS class definitions).</string>\r\n                     </property>\r\n                     <property name=\"text\">\r\n                      <string>Inline CSS</string>\r\n                     </property>\r\n                     <property name=\"checkable\">\r\n                      <bool>true</bool>\r\n                     </property>\r\n                    </widget>\r\n                   </item>\r\n                  </layout>\r\n                 </item>\r\n                 <item row=\"1\" column=\"0\">\r\n                  <layout class=\"QHBoxLayout\" name=\"horizontalLayout_14\">\r\n                   <item>\r\n                    <widget class=\"QLabel\" name=\"label_19\">\r\n                     <property name=\"text\">\r\n                      <string>Stylesheet file:</string>\r\n                     </property>\r\n                    </widget>\r\n                   </item>\r\n                   <item>\r\n                    <widget class=\"QLineEdit\" name=\"leHTMLStyleFile\">\r\n                     <property name=\"sizePolicy\">\r\n                      <sizepolicy hsizetype=\"Preferred\" vsizetype=\"Fixed\">\r\n                       <horstretch>0</horstretch>\r\n                       <verstretch>0</verstretch>\r\n                      </sizepolicy>\r\n                     </property>\r\n                     <property name=\"toolTip\">\r\n                      <string>Name of the referenced style file.</string>\r\n                     </property>\r\n                     <property name=\"text\">\r\n                      <string>highlight.css</string>\r\n                     </property>\r\n                    </widget>\r\n                   </item>\r\n                  </layout>\r\n                 </item>\r\n                 <item row=\"2\" column=\"0\">\r\n                  <layout class=\"QHBoxLayout\" name=\"horizontalLayout_9\">\r\n                   <item>\r\n                    <widget class=\"QLabel\" name=\"label_20\">\r\n                     <property name=\"text\">\r\n                      <string>Include:</string>\r\n                     </property>\r\n                    </widget>\r\n                   </item>\r\n                   <item>\r\n                    <widget class=\"QLineEdit\" name=\"leHTMLStyleIncFile\">\r\n                     <property name=\"toolTip\">\r\n                      <string>Path of the CSS include file.</string>\r\n                     </property>\r\n                    </widget>\r\n                   </item>\r\n                   <item>\r\n                    <widget class=\"QPushButton\" name=\"pbHTMLChooseStyleIncFile\">\r\n                     <property name=\"toolTip\">\r\n                      <string>Select a CSS include file.</string>\r\n                     </property>\r\n                     <property name=\"text\">\r\n                      <string>...</string>\r\n                     </property>\r\n                    </widget>\r\n                   </item>\r\n                  </layout>\r\n                 </item>\r\n                 <item row=\"3\" column=\"0\">\r\n                  <layout class=\"QHBoxLayout\" name=\"horizontalLayout_7\">\r\n                   <item>\r\n                    <widget class=\"QLabel\" name=\"label\">\r\n                     <property name=\"text\">\r\n                      <string>CSS class prefix:</string>\r\n                     </property>\r\n                    </widget>\r\n                   </item>\r\n                   <item>\r\n                    <widget class=\"QLineEdit\" name=\"leHTMLCssPrefix\">\r\n                     <property name=\"toolTip\">\r\n                      <string>Add a CSS class name prefix to avoid namespace clashes.</string>\r\n                     </property>\r\n                     <property name=\"text\">\r\n                      <string/>\r\n                     </property>\r\n                    </widget>\r\n                   </item>\r\n                  </layout>\r\n                 </item>\r\n                 <item row=\"4\" column=\"0\">\r\n                  <spacer name=\"verticalSpacer_9\">\r\n                   <property name=\"orientation\">\r\n                    <enum>Qt::Vertical</enum>\r\n                   </property>\r\n                   <property name=\"sizeType\">\r\n                    <enum>QSizePolicy::MinimumExpanding</enum>\r\n                   </property>\r\n                   <property name=\"sizeHint\" stdset=\"0\">\r\n                    <size>\r\n                     <width>20</width>\r\n                     <height>40</height>\r\n                    </size>\r\n                   </property>\r\n                  </spacer>\r\n                 </item>\r\n                </layout>\r\n               </widget>\r\n               <widget class=\"QWidget\" name=\"tabWidgetPage3\">\r\n                <attribute name=\"title\">\r\n                 <string>Misc</string>\r\n                </attribute>\r\n                <layout class=\"QVBoxLayout\" name=\"verticalLayout_4\">\r\n                 <item>\r\n                  <widget class=\"QLabel\" name=\"label_8\">\r\n                   <property name=\"font\">\r\n                    <font>\r\n                     <weight>50</weight>\r\n                     <bold>false</bold>\r\n                    </font>\r\n                   </property>\r\n                   <property name=\"text\">\r\n                    <string>Line numbering options:</string>\r\n                   </property>\r\n                  </widget>\r\n                 </item>\r\n                 <item>\r\n                  <widget class=\"QCheckBox\" name=\"cbHTMLAnchors\">\r\n                   <property name=\"toolTip\">\r\n                    <string>Add an achor to each line.</string>\r\n                   </property>\r\n                   <property name=\"text\">\r\n                    <string>Add line anchors</string>\r\n                   </property>\r\n                  </widget>\r\n                 </item>\r\n                 <item>\r\n                  <widget class=\"QCheckBox\" name=\"cbHTMLFileNameAnchor\">\r\n                   <property name=\"toolTip\">\r\n                    <string>Add the filename as prefix to the anchors.</string>\r\n                   </property>\r\n                   <property name=\"text\">\r\n                    <string>Include file name in anchor</string>\r\n                   </property>\r\n                  </widget>\r\n                 </item>\r\n                 <item>\r\n                  <widget class=\"QCheckBox\" name=\"cbHTMLOrderedList\">\r\n                   <property name=\"toolTip\">\r\n                    <string>Output the lines within an ordered list.</string>\r\n                   </property>\r\n                   <property name=\"text\">\r\n                    <string>Output as ordered list</string>\r\n                   </property>\r\n                  </widget>\r\n                 </item>\r\n                 <item>\r\n                  <widget class=\"QCheckBox\" name=\"cbHTMLIndex\">\r\n                   <property name=\"toolTip\">\r\n                    <string>Generate an index file with hyperlinks to all outputted files.</string>\r\n                   </property>\r\n                   <property name=\"text\">\r\n                    <string>Generate index file</string>\r\n                   </property>\r\n                  </widget>\r\n                 </item>\r\n                 <item>\r\n                  <widget class=\"QCheckBox\" name=\"cbHTMLEnclosePreTags\">\r\n                   <property name=\"toolTip\">\r\n                    <string>Add &amp;lt;pre&amp;gt; tags to the output, if the flag &quot;No document header and footer&quot; is selected.</string>\r\n                   </property>\r\n                   <property name=\"text\">\r\n                    <string>Enclose in pre tags</string>\r\n                   </property>\r\n                  </widget>\r\n                 </item>\r\n                 <item>\r\n                  <spacer name=\"verticalSpacer\">\r\n                   <property name=\"orientation\">\r\n                    <enum>Qt::Vertical</enum>\r\n                   </property>\r\n                   <property name=\"sizeHint\" stdset=\"0\">\r\n                    <size>\r\n                     <width>20</width>\r\n                     <height>24</height>\r\n                    </size>\r\n                   </property>\r\n                  </spacer>\r\n                 </item>\r\n                </layout>\r\n               </widget>\r\n              </widget>\r\n             </item>\r\n            </layout>\r\n           </widget>\r\n           <widget class=\"QWidget\" name=\"LATEXOptions\">\r\n            <layout class=\"QVBoxLayout\" name=\"verticalLayout_12\">\r\n             <item>\r\n              <widget class=\"QCheckBox\" name=\"cbLATEXEscQuotes\">\r\n               <property name=\"toolTip\">\r\n                <string>Replace quotes by dq sequences.</string>\r\n               </property>\r\n               <property name=\"text\">\r\n                <string>Escape quotes</string>\r\n               </property>\r\n              </widget>\r\n             </item>\r\n             <item>\r\n              <widget class=\"QCheckBox\" name=\"cbLATEXBabel\">\r\n               <property name=\"toolTip\">\r\n                <string>Make output Babel compatible.</string>\r\n               </property>\r\n               <property name=\"text\">\r\n                <string>Add Babel compatibility</string>\r\n               </property>\r\n              </widget>\r\n             </item>\r\n             <item>\r\n              <widget class=\"QCheckBox\" name=\"cbLATEXPrettySymbols\">\r\n               <property name=\"toolTip\">\r\n                <string>Replace default symbols (brackets, tilde) by nice redefinitions.</string>\r\n               </property>\r\n               <property name=\"text\">\r\n                <string>Add pretty symbols</string>\r\n               </property>\r\n              </widget>\r\n             </item>\r\n             <item>\r\n              <widget class=\"QCheckBox\" name=\"cbLATEXEmbedStyle\">\r\n               <property name=\"toolTip\">\r\n                <string>Include the style information in each output file.</string>\r\n               </property>\r\n               <property name=\"text\">\r\n                <string>Embed style (defs)</string>\r\n               </property>\r\n              </widget>\r\n             </item>\r\n             <item>\r\n              <layout class=\"QHBoxLayout\" name=\"horizontalLayout_17\">\r\n               <item>\r\n                <widget class=\"QLabel\" name=\"label_21\">\r\n                 <property name=\"text\">\r\n                  <string>Stylesheet file:</string>\r\n                 </property>\r\n                 <property name=\"buddy\">\r\n                  <cstring>leLATEXStyleFile</cstring>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n               <item>\r\n                <widget class=\"QLineEdit\" name=\"leLATEXStyleFile\">\r\n                 <property name=\"toolTip\">\r\n                  <string>Name of the referenced  style file.</string>\r\n                 </property>\r\n                 <property name=\"text\">\r\n                  <string>highlight.sty</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n              </layout>\r\n             </item>\r\n             <item>\r\n              <layout class=\"QHBoxLayout\" name=\"horizontalLayout_15\">\r\n               <item>\r\n                <widget class=\"QLabel\" name=\"label_22\">\r\n                 <property name=\"text\">\r\n                  <string>Stylesheet include file:</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n               <item>\r\n                <spacer name=\"horizontalSpacer_2\">\r\n                 <property name=\"orientation\">\r\n                  <enum>Qt::Horizontal</enum>\r\n                 </property>\r\n                 <property name=\"sizeHint\" stdset=\"0\">\r\n                  <size>\r\n                   <width>40</width>\r\n                   <height>20</height>\r\n                  </size>\r\n                 </property>\r\n                </spacer>\r\n               </item>\r\n              </layout>\r\n             </item>\r\n             <item>\r\n              <layout class=\"QHBoxLayout\" name=\"horizontalLayout_16\">\r\n               <item>\r\n                <widget class=\"QLineEdit\" name=\"leLATEXStyleIncFile\">\r\n                 <property name=\"toolTip\">\r\n                  <string>Path of the style include file.</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n               <item>\r\n                <widget class=\"QPushButton\" name=\"pbLATEXChooseStyleIncFile\">\r\n                 <property name=\"toolTip\">\r\n                  <string>Select a style include file.</string>\r\n                 </property>\r\n                 <property name=\"text\">\r\n                  <string>...</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n              </layout>\r\n             </item>\r\n             <item>\r\n              <spacer name=\"verticalSpacer_4\">\r\n               <property name=\"orientation\">\r\n                <enum>Qt::Vertical</enum>\r\n               </property>\r\n               <property name=\"sizeHint\" stdset=\"0\">\r\n                <size>\r\n                 <width>20</width>\r\n                 <height>40</height>\r\n                </size>\r\n               </property>\r\n              </spacer>\r\n             </item>\r\n            </layout>\r\n           </widget>\r\n           <widget class=\"QWidget\" name=\"TEXOptions\">\r\n            <layout class=\"QVBoxLayout\" name=\"verticalLayout_14\">\r\n             <item>\r\n              <widget class=\"QCheckBox\" name=\"cbTEXEmbedStyle\">\r\n               <property name=\"toolTip\">\r\n                <string>Include the style information in each output file.</string>\r\n               </property>\r\n               <property name=\"text\">\r\n                <string>Embed style (macros)</string>\r\n               </property>\r\n              </widget>\r\n             </item>\r\n             <item>\r\n              <layout class=\"QHBoxLayout\" name=\"horizontalLayout_18\">\r\n               <item>\r\n                <widget class=\"QLabel\" name=\"label_24\">\r\n                 <property name=\"text\">\r\n                  <string>Stylesheet file:</string>\r\n                 </property>\r\n                 <property name=\"buddy\">\r\n                  <cstring>leTEXStyleFile</cstring>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n               <item>\r\n                <widget class=\"QLineEdit\" name=\"leTEXStyleFile\">\r\n                 <property name=\"toolTip\">\r\n                  <string>Name of the referenced style file.</string>\r\n                 </property>\r\n                 <property name=\"text\">\r\n                  <string>highlight.sty</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n              </layout>\r\n             </item>\r\n             <item>\r\n              <layout class=\"QHBoxLayout\" name=\"horizontalLayout_19\">\r\n               <item>\r\n                <widget class=\"QLabel\" name=\"label_25\">\r\n                 <property name=\"text\">\r\n                  <string>Stylesheet include file:</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n               <item>\r\n                <spacer name=\"horizontalSpacer_3\">\r\n                 <property name=\"orientation\">\r\n                  <enum>Qt::Horizontal</enum>\r\n                 </property>\r\n                 <property name=\"sizeHint\" stdset=\"0\">\r\n                  <size>\r\n                   <width>40</width>\r\n                   <height>20</height>\r\n                  </size>\r\n                 </property>\r\n                </spacer>\r\n               </item>\r\n              </layout>\r\n             </item>\r\n             <item>\r\n              <layout class=\"QHBoxLayout\" name=\"horizontalLayout_20\">\r\n               <item>\r\n                <widget class=\"QLineEdit\" name=\"leTEXStyleIncFile\">\r\n                 <property name=\"toolTip\">\r\n                  <string>Path of the style include file.</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n               <item>\r\n                <widget class=\"QPushButton\" name=\"pbTEXChooseStyleIncFile\">\r\n                 <property name=\"toolTip\">\r\n                  <string>Select a style include file.</string>\r\n                 </property>\r\n                 <property name=\"text\">\r\n                  <string>...</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n              </layout>\r\n             </item>\r\n             <item>\r\n              <spacer name=\"verticalSpacer_5\">\r\n               <property name=\"orientation\">\r\n                <enum>Qt::Vertical</enum>\r\n               </property>\r\n               <property name=\"sizeHint\" stdset=\"0\">\r\n                <size>\r\n                 <width>20</width>\r\n                 <height>40</height>\r\n                </size>\r\n               </property>\r\n              </spacer>\r\n             </item>\r\n            </layout>\r\n           </widget>\r\n           <widget class=\"QWidget\" name=\"RTFOptions\">\r\n            <layout class=\"QVBoxLayout\" name=\"verticalLayout_9\">\r\n             <item>\r\n              <widget class=\"QCheckBox\" name=\"cbRTFCharStyles\">\r\n               <property name=\"toolTip\">\r\n                <string>Add character stylesheets with formatting information.\r\nYou can select the stylesheets in your word processor to reformat additional text.</string>\r\n               </property>\r\n               <property name=\"text\">\r\n                <string>Add character styles</string>\r\n               </property>\r\n              </widget>\r\n             </item>\r\n             <item>\r\n              <layout class=\"QHBoxLayout\" name=\"horizontalLayout_11\">\r\n               <item>\r\n                <widget class=\"QLabel\" name=\"label_9\">\r\n                 <property name=\"text\">\r\n                  <string>Page size:</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n               <item>\r\n                <widget class=\"QComboBox\" name=\"comboRTFPageSize\">\r\n                 <property name=\"toolTip\">\r\n                  <string>Select a page size.</string>\r\n                 </property>\r\n                 <property name=\"currentIndex\">\r\n                  <number>1</number>\r\n                 </property>\r\n                 <item>\r\n                  <property name=\"text\">\r\n                   <string>A3</string>\r\n                  </property>\r\n                 </item>\r\n                 <item>\r\n                  <property name=\"text\">\r\n                   <string>A4</string>\r\n                  </property>\r\n                 </item>\r\n                 <item>\r\n                  <property name=\"text\">\r\n                   <string>A5</string>\r\n                  </property>\r\n                 </item>\r\n                 <item>\r\n                  <property name=\"text\">\r\n                   <string>B4</string>\r\n                  </property>\r\n                 </item>\r\n                 <item>\r\n                  <property name=\"text\">\r\n                   <string>B5</string>\r\n                  </property>\r\n                 </item>\r\n                 <item>\r\n                  <property name=\"text\">\r\n                   <string>B6</string>\r\n                  </property>\r\n                 </item>\r\n                 <item>\r\n                  <property name=\"text\">\r\n                   <string>Letter</string>\r\n                  </property>\r\n                 </item>\r\n                 <item>\r\n                  <property name=\"text\">\r\n                   <string>Legal</string>\r\n                  </property>\r\n                 </item>\r\n                </widget>\r\n               </item>\r\n              </layout>\r\n             </item>\r\n             <item>\r\n              <spacer name=\"verticalSpacer_6\">\r\n               <property name=\"orientation\">\r\n                <enum>Qt::Vertical</enum>\r\n               </property>\r\n               <property name=\"sizeHint\" stdset=\"0\">\r\n                <size>\r\n                 <width>20</width>\r\n                 <height>40</height>\r\n                </size>\r\n               </property>\r\n              </spacer>\r\n             </item>\r\n            </layout>\r\n           </widget>\r\n           <widget class=\"QWidget\" name=\"SVGOptions\">\r\n            <layout class=\"QVBoxLayout\" name=\"verticalLayout_10\">\r\n             <item>\r\n              <widget class=\"QLabel\" name=\"label_10\">\r\n               <property name=\"text\">\r\n                <string>Image size:</string>\r\n               </property>\r\n              </widget>\r\n             </item>\r\n             <item>\r\n              <layout class=\"QGridLayout\" name=\"gridLayout_8\">\r\n               <item row=\"0\" column=\"0\">\r\n                <widget class=\"QLabel\" name=\"label_3\">\r\n                 <property name=\"text\">\r\n                  <string>Width:</string>\r\n                 </property>\r\n                 <property name=\"buddy\">\r\n                  <cstring>leSVGWidth</cstring>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n               <item row=\"0\" column=\"1\">\r\n                <widget class=\"QLineEdit\" name=\"leSVGWidth\">\r\n                 <property name=\"sizePolicy\">\r\n                  <sizepolicy hsizetype=\"Expanding\" vsizetype=\"Fixed\">\r\n                   <horstretch>0</horstretch>\r\n                   <verstretch>0</verstretch>\r\n                  </sizepolicy>\r\n                 </property>\r\n                 <property name=\"toolTip\">\r\n                  <string>Enter the SVG width (may contain units).</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n               <item row=\"1\" column=\"0\">\r\n                <widget class=\"QLabel\" name=\"label_12\">\r\n                 <property name=\"text\">\r\n                  <string>Height:</string>\r\n                 </property>\r\n                 <property name=\"buddy\">\r\n                  <cstring>leSVGHeight</cstring>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n               <item row=\"1\" column=\"1\">\r\n                <widget class=\"QLineEdit\" name=\"leSVGHeight\">\r\n                 <property name=\"toolTip\">\r\n                  <string>Enter the SVG height (may contain units).</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n              </layout>\r\n             </item>\r\n             <item>\r\n              <widget class=\"QCheckBox\" name=\"cbSVGEmbedStyle\">\r\n               <property name=\"toolTip\">\r\n                <string>Include the style information in each output file.</string>\r\n               </property>\r\n               <property name=\"text\">\r\n                <string>Embed style (CSS)</string>\r\n               </property>\r\n              </widget>\r\n             </item>\r\n             <item>\r\n              <layout class=\"QHBoxLayout\" name=\"horizontalLayout_26\">\r\n               <item>\r\n                <widget class=\"QLabel\" name=\"label_29\">\r\n                 <property name=\"text\">\r\n                  <string>Stylesheet file:</string>\r\n                 </property>\r\n                 <property name=\"buddy\">\r\n                  <cstring>leSVGStyleFile</cstring>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n               <item>\r\n                <widget class=\"QLineEdit\" name=\"leSVGStyleFile\">\r\n                 <property name=\"toolTip\">\r\n                  <string>Name of the referenced style file.</string>\r\n                 </property>\r\n                 <property name=\"text\">\r\n                  <string>highlight.css</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n              </layout>\r\n             </item>\r\n             <item>\r\n              <layout class=\"QHBoxLayout\" name=\"horizontalLayout_27\">\r\n               <item>\r\n                <widget class=\"QLabel\" name=\"label_30\">\r\n                 <property name=\"text\">\r\n                  <string>Stylesheet include file:</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n               <item>\r\n                <spacer name=\"horizontalSpacer_6\">\r\n                 <property name=\"orientation\">\r\n                  <enum>Qt::Horizontal</enum>\r\n                 </property>\r\n                 <property name=\"sizeHint\" stdset=\"0\">\r\n                  <size>\r\n                   <width>40</width>\r\n                   <height>20</height>\r\n                  </size>\r\n                 </property>\r\n                </spacer>\r\n               </item>\r\n              </layout>\r\n             </item>\r\n             <item>\r\n              <layout class=\"QHBoxLayout\" name=\"horizontalLayout_28\">\r\n               <item>\r\n                <widget class=\"QLineEdit\" name=\"leSVGStyleIncFile\">\r\n                 <property name=\"toolTip\">\r\n                  <string>Path of the CSS include file.</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n               <item>\r\n                <widget class=\"QPushButton\" name=\"pbSVGChooseStyleIncFile\">\r\n                 <property name=\"toolTip\">\r\n                  <string>Select a style include file.</string>\r\n                 </property>\r\n                 <property name=\"text\">\r\n                  <string>...</string>\r\n                 </property>\r\n                </widget>\r\n               </item>\r\n              </layout>\r\n             </item>\r\n             <item>\r\n              <spacer name=\"verticalSpacer_10\">\r\n               <property name=\"orientation\">\r\n                <enum>Qt::Vertical</enum>\r\n               </property>\r\n               <property name=\"sizeHint\" stdset=\"0\">\r\n                <size>\r\n                 <width>20</width>\r\n                 <height>40</height>\r\n                </size>\r\n               </property>\r\n              </spacer>\r\n             </item>\r\n            </layout>\r\n           </widget>\r\n           <widget class=\"QWidget\" name=\"EmptyPage\">\r\n            <layout class=\"QVBoxLayout\" name=\"verticalLayout_11\">\r\n             <item>\r\n              <widget class=\"QLabel\" name=\"label_7\">\r\n               <property name=\"text\">\r\n                <string>No options defined.</string>\r\n               </property>\r\n              </widget>\r\n             </item>\r\n             <item>\r\n              <spacer name=\"verticalSpacer_3\">\r\n               <property name=\"orientation\">\r\n                <enum>Qt::Vertical</enum>\r\n               </property>\r\n               <property name=\"sizeHint\" stdset=\"0\">\r\n                <size>\r\n                 <width>20</width>\r\n                 <height>40</height>\r\n                </size>\r\n               </property>\r\n              </spacer>\r\n             </item>\r\n            </layout>\r\n           </widget>\r\n          </widget>\r\n         </item>\r\n        </layout>\r\n       </widget>\r\n       <widget class=\"QWidget\" name=\"page_formatting\">\r\n        <attribute name=\"title\">\r\n         <string>Formatting</string>\r\n        </attribute>\r\n        <layout class=\"QVBoxLayout\" name=\"verticalLayout_6\">\r\n         <item>\r\n          <layout class=\"QHBoxLayout\" name=\"horizontalLayout_3\">\r\n           <item>\r\n            <widget class=\"QLabel\" name=\"label_5\">\r\n             <property name=\"sizePolicy\">\r\n              <sizepolicy hsizetype=\"Minimum\" vsizetype=\"Minimum\">\r\n               <horstretch>0</horstretch>\r\n               <verstretch>0</verstretch>\r\n              </sizepolicy>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Color theme:</string>\r\n             </property>\r\n             <property name=\"buddy\">\r\n              <cstring>comboTheme</cstring>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item>\r\n            <widget class=\"QComboBox\" name=\"comboTheme\">\r\n             <property name=\"sizePolicy\">\r\n              <sizepolicy hsizetype=\"Minimum\" vsizetype=\"Fixed\">\r\n               <horstretch>0</horstretch>\r\n               <verstretch>0</verstretch>\r\n              </sizepolicy>\r\n             </property>\r\n             <property name=\"toolTip\">\r\n              <string>Select a colour theme.</string>\r\n             </property>\r\n             <property name=\"currentIndex\">\r\n              <number>-1</number>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n          </layout>\r\n         </item>\r\n         <item>\r\n          <layout class=\"QHBoxLayout\" name=\"horizontalLayout_4\">\r\n           <item>\r\n            <widget class=\"QCheckBox\" name=\"cbReformat\">\r\n             <property name=\"toolTip\">\r\n              <string>Reformat and indent your code.\r\nThis feature is enabled tor C, C++, C# and Java code.</string>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Reformat:</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item>\r\n            <widget class=\"QComboBox\" name=\"comboReformat\">\r\n             <property name=\"sizePolicy\">\r\n              <sizepolicy hsizetype=\"Minimum\" vsizetype=\"Fixed\">\r\n               <horstretch>0</horstretch>\r\n               <verstretch>0</verstretch>\r\n              </sizepolicy>\r\n             </property>\r\n             <property name=\"toolTip\">\r\n              <string>Choose a formatting scheme.</string>\r\n             </property>\r\n             <property name=\"maxVisibleItems\">\r\n              <number>10</number>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n          </layout>\r\n         </item>\r\n         <item>\r\n          <layout class=\"QHBoxLayout\" name=\"horizontalLayout_5\">\r\n           <item>\r\n            <widget class=\"QCheckBox\" name=\"cbKwCase\">\r\n             <property name=\"toolTip\">\r\n              <string>Change the keyword case.</string>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Keyword case:</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item>\r\n            <widget class=\"QComboBox\" name=\"comboKwCase\">\r\n             <property name=\"sizePolicy\">\r\n              <sizepolicy hsizetype=\"Minimum\" vsizetype=\"Fixed\">\r\n               <horstretch>0</horstretch>\r\n               <verstretch>0</verstretch>\r\n              </sizepolicy>\r\n             </property>\r\n             <property name=\"toolTip\">\r\n              <string>Select a keyword case.</string>\r\n             </property>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>UPPER</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>lower</string>\r\n              </property>\r\n             </item>\r\n             <item>\r\n              <property name=\"text\">\r\n               <string>Capitalize</string>\r\n              </property>\r\n             </item>\r\n            </widget>\r\n           </item>\r\n          </layout>\r\n         </item>\r\n         <item>\r\n          <layout class=\"QHBoxLayout\" name=\"horizontalLayout_6\">\r\n           <item>\r\n            <widget class=\"QLabel\" name=\"label_6\">\r\n             <property name=\"sizePolicy\">\r\n              <sizepolicy hsizetype=\"Minimum\" vsizetype=\"Fixed\">\r\n               <horstretch>0</horstretch>\r\n               <verstretch>0</verstretch>\r\n              </sizepolicy>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Tab width:</string>\r\n             </property>\r\n             <property name=\"buddy\">\r\n              <cstring>sbTabWidth</cstring>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item>\r\n            <widget class=\"QSpinBox\" name=\"sbTabWidth\">\r\n             <property name=\"toolTip\">\r\n              <string>Enter the number of spaces which replace a tab.\r\nSet the width to 0 to keep tabs.</string>\r\n             </property>\r\n             <property name=\"maximum\">\r\n              <number>10</number>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n          </layout>\r\n         </item>\r\n         <item>\r\n          <widget class=\"QSplitter\" name=\"splitter_3\">\r\n           <property name=\"orientation\">\r\n            <enum>Qt::Horizontal</enum>\r\n           </property>\r\n           <widget class=\"QCheckBox\" name=\"cbWrapping\">\r\n            <property name=\"toolTip\">\r\n             <string>Enable line wrapping.</string>\r\n            </property>\r\n            <property name=\"text\">\r\n             <string>Line wrapping</string>\r\n            </property>\r\n           </widget>\r\n           <widget class=\"QSpinBox\" name=\"sbLineLength\">\r\n            <property name=\"toolTip\">\r\n             <string>Enter the maximum line length.</string>\r\n            </property>\r\n            <property name=\"minimum\">\r\n             <number>60</number>\r\n            </property>\r\n            <property name=\"maximum\">\r\n             <number>120</number>\r\n            </property>\r\n            <property name=\"singleStep\">\r\n             <number>2</number>\r\n            </property>\r\n           </widget>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <widget class=\"QSplitter\" name=\"splitter_2\">\r\n           <property name=\"orientation\">\r\n            <enum>Qt::Horizontal</enum>\r\n           </property>\r\n           <widget class=\"QSplitter\" name=\"splitter\">\r\n            <property name=\"orientation\">\r\n             <enum>Qt::Vertical</enum>\r\n            </property>\r\n            <widget class=\"QCheckBox\" name=\"cbAdvWrapping\">\r\n             <property name=\"enabled\">\r\n              <bool>false</bool>\r\n             </property>\r\n             <property name=\"toolTip\">\r\n              <string>Indent statements and function parameters after wrapping.</string>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Intelligent wrapping</string>\r\n             </property>\r\n            </widget>\r\n            <widget class=\"QCheckBox\" name=\"cbOmitWrappedLineNumbers\">\r\n             <property name=\"toolTip\">\r\n              <string>Do not add line numbering to lines which were automatically wrapped.</string>\r\n             </property>\r\n             <property name=\"text\">\r\n              <string>Omit line numbers of wrapped lines</string>\r\n             </property>\r\n            </widget>\r\n           </widget>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <widget class=\"Line\" name=\"line_3\">\r\n           <property name=\"orientation\">\r\n            <enum>Qt::Horizontal</enum>\r\n           </property>\r\n          </widget>\r\n         </item>\r\n         <item>\r\n          <layout class=\"QGridLayout\" name=\"gridLayout_9\">\r\n           <item row=\"0\" column=\"0\">\r\n            <widget class=\"QLabel\" name=\"label_23\">\r\n             <property name=\"text\">\r\n              <string>Font name:</string>\r\n             </property>\r\n             <property name=\"buddy\">\r\n              <cstring>comboFontName</cstring>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item row=\"0\" column=\"1\">\r\n            <widget class=\"QFontComboBox\" name=\"comboFontName\">\r\n             <property name=\"font\">\r\n              <font>\r\n               <family>MS Shell Dlg 2</family>\r\n              </font>\r\n             </property>\r\n             <property name=\"toolTip\">\r\n              <string>Select or enter the font name. HTML supports a list of fonts, separated with comma.</string>\r\n             </property>\r\n             <property name=\"currentFont\">\r\n              <font>\r\n               <family>Courier New</family>\r\n              </font>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item row=\"1\" column=\"0\">\r\n            <widget class=\"QLabel\" name=\"label_4\">\r\n             <property name=\"text\">\r\n              <string>Font size:</string>\r\n             </property>\r\n             <property name=\"buddy\">\r\n              <cstring>leFontSize</cstring>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n           <item row=\"1\" column=\"1\">\r\n            <widget class=\"QLineEdit\" name=\"leFontSize\">\r\n             <property name=\"sizePolicy\">\r\n              <sizepolicy hsizetype=\"Preferred\" vsizetype=\"Fixed\">\r\n               <horstretch>0</horstretch>\r\n               <verstretch>0</verstretch>\r\n              </sizepolicy>\r\n             </property>\r\n             <property name=\"toolTip\">\r\n              <string>Enter the font size.</string>\r\n             </property>\r\n            </widget>\r\n           </item>\r\n          </layout>\r\n         </item>\r\n        </layout>\r\n       </widget>\r\n      </widget>\r\n     </item>\r\n    </layout>\r\n   </widget>\r\n  </widget>\r\n  <action name=\"action_Open_files\">\r\n   <property name=\"text\">\r\n    <string>&amp;Open files</string>\r\n   </property>\r\n  </action>\r\n  <action name=\"action_Exit\">\r\n   <property name=\"text\">\r\n    <string>&amp;Exit</string>\r\n   </property>\r\n  </action>\r\n  <action name=\"action_Load\">\r\n   <property name=\"text\">\r\n    <string>&amp;Load</string>\r\n   </property>\r\n  </action>\r\n  <action name=\"action_Save\">\r\n   <property name=\"text\">\r\n    <string>&amp;Save</string>\r\n   </property>\r\n  </action>\r\n  <action name=\"actionLoad_default_project\">\r\n   <property name=\"text\">\r\n    <string>Load &amp;default project</string>\r\n   </property>\r\n  </action>\r\n  <action name=\"action_Manual\">\r\n   <property name=\"text\">\r\n    <string>Readme</string>\r\n   </property>\r\n  </action>\r\n  <action name=\"action_Tips\">\r\n   <property name=\"text\">\r\n    <string>&amp;Tips</string>\r\n   </property>\r\n   <property name=\"visible\">\r\n    <bool>false</bool>\r\n   </property>\r\n  </action>\r\n  <action name=\"action_Changelog\">\r\n   <property name=\"text\">\r\n    <string>&amp;Changelog</string>\r\n   </property>\r\n  </action>\r\n  <action name=\"action_License\">\r\n   <property name=\"text\">\r\n    <string>&amp;License</string>\r\n   </property>\r\n  </action>\r\n  <action name=\"action_About_Highlight\">\r\n   <property name=\"text\">\r\n    <string>&amp;About Highlight</string>\r\n   </property>\r\n  </action>\r\n  <action name=\"actionAbout_translations\">\r\n   <property name=\"text\">\r\n    <string>About &amp;translations</string>\r\n   </property>\r\n  </action>\r\n  <action name=\"actionVisit_website\">\r\n   <property name=\"text\">\r\n    <string>Visit andre-simon.de</string>\r\n   </property>\r\n  </action>\r\n  <action name=\"actionDock_floating_panels\">\r\n   <property name=\"checkable\">\r\n    <bool>true</bool>\r\n   </property>\r\n   <property name=\"checked\">\r\n    <bool>true</bool>\r\n   </property>\r\n   <property name=\"text\">\r\n    <string>&amp;Dock floating panels</string>\r\n   </property>\r\n  </action>\r\n </widget>\r\n <layoutdefault spacing=\"6\" margin=\"11\"/>\r\n <tabstops>\r\n  <tabstop>pbOpenFiles</tabstop>\r\n  <tabstop>lvInputFiles</tabstop>\r\n  <tabstop>pbClearSelection</tabstop>\r\n  <tabstop>pbClearAll</tabstop>\r\n  <tabstop>tabWidgetOptions</tabstop>\r\n  <tabstop>comboFormat</tabstop>\r\n  <tabstop>cbIncLineNo</tabstop>\r\n  <tabstop>sbLineNoWidth</tabstop>\r\n  <tabstop>cbPadZeroes</tabstop>\r\n  <tabstop>cbFragment</tabstop>\r\n  <tabstop>cbValidateInput</tabstop>\r\n  <tabstop>cbEncoding</tabstop>\r\n  <tabstop>comboEncoding</tabstop>\r\n  <tabstop>cbHTMLEmbedStyle</tabstop>\r\n  <tabstop>cbHTMLInlineCSS</tabstop>\r\n  <tabstop>leHTMLStyleFile</tabstop>\r\n  <tabstop>leHTMLStyleIncFile</tabstop>\r\n  <tabstop>pbHTMLChooseStyleIncFile</tabstop>\r\n  <tabstop>leHTMLCssPrefix</tabstop>\r\n  <tabstop>cbHTMLAnchors</tabstop>\r\n  <tabstop>cbHTMLFileNameAnchor</tabstop>\r\n  <tabstop>cbHTMLOrderedList</tabstop>\r\n  <tabstop>cbHTMLEnclosePreTags</tabstop>\r\n  <tabstop>cbLATEXEscQuotes</tabstop>\r\n  <tabstop>cbLATEXBabel</tabstop>\r\n  <tabstop>cbLATEXPrettySymbols</tabstop>\r\n  <tabstop>cbLATEXEmbedStyle</tabstop>\r\n  <tabstop>leLATEXStyleFile</tabstop>\r\n  <tabstop>leLATEXStyleIncFile</tabstop>\r\n  <tabstop>pbLATEXChooseStyleIncFile</tabstop>\r\n  <tabstop>cbTEXEmbedStyle</tabstop>\r\n  <tabstop>leTEXStyleFile</tabstop>\r\n  <tabstop>leTEXStyleIncFile</tabstop>\r\n  <tabstop>pbTEXChooseStyleIncFile</tabstop>\r\n  <tabstop>cbRTFCharStyles</tabstop>\r\n  <tabstop>comboRTFPageSize</tabstop>\r\n  <tabstop>leSVGWidth</tabstop>\r\n  <tabstop>leSVGHeight</tabstop>\r\n  <tabstop>cbSVGEmbedStyle</tabstop>\r\n  <tabstop>leSVGStyleFile</tabstop>\r\n  <tabstop>leSVGStyleIncFile</tabstop>\r\n  <tabstop>pbSVGChooseStyleIncFile</tabstop>\r\n  <tabstop>comboTheme</tabstop>\r\n  <tabstop>cbReformat</tabstop>\r\n  <tabstop>comboReformat</tabstop>\r\n  <tabstop>cbKwCase</tabstop>\r\n  <tabstop>comboKwCase</tabstop>\r\n  <tabstop>sbTabWidth</tabstop>\r\n  <tabstop>cbWrapping</tabstop>\r\n  <tabstop>sbLineLength</tabstop>\r\n  <tabstop>cbAdvWrapping</tabstop>\r\n  <tabstop>comboFontName</tabstop>\r\n  <tabstop>leFontSize</tabstop>\r\n  <tabstop>browserPreview</tabstop>\r\n  <tabstop>pbStartConversion</tabstop>\r\n  <tabstop>pbCopyFile2CP</tabstop>\r\n </tabstops>\r\n <resources>\r\n  <include location=\"../w32-projects/highlight_gui/highlight-gui.qrc\"/>\r\n </resources>\r\n <connections>\r\n  <connection>\r\n   <sender>pbClearAll</sender>\r\n   <signal>clicked()</signal>\r\n   <receiver>lvInputFiles</receiver>\r\n   <slot>clear()</slot>\r\n   <hints>\r\n    <hint type=\"sourcelabel\">\r\n     <x>285</x>\r\n     <y>420</y>\r\n    </hint>\r\n    <hint type=\"destinationlabel\">\r\n     <x>218</x>\r\n     <y>228</y>\r\n    </hint>\r\n   </hints>\r\n  </connection>\r\n </connections>\r\n</ui>\r\n"
  },
  {
    "path": "jni/highlight/gui-qt/precomp.h",
    "content": "#ifndef PRECOMP_H\r\n#define PRECOMP_H\r\n\r\n#if defined __cplusplus\r\n\r\n#endif\r\n\r\n#endif // PRECOMP_H\r\n"
  },
  {
    "path": "jni/highlight/gui-qt/showtextfile.cpp",
    "content": "\r\n/***************************************************************************\r\n                               showtestfile.cpp\r\n                             -------------------\r\n    begin                : Mo 16.03.2009\r\n    copyright            : (C) 2009 by Andre Simon\r\n    email                : andre.simon1@gmx.de\r\n ***************************************************************************/\r\n\r\n/*\r\nThis file is part of Highlight.\r\n\r\nHighlight is free software: you can redistribute it and/or modify\r\nit under the terms of the GNU General Public License as published by\r\nthe Free Software Foundation, either version 3 of the License, or\r\n(at your option) any later version.\r\n\r\nHighlight is distributed in the hope that it will be useful,\r\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\r\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\nGNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License\r\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\r\n*/\r\n\r\n#include \"showtextfile.h\"\r\n#include \"ui_showtextfile.h\"\r\n#include <QTextStream>\r\n#include <QFile>\r\n#include <QDir>\r\n\r\nShowTextFile::ShowTextFile(QWidget *parent) :\r\n    QDialog(parent),\r\n    m_ui(new Ui::ShowTextFile)\r\n{\r\n    m_ui->setupUi(this);\r\n}\r\n\r\nShowTextFile::~ShowTextFile()\r\n{\r\n    delete m_ui;\r\n}\r\n\r\nvoid ShowTextFile::changeEvent(QEvent *e)\r\n{\r\n    switch (e->type()) {\r\n    case QEvent::LanguageChange:\r\n        m_ui->retranslateUi(this);\r\n        break;\r\n    default:\r\n        break;\r\n    }\r\n}\r\n\r\n\r\nbool ShowTextFile::setFileName(const QString& fileName){\r\n#ifndef HL_DOC_DIR\r\n    QFile file( QString(\"%1/%2\").arg(QDir::currentPath()).arg( fileName ));\r\n#else\r\n      QFile file( QString(\"%1/%2\").arg(HL_DOC_DIR).arg(fileName ));\r\n#endif\r\n    if ( file.open( QIODevice::ReadOnly) ) {\r\n        QTextStream stream( &file );\r\n        m_ui->textEdit->setText( stream.readAll() );\r\n        m_ui->lbTitle->setText(fileName);\r\n    }\r\n    return file.exists();\r\n}\r\n\r\nvoid ShowTextFile::on_pushButton_clicked()\r\n{\r\n    this->close();\r\n}\r\n"
  },
  {
    "path": "jni/highlight/gui-qt/showtextfile.h",
    "content": "/***************************************************************************\r\n                               showtextfile.h\r\n                             -------------------\r\n    begin                : Mo 16.03.2009\r\n    copyright            : (C) 2009 by Andre Simon\r\n    email                : andre.simon1@gmx.de\r\n ***************************************************************************/\r\n\r\n/*\r\nThis file is part of Highlight.\r\n\r\nHighlight is free software: you can redistribute it and/or modify\r\nit under the terms of the GNU General Public License as published by\r\nthe Free Software Foundation, either version 3 of the License, or\r\n(at your option) any later version.\r\n\r\nHighlight is distributed in the hope that it will be useful,\r\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\r\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\nGNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License\r\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\r\n*/\r\n\r\n#ifndef SHOWTEXTFILE_H\r\n#define SHOWTEXTFILE_H\r\n\r\n#include <QtGlobal>\r\n\r\n#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))\r\n#include <QtGui/QDialog>\r\n#else\r\n#include <QtWidgets/QDialog>\r\n#endif\r\n\r\nnamespace Ui {\r\n    class ShowTextFile;\r\n}\r\n\r\nclass ShowTextFile : public QDialog {\r\n    Q_OBJECT\r\n    Q_DISABLE_COPY(ShowTextFile)\r\npublic:\r\n    explicit ShowTextFile(QWidget *parent = 0);\r\n    virtual ~ShowTextFile();\r\n    bool setFileName(const QString& fileName);\r\n\r\nprotected:\r\n    virtual void changeEvent(QEvent *e);\r\n\r\nprivate:\r\n    Ui::ShowTextFile *m_ui;\r\n\r\nprivate slots:\r\n    void on_pushButton_clicked();\r\n};\r\n\r\n#endif // SHOWTEXTFILE_H\r\n"
  },
  {
    "path": "jni/highlight/gui-qt/showtextfile.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<ui version=\"4.0\">\r\n <class>ShowTextFile</class>\r\n <widget class=\"QDialog\" name=\"ShowTextFile\">\r\n  <property name=\"windowModality\">\r\n   <enum>Qt::WindowModal</enum>\r\n  </property>\r\n  <property name=\"geometry\">\r\n   <rect>\r\n    <x>0</x>\r\n    <y>0</y>\r\n    <width>711</width>\r\n    <height>442</height>\r\n   </rect>\r\n  </property>\r\n  <property name=\"windowTitle\">\r\n   <string>Show text</string>\r\n  </property>\r\n  <property name=\"windowIcon\">\r\n   <iconset resource=\"highlight-gui.qrc\">\r\n    <normaloff>:/hl_icon2.png</normaloff>:/hl_icon2.png</iconset>\r\n  </property>\r\n  <property name=\"modal\">\r\n   <bool>true</bool>\r\n  </property>\r\n  <layout class=\"QVBoxLayout\" name=\"verticalLayout\">\r\n   <item>\r\n    <widget class=\"QLabel\" name=\"lbTitle\">\r\n     <property name=\"font\">\r\n      <font>\r\n       <pointsize>10</pointsize>\r\n       <weight>75</weight>\r\n       <bold>true</bold>\r\n      </font>\r\n     </property>\r\n     <property name=\"text\">\r\n      <string>TextLabel</string>\r\n     </property>\r\n    </widget>\r\n   </item>\r\n   <item>\r\n    <widget class=\"QTextEdit\" name=\"textEdit\">\r\n     <property name=\"font\">\r\n      <font>\r\n       <family>Courier New</family>\r\n       <pointsize>8</pointsize>\r\n      </font>\r\n     </property>\r\n    </widget>\r\n   </item>\r\n   <item>\r\n    <layout class=\"QHBoxLayout\" name=\"horizontalLayout\">\r\n     <item>\r\n      <spacer name=\"horizontalSpacer\">\r\n       <property name=\"orientation\">\r\n        <enum>Qt::Horizontal</enum>\r\n       </property>\r\n       <property name=\"sizeHint\" stdset=\"0\">\r\n        <size>\r\n         <width>40</width>\r\n         <height>20</height>\r\n        </size>\r\n       </property>\r\n      </spacer>\r\n     </item>\r\n     <item>\r\n      <widget class=\"QPushButton\" name=\"pushButton\">\r\n       <property name=\"text\">\r\n        <string>OK</string>\r\n       </property>\r\n       <property name=\"default\">\r\n        <bool>true</bool>\r\n       </property>\r\n      </widget>\r\n     </item>\r\n    </layout>\r\n   </item>\r\n  </layout>\r\n </widget>\r\n <resources>\r\n  <include location=\"highlight-gui.qrc\"/>\r\n </resources>\r\n <connections/>\r\n</ui>\r\n"
  },
  {
    "path": "jni/highlight/include/Diluculum/CppObject.hpp",
    "content": "/******************************************************************************\\\n* CppObject.hpp                                                                *\n* A struct stored as Lua userdata when exporting or instantiating objects.     *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n\n#ifndef _DILUCULUM_CPP_OBJECT_HPP_\n#define _DILUCULUM_CPP_OBJECT_HPP_\n\nnamespace Diluculum\n{\n   namespace Impl\n   {\n      /** The data that is stored as userdata when a C++ object is exported to\n       *  or instantiated in Lua.\n       */\n      struct CppObject\n      {\n         public:\n            /// Pointer to the actual object.\n            void* ptr;\n\n            /** Should the \\c ptr be <tt>delete</tt>d when the userdata is\n             *  garbage-collected in Lua? Essentially, if the object is\n             *  instantiated in Lua, it should be; if it is instantiated in C++,\n             *  it doesn't.\n             */\n            bool deleteMe;\n      };\n\n   } // namespace Impl\n\n} // namespace Diluculum\n\n#endif // _DILUCULUM_CPP_OBJECT_HPP_\n"
  },
  {
    "path": "jni/highlight/include/Diluculum/LuaExceptions.hpp",
    "content": "/******************************************************************************\\\n* LuaExceptions.hpp                                                            *\n* Exceptions related to Lua errors.                                            *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#ifndef _DILUCULUM_LUA_EXCEPTIONS_HPP_\n#define _DILUCULUM_LUA_EXCEPTIONS_HPP_\n\n#include <stdexcept>\n#include <Diluculum/Types.hpp>\n#include <Diluculum/LuaValue.hpp>\n\n\nnamespace Diluculum\n{\n   /// A generic Lua-related error.\n   class LuaError: public std::runtime_error\n   {\n      public:\n         /** Constructs a \\c LuaError object.\n          *  @param what The message associated with the error.\n          */\n         LuaError (const char* what)\n            : std::runtime_error (what)\n         { }\n   };\n\n\n\n   /// A Lua run-time error.\n   class LuaRunTimeError: public LuaError\n   {\n      public:\n         /** Constructs a \\c LuaRunTimeError object.\n          *  @param what The message associated with the error. Typically will\n          *              be the error message issued by the Lua interpreter.\n          */\n         LuaRunTimeError (const char* what)\n            : LuaError (what)\n         { }\n   };\n\n\n\n   /// A Lua file-related error.\n   class LuaFileError: public LuaError\n   {\n      public:\n         /** Constructs a \\c LuaFileError object.\n          *  @param what The message associated with the error.\n          */\n         LuaFileError (const char* what)\n            : LuaError (what)\n         { }\n   };\n\n\n\n   /// An error while interpreting a chunk of Lua code.\n   class LuaSyntaxError: public LuaError\n   {\n      public:\n         /** Constructs a \\c LuaSyntaxError object.\n          *  @param what The message associated with the error. Typically will be\n          *              the error message issued by the Lua interpreter.\n          */\n         LuaSyntaxError (const char* what)\n            : LuaError (what)\n         { }\n   };\n\n\n\n   /// A memory error reported by Lua.\n   class LuaMemoryError: public LuaError\n   {\n      public:\n         /** Constructs a \\c LuaMemoryError object.\n          *  @param what The message associated with the error.\n          */\n         LuaMemoryError (const char* what)\n            : LuaError (what)\n         { }\n   };\n\n\n\n   /// An error while executing the Lua error handler.\n   class LuaErrorError: public LuaError\n   {\n      public:\n         /** Constructs a \\c LuaErrorError object.\n          *  @param what The message associated with the error.\n          */\n         LuaErrorError (const char* what)\n            : LuaError (what)\n         { }\n   };\n\n\n\n   /// An error related to types when doing some Lua-related processing.\n   class LuaTypeError: public LuaError\n   {\n      public:\n         /** Constructs a \\c LuaTypeError object.\n          *  @param what The message associated with the error.\n          */\n         LuaTypeError (const char* what)\n            : LuaError (what)\n         { }\n   };\n\n\n\n   /** An error that happens when a certain type is expected but another one is\n    *  found.\n    */\n   class TypeMismatchError: public LuaError\n   {\n      public:\n         /** Constructs a \\c TypeMismatchError object.\n          *  @param expectedType The type that was expected.\n          *  @param foundType The type that was actually found.\n          */\n         TypeMismatchError (const std::string& expectedType,\n                            const std::string& foundType);\n\n         /** Destroys a \\c TypeMismatchError object.\n          *  @note This was defined just to pretend that the destructor does not\n          *        throw any exception. While this is something that I cannot\n          *        guarantee (at least with this implementation), I believe this\n          *        not a very dangerous lie.\n          */\n         ~TypeMismatchError() throw() { };\n\n         /// Returns the type that was expected.\n         std::string getExpectedType() const { return expectedType_; }\n\n         /// Returns the type that was actually found.\n         std::string getFoundType() const { return foundType_; }\n\n      private:\n         /// The type that was expected.\n         std::string expectedType_;\n\n         /// The type that was actually found.\n         std::string foundType_;\n   };\n\n} // namespace Diluculum\n\n\n#endif // _DILUCULUM_LUA_EXCEPTIONS_HPP_\n"
  },
  {
    "path": "jni/highlight/include/Diluculum/LuaFunction.hpp",
    "content": "/******************************************************************************\\\n* LuaFunction.hpp                                                              *\n* A C++ equivalent of a Lua function.                                          *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#ifndef _DILUCULUM_LUA_FUNCTION_HPP_\n#define _DILUCULUM_LUA_FUNCTION_HPP_\n\n#include <string>\n#include <boost/scoped_array.hpp>\n#include <lua.hpp>\n#include <Diluculum/Types.hpp>\n\n\nnamespace Diluculum\n{\n   /** A C++ equivalent of a Lua function. This can store both C functions\n    *  exported (or exportable) to Lua and pure Lua functions. In the first\n    *  case, it stores a \\c lua_CFunction. In the second case it stores data\n    *  that would normally be in the Lua-space as a function implemented in Lua\n    *  (one can think of it as a buffer that stores Lua bytecode that a Lua\n    *  interpreter can understand as a function implemented in Lua). This is\n    *  used as the value of a \\c LuaValue when it holds a Lua function.\n    *  @note A \\c LuaFunction does not have any reference to a Lua\n    *        interpreter. Thus, it does not make sense to call a \\c LuaFunction\n    *        object directly. To call a \\c LuaFunction, use \\c LuaState::call().\n    */\n   class LuaFunction\n   {\n      public:\n\n         /** Constructs a \\c LuaFunction from Lua source code (a Lua chunk). The\n          *  default value (a \"dummy\" chunk, that doesn't return anything) can\n          *  be useful for moments in which a default constructable \\c\n          *  LuaFunction is desired.\n          *  @param luaChunk The Lua source of the chunk.\n          *  @note The chunk can be seen as a vararg function. So, if one wants,\n          *        for instance, a chunk corresponding to a function that\n          *        returns its first parameter doubled, the following chunk can\n          *        be used: <tt>\"local p = {...}; return p[1]*2\"</tt>.\n          */\n         LuaFunction (const::std::string& luaChunk = \"\");\n\n         /** Constructs a \\c LuaFunction from Lua bytecode. Typically, this\n          *  constructor is not called directly by end users. Instead, end users\n          *  use <tt>LuaState::operator[]</tt> to get a \\c LuaVariable\n          *  containing a \\c LuaFunction value, which can be accessed via\n          *  <tt>LuaVariable::value()</tt>.\n          *  @param data A pointer to the beginning of the memory area\n          *         containing Lua bytecode.\n          *  @param size The number of bytecode bytes to read.\n          */\n         LuaFunction (const void* data, size_t size);\n\n         /** Constructs a \\c LuaFunction from a \\c lua_CFunction (a Lua function\n          * implemented in C).\n          */\n         LuaFunction (lua_CFunction func);\n\n         /** The copy constructor. The newly constructed \\c LuaFunction will\n          *  have its own block of memory, with the same contents as the \\c\n          *  other. In other words, this constructor allocates and copies\n          *  memory.\n          */\n         LuaFunction (const LuaFunction& other);\n\n         /** Assigns a \\c LuaFunction to this one. The memory currently\n          *  allocated for \\c this will be freed, new memory will be allocated,\n          *  and the data stored in \\c rhs will be copied to \\c this.\n          */\n         const LuaFunction& operator= (const LuaFunction& rhs);\n\n         /**\n          * Checks if this \\c LuaFunction holds a C function (instead of a\n          * \"pure\" Lua function).\n          */\n         bool isCFunction() const { return functionType_ == LUA_C_FUNCTION; }\n\n         /**\n          * Returns the value of this \\c LuaFunction as a C function.\n          * @note Will \\c assert() if this \\c LuaFunction does not hold a C\n          *       function.\n          */\n         lua_CFunction getCFunction() const;\n\n         /** Returns the size, in bytes, of the data stored in this\n          *  \\c LuaFunction.\n          */\n         size_t getSize() const { return size_; }\n\n         /// Returns a pointer to the data stored in this \\c LuaFunction.\n         void* getData() { return data_.get(); }\n\n         /** Returns a \\c const pointer to the data stored in this\n          *  \\c LuaFunction.\n          */\n         const void* getData() const { return data_.get(); }\n\n         /// Sets the data stored in this \\c LuaFunction.\n         void setData(void* data, size_t size);\n\n         /// Gets the \"reader flag\".\n         bool getReaderFlag() const { return readerFlag_; }\n\n         /// Sets the \"reader flag\" to a given value.\n         void setReaderFlag(bool f) { readerFlag_ = f; }\n\n         /** The \"greater than\" operator for \\c LuaFunction.\n          *  @note Given two <tt>LuaFunction</tt>s, the decision on which one is\n          *        greater is somewhat arbitrary. Here, the function with larger\n          *        size is considered greater. If both are equal, the decision\n          *        is based on the contents of the stored data.\n          */\n         bool operator> (const LuaFunction& rhs) const;\n\n         /** The \"less than\" operator for \\c LuaFunction.\n          *  @note Given two <tt>LuaFunction</tt>s, the decision on which one is\n          *        lesser is somewhat arbitrary. The criterion is similar to the\n          *        described for the \"greater than\" operator.\n          */\n         bool operator< (const LuaFunction& rhs) const;\n\n         /** The \"equal to\" operator for \\c LuaFunction.\n          *  @note Two <tt>LuaFunctions</tt>s are considered equal if the data\n          *        they store have the same size and the same contents.\n          *  @todo In Lua, a function is considered equal only to itself. Things\n          *        are different here. Does this have a reason to not be like in\n          *        Lua?\n          */\n         bool operator== (const LuaFunction& rhs) const;\n\n         /// The \"different than\" operator for \\c LuaFunction.\n         bool operator!= (const LuaFunction& rhs) const;\n\n      private:\n         /** The possible types of functions than possibly be stored in a\n          *  \\c LuaFunction.\n          */\n         enum TypeOfFunction\n         {\n            /// A Lua function implemented in C.\n            LUA_C_FUNCTION,\n\n            /// A Lua function implemented in Lua.\n            LUA_LUA_FUNCTION\n         };\n\n         /// The type of function stored in this \\c LuaFunction.\n         TypeOfFunction functionType_;\n\n         /// The number of bytes stored \"in\" \\c data_.\n         size_t size_;\n\n         /** A (smart) pointer to the data owned by this\n          * \\c LuaFunction. Depending on \\c functionType_, the data pointed to\n          * by \\c data may store a pointer to a \\c lua_CFunction or Lua\n          * bytecode.\n          */\n         boost::scoped_array<char> data_;\n\n         /** A flag used when reading the bytecode data, in calls to \\c\n          *  lua_load() and its \\c lua_Reader.\n          */\n         bool readerFlag_;\n   };\n\n} // namespace Diluculum\n\n#endif // _DILUCULUM_LUA_FUNCTION_HPP_\n"
  },
  {
    "path": "jni/highlight/include/Diluculum/LuaState.hpp",
    "content": "/******************************************************************************\\\n* LuaState                                                                     *\n* A pleasant way to use a Lua state in C++.                                    *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n\n#ifndef _DILUCULUM_LUA_STATE_HPP_\n#define _DILUCULUM_LUA_STATE_HPP_\n\n#include <lua.hpp>\n#include <string>\n#include <vector>\n#include <Diluculum/LuaExceptions.hpp>\n#include <Diluculum/LuaValue.hpp>\n#include <Diluculum/LuaVariable.hpp>\n#include <Diluculum/Types.hpp>\n\n\nnamespace Diluculum\n{\n\n   /** \\c LuaState: The Next Generation. The pleasant way to do perform relevant\n    *  operations on a Lua state.\n    *  <p>(My previous implementation of a class named \\c LuaState was pretty\n    *  low-level. It was essentially a C++ wrapper around a <tt>lua_State*</tt>,\n    *  without higher level operations. This is an attempt to allow me to do\n    *  the kind of things I do most of the time without much effort.)\n    */\n   class LuaState\n   {\n      public:\n         /** Constructs a \\c LuaState that owns a <tt>lua_State*</tt>. In other\n          *  words, this will create the underlying Lua state on construction\n          *  and destroy it when this \\c LuaState is destroyed.\n          *  @param loadStdLib If \\c true (the default), makes all\n          *         the Lua standard libraries available.\n          *  @throw LuaError If something goes wrong.\n          */\n         explicit LuaState (bool loadStdLib = true);\n\n         /** Constructs a \\c LuaState that doesn't own the underlying Lua state.\n          *  In other words, this \\c LuaState will use a user-supplied\n          *  <tt>lua_State*</tt> and its destructor will not \\c lua_close() it.\n          *  @param state The <tt>lua_State*</tt> that will be used by this\n          *         \\c LuaState.\n          *  @param loadStdLib If \\c true, makes all the Lua standard libraries\n          *         available (default is \\c false, because it is very likely\n          *         that the libraries are already opened in the Lua state\n          *         passed as the first parameter).\n          *  @throw LuaError If something goes wrong.\n          */\n         explicit LuaState (lua_State* state, bool loadStdLib = false);\n\n         /** Destructs a \\c LuaState. If this \\c LuaState owns the underlying \\c\n          *  lua_State*, \\c lua_close() will be called on it. See the\n          *  constructors' documentation for details on the \\c lua_State*\n          *  ownership.\n          */\n         virtual ~LuaState();\n\n         /** Executes the file passed as parameter and returns all the values\n          *  returned by this execution. Notice that when a \\c LuaValueList is\n          *  assigned to a \\c LuaValue, just the first value in the list is\n          *  assigned, so this is handy for situations when only the first\n          *  return value is desired.\n          *  @param fileName The file to be executed.\n          *  @return All the values returned by the file execution.\n          *  @throw LuaError \\c LuaError or any of its subclasses can be thrown.\n          *         In particular, \\c LuaTypeError will be thrown if the\n          *         execution returns a type not supported by \\c LuaType.\n          */\n         LuaValueList doFile (const std::string& fileName)\n         { return doStringOrFile (false, fileName); }\n\n         /** Executes the string passed as parameter and returns all the values\n          *  returned by this execution. Notice that when a \\c LuaValueList is\n          *  assigned to a \\c LuaValue, just the first value in the list is\n          *  assigned, so this is handy for situations when only the first\n          *  return value is desired.\n          *  @param what The string to be interpreted.\n          *  @return All the values returned by the execution of \\c what.\n          *  @throw LuaError \\c LuaError or any of its subclasses can be thrown.\n          *         In particular, \\c LuaTypeError will be thrown if the\n          *         execution returns a type not supported by \\c LuaType.\n          */\n         LuaValueList doString (const std::string& what)\n         { return doStringOrFile (true, what); }\n\n         /** Calls a given Lua function on this Lua state.\n          *  @param func The function to be called.\n          *  @param params the list of parameters to pass to the function.\n          *  @param chunkName The string to use as the \"chunk name\" in the\n          *         call. This is something added to error messages, in order to\n          *         make easier to stop where the error was.\n          *  @throw LuaError (or any of its subclasses), if some error is found\n          *         during the function execution.\n          */\n         LuaValueList call (LuaFunction& func,\n                            const LuaValueList& params,\n                            const std::string& chunkName = \"Diluculum chunk\");\n\n         /** Returns a \\c LuaVariable representing the global variable named\n          *  \\c variable. Since the returned value also has a subscript\n          *  operator, this is a handy way to access variables stored in tables.\n          *  Also, since the \\c LuaVariable has read/write support, this can be\n          *  used even to modify the variables stored in the \\c LuaState.\n          *  @param variable The name of the global variable to be accessed.\n          *  @returns The global variable named \\c variable. If no such variable\n          *           exists, returns a variable containing \\c Nil.\n          *  @note This operator does not throw exceptions.\n          *  @note Trying to access \"_G\" (the Lua globals table) with\n          *        <tt>LuaState::operator[]</tt> will not work (debug builds\n          *        will \\c assert()). Please use \\c globals() instead.\n          */\n         LuaVariable operator[] (const std::string& variable);\n\n         /**\n          * Provides access to the table of global variables.\n          * @note The returned table will not contain \"_G\" not \"package\",\n          *       because including them would result in tables referencing\n          *       themselves in a infinitely recursive manner. In Lua, tables\n          *       are reference types, so this recursion is OK. In Diluculum,\n          *       tables are value types, so this would result in a crash.\n          * @return The table of global variables in this Lua state.\n          */\n         LuaValueMap globals();\n\n         /// Returns the encapsulated <tt>lua_State*</tt>.\n         lua_State* getState() { return state_; }\n\n      private:\n         /** Since The implementation of \\c doString and \\c doFile() are quite\n          *  similar, it looked like a good idea to use the same function to\n          *  implement both at a lower level. This is it.\n          *  @param isString If \\c true, means that it is desired to execute the\n          *         contents of a string. If \\c false, means that it is desired\n          *         to execute the contents of a file.\n          *  @param str Can be either a string of Lua code to be executed or a\n          *         file with Lua code to be executed. The exact interpretation\n          *         of this parameter depends on the first parameter,\n          *         \\c isString.\n          *  @throw LuaError \\c LuaError or any of its subclasses can be thrown.\n          *         In particular, \\c LuaTypeError will be thrown if the\n          *         execution returns a type not supported by \\c LuaType.\n          */\n         LuaValueList doStringOrFile (bool isString, const std::string& str);\n\n         /// The underlying \\c lua_State*.\n         lua_State* state_;\n\n         /** Does this \\c LuaState owns \\c state_? (This used by the destructor\n          *  to decide whether it has to \\c lua_close() it or not.)\n          */\n         const bool ownsState_;\n   };\n\n} // namespace Diluculum\n\n#endif // #ifndef _DILUCULUM_LUA_STATE_HPP_\n"
  },
  {
    "path": "jni/highlight/include/Diluculum/LuaUserData.hpp",
    "content": "/******************************************************************************\\\n* LuaUserData.hpp                                                              *\n* A C++ equivalent of a Lua userdata.                                          *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#ifndef _DILUCULUM_LUA_USER_DATA_HPP_\n#define _DILUCULUM_LUA_USER_DATA_HPP_\n\n#include <boost/scoped_array.hpp>\n#include <lua.hpp>\n#include <Diluculum/Types.hpp>\n\n\nnamespace Diluculum\n{\n   /** A C++ equivalent of a Lua userdata. Or, perhaps more precisely: something\n    *  that lives in the C++-space, and that stores data that would normally be\n    *  in the Lua-space as userdata. This is used as the value of a \\c LuaValue\n    *  when it holds userdata.\n    *  @note A \\c LuaUserData has no counterpart in a Lua state. It is simply a\n    *        block of memory that can be (via a \\c LuaValue and a \\c LuaState)\n    *        stored in or read from a userdata in Lua state.\n    */\n   class LuaUserData\n   {\n      public:\n\n         /** Constructs a \\c LuaUserData, allocating \\c size bytes of memory.\n          *  This memory is initially filled with garbage. And this memory is\n          *  automatically freed when the \\c LuaUserData is destroyed.\n          */\n         explicit LuaUserData (size_t size);\n\n         /** The copy constructor. The newly constructed \\c LuaUserData will\n          *  have its own block of memory, with the same contents as the\n          *  \\c other. In other words, this constructor allocates and copies\n          *  memory.\n          */\n         LuaUserData (const LuaUserData& other);\n\n         /** Assigns a \\c LuaUserData to this one. The memory currently\n          *  allocated for \\c this will be freed, new memory will be allocated,\n          *  and the data stored in \\c rhs will be copied to \\c this.\n          */\n         const LuaUserData& operator= (const LuaUserData& rhs);\n\n         /** Returns the size, in bytes, of the data stored in this\n          *  \\c LuaUserData.\n          */\n         size_t getSize() const { return size_; }\n\n         /// Returns a pointer to the data stored in this \\c LuaUserData.\n         void* getData() { return data_.get(); }\n\n         /** Returns a \\c const pointer to the data stored in this\n          *  \\c LuaUserData.\n          */\n         const void* getData() const { return data_.get(); }\n\n         /** The \"greater than\" operator for \\c LuaUserData.\n          *  @note Given two <tt>LuaUserData</tt>s, the decision on which one is\n          *        greater is somewhat arbitrary. Here, the userdata with larger\n          *        \\c size() is considered greater. If both are equal, the\n          *        decision is based on the contents of the stored data.\n          */\n         bool operator> (const LuaUserData& rhs) const;\n\n         /** The \"less than\" operator for \\c LuaUserData.\n          *  @note Given two <tt>LuaUserData</tt>s, the decision on which one is\n          *        lesser is somewhat arbitrary. The criterion is similar to the\n          *        described for the \"greater than\" operator.\n          */\n         bool operator< (const LuaUserData& rhs) const;\n\n         /** The \"equal to\" operator for \\c LuaUserData.\n          *  @note Two <tt>LuaUserData</tt>s are considered equal if the data\n          *        they store have the same size and the same contents.\n          *  @todo In Lua, a userdata is considered equal only to itself. Things\n          *        are different here. Does this have a reason to not be like in\n          *        Lua?\n          */\n         bool operator== (const LuaUserData& rhs) const;\n\n         /// The \"different than\" operator for \\c LuaUserData.\n         bool operator!= (const LuaUserData& rhs) const;\n\n      private:\n         /// The number of bytes stored \"in\" \\c data_.\n         size_t size_;\n\n         /// A (smart) pointer to the data owned by this \\c LuaUserData.\n         boost::scoped_array<char> data_;\n   };\n\n} // namespace Diluculum\n\n#endif // _DILUCULUM_LUA_USER_DATA_HPP_\n"
  },
  {
    "path": "jni/highlight/include/Diluculum/LuaUtils.hpp",
    "content": "/******************************************************************************\\\n* LuaUtils.hpp                                                                 *\n* Some utilities related to Lua.                                               *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#ifndef _DILUCULUM_LUA_UTILS_HPP_\n#define _DILUCULUM_LUA_UTILS_HPP_\n\n#include <Diluculum/LuaValue.hpp>\n\nnamespace Diluculum\n{\n\n   /** Converts and returns the element at index \\c index on the stack to a\n    *  \\c LuaValue. This keeps the Lua stack untouched. Oh, yes, and it accepts\n    *  both positive and negative indices, just like the standard functions on\n    *  the Lua C API.\n    *  @throw LuaTypeError If the element at \\c index cannot be converted to a\n    *         \\c LuaValue. This can happen if the value at that position is, for\n    *         example, a \"Lua Thread\" that is not supported by \\c LuaValue.\n    */\n   LuaValue ToLuaValue (lua_State* state, int index);\n\n   /** Pushes the value stored at \\c value into the Lua stack of \\c state. For\n    *  most types, this is equivalent to simply calling the appropriate\n    *  <tt>lua_push*()</tt> function. For other types, like tables and Lua\n    *  functions, the implementation is more complicated.\n    *  @note If \\c value holds a table, then any entry that happens to have\n    *        \\c Nil as key will be ignored. (Since Lua does not support \\c nil\n    *        as a table index.)\n    */\n   void PushLuaValue (lua_State* state, const LuaValue& value);\n\n} // namespace Diluculum\n\n#endif // _DILUCULUM_LUA_UTILS_HPP_\n"
  },
  {
    "path": "jni/highlight/include/Diluculum/LuaValue.hpp",
    "content": "/******************************************************************************\\\n* LuaValue.hpp                                                                 *\n* A class that somewhat mimics a Lua value.                                    *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#ifndef _DILUCULUM_LUA_VALUE_HPP_\n#define _DILUCULUM_LUA_VALUE_HPP_\n\n#include <lua.hpp>\n#include <map>\n#include <stdexcept>\n#include <string>\n#include <Diluculum/CppObject.hpp>\n#include <Diluculum/LuaUserData.hpp>\n#include <Diluculum/LuaFunction.hpp>\n#include <Diluculum/Types.hpp>\n\n\nnamespace Diluculum\n{\n   /** A class that somewhat mimics a Lua value. Notice that a \\c LuaValue is\n    *  a C++-side thing. There is absolutely no relationship between a\n    *  \\c LuaValue and a Lua state. This is particularly important for tables\n    *  and userdata: in Lua, these things are garbage-collectible objects, and\n    *  variables are just references to them. In Diluculum, a \\c LuaValue\n    *  represents the value (hence the name!). So, if a \\c LuaValue holds a\n    *  table, then it contains a collection of keys and values. Similarly, if it\n    *  holds a userdata, it actually contains a block of memory with some data.\n    */\n   class LuaValue\n   {\n      public:\n         /// Constructs a \\c LuaValue with a \\c nil value.\n         LuaValue();\n\n         /// Constructs a \\c LuaValue with boolean type and \\c b value.\n         LuaValue (bool b);\n\n         /// Constructs a \\c LuaValue with number type and \\c n value.\n         LuaValue (float n);\n\n         /// Constructs a \\c LuaValue with number type and \\c n value.\n         LuaValue (double n);\n\n         /// Constructs a \\c LuaValue with number type and \\c n value.\n         LuaValue (long double n);\n\n         /// Constructs a \\c LuaValue with number type and \\c n value.\n         LuaValue (short n);\n\n         /// Constructs a \\c LuaValue with number type and \\c n value.\n         LuaValue (unsigned short n);\n\n         /// Constructs a \\c LuaValue with number type and \\c n value.\n         LuaValue (int n);\n\n         /// Constructs a \\c LuaValue with number type and \\c n value.\n         LuaValue (unsigned n);\n\n         /// Constructs a \\c LuaValue with number type and \\c n value.\n         LuaValue (long n);\n\n         /// Constructs a \\c LuaValue with number type and \\c n value.\n         LuaValue (unsigned long n);\n\n         /// Constructs a \\c LuaValue with string type and \\c s value.\n         LuaValue (const std::string& s);\n\n         /// Constructs a \\c LuaValue with string type and \\c s value.\n         LuaValue (const char* s);\n\n         /// Constructs a \\c LuaValue with table type and \\c t value.\n         LuaValue (const LuaValueMap& t);\n\n         /// Constructs a \\c LuaValue with function type and \\c f value.\n         LuaValue (lua_CFunction f);\n\n         /// Constructs a \\c LuaValue with function type and \\c f value.\n         LuaValue (const LuaFunction& f);\n\n         /// Constructs a \\c LuaValue with \"user data\" type and \\c ud value.\n         LuaValue (const LuaUserData& ud);\n\n         /** Constructs a \\c LuaValue from a \\c LuaValueList. The first value on\n          *  the list is used to initialize the \\c LuaValue. If the\n          *  \\c LuaValueList is empty, initializes the constructed \\c LuaValue\n          *  to \\c Nil.\n          */\n         LuaValue (const LuaValueList& v);\n\n         /// Copy constructor.\n         LuaValue (const LuaValue& other);\n\n         /// Destroys the \\c LuaValue, freeing all the resources owned by it.\n         ~LuaValue() { destroyObjectAtData(); }\n\n         /// Assignment operator.\n         LuaValue& operator= (const LuaValue& rhs);\n\n         /** Assigns a \\c LuaValueList to a \\c LuaValue. The first value on\n          *  the list is used to initialize the \\c LuaValue. If the\n          *  \\c LuaValueList is empty, sets the \\c LuaValue to \\c Nil.\n          */\n         const LuaValueList& operator= (const LuaValueList& rhs);\n\n         /** Returns one of the <tt>LUA_T*</tt> constants from <tt>lua.h</tt>,\n          *  representing the type stored in this \\c LuaValue.\n          */\n         int type() const { return dataType_; }\n\n         /** Returns the type of this \\c LuaValue as a string, just like the Lua\n          *  built-in function \\c type().\n          *  @return One of the following strings: <tt>\"nil\"</tt>,\n          *          <tt>\"boolean\"</tt>, <tt>\"number\"</tt>, <tt>\"string\"</tt>,\n          *          <tt>\"table\"</tt>, <tt>\"function\"</tt>, <tt>\"userdata\"</tt>.\n          */\n         std::string typeName() const;\n\n         /** Return the value as a number.\n          *  @throw TypeMismatchError If the value is not a number (this is a\n          *         strict check; no type conversion is performed).\n          */\n         lua_Number asNumber() const;\n\n         /** Return the value as an integer.\n          *  @throw TypeMismatchError If the value is not a number (this is a\n          *         strict check; no type conversion is performed -- no other\n          *         than the conversion from \\c lua_Number to \\c lua_Integer,\n          *         that is).\n          */\n         lua_Integer asInteger() const;\n\n         /** Return the value as a string.\n          *  @throw TypeMismatchError If the value is not a string (this is a\n          *         strict check; no type conversion is performed).\n          */\n         const std::string& asString() const;\n\n         /** Return the value as a boolean.\n          *  @throw TypeMismatchError If the value is not a boolean (this is a\n          *         strict check; no type conversion is performed).\n          */\n         bool asBoolean() const;\n\n         /** Returns the value as a table (\\c LuaValueMap).\n          *  @note Notice that the table is returned by value. You may strongly\n          *        consider using the subscript operator (that returns a\n          *        reference) for accessing the values stored in a table-typed\n          *        \\c LuaValue.\n          *  @throw TypeMismatchError If the value is not a table (this is a\n          *         strict check; no type conversion is performed).\n          */\n         LuaValueMap asTable() const;\n\n         /** Return the value as a \\c const Lua function.\n          *  @throw TypeMismatchError If the value is not a Lua function.\n          *         (this is a strict check; no type conversion is performed).\n          */\n         const LuaFunction& asFunction() const;\n\n         /** Return the value as a \\c const (full) user data.\n          *  @throw TypeMismatchError If the value is not a (full) user data\n          *         (this is a strict check; no type conversion is performed).\n          */\n         const LuaUserData& asUserData() const;\n\n         /** Return the value as a (full) user data.\n          *  @note Since this is returned as a non-\\c const reference, the\n          *        \\c LuaUserData::getData() method can be used to get\n          *        read/write access to the raw user data.\n          *  @throw TypeMismatchError If the value is not a (full) user data\n          *         (this is a strict check; no type conversion is performed).\n          */\n         LuaUserData& asUserData();\n\n         /** Assuming that the value stores a C++ object exported to or\n          *  instantiated in Lua, returns a pointer to the (\\c const) C++\n          *  object.\n          */\n         template<class T>\n         T asObjectPtr() const\n         {\n            return static_cast<T>(\n               static_cast<const Impl::CppObject*>(asUserData().getData())->ptr);\n         }\n\n         /** Assuming that the value stores a C++ object exported to or\n          *  instantiated in Lua, returns a pointer to the C++ object.\n          */\n         template<class T>\n         T asObjectPtr()\n         {\n            return static_cast<T>(\n               static_cast<Impl::CppObject*>(asUserData().getData())->ptr);\n         }\n\n         /** \"Less than\" operator for <tt>LuaValue</tt>s.\n          *  @return The order relationship is quite arbitrary for\n          *          <tt>LuaValue</tt>s, but this has to be defined in order to\n          *          \\c LuaValueMap work nicely. Anyway, here are the rules used\n          *          to determine who is less than who:\n          *          - First, \\c typeName() is called for both\n          *            <tt>LuaValue</tt>s and they are compared with the usual\n          *            \"less than\" operator for strings.\n          *          - If both type names are equal, but something different\n          *            than <tt>\"nil\"</tt> and <tt>\"table\"</tt>, then the values\n          *            contained in the <tt>LuaValue</tt>s are compared using\n          *            the \"less than\" operator for that type.\n          *          - If both type names are <tt>\"nil\"</tt>, the function\n          *            returns \\c false.\n          *          - If both type names are <tt>\"table\"</tt>, then the number\n          *            of elements in each table are compared. The shorter table\n          *            is \"less than\" the larger table.\n          *          - If both tables have the same size, then each entry is\n          *            recursively compared (that is, using the rules described\n          *            here). For each entry, the key is compared first, than\n          *            the value. This is done until finding something \"less\n          *            than\" the other thing.\n          *          - If no differences are found, \\c false is obviously\n          *            returned.\n          */\n         bool operator< (const LuaValue& rhs) const;\n\n         /** \"Greater than\" operator for <tt>LuaValue</tt>s.\n          *  @return The rules for determining who is greater than who are\n          *          similar to the ones described in \\c operator<.\n          */\n         bool operator> (const LuaValue& rhs) const;\n\n         /** \"Equal\" operator for <tt>LuaValue</tt>s.\n          *  @return \\c true if <tt>*this</tt> and \\c rhs have the same value.\n          *          \\c false otherwise.\n          */\n         bool operator== (const LuaValue& rhs) const;\n\n         /** \"Different\" operator for <tt>LuaValue</tt>s.\n          *  @return \\c true if <tt>*this</tt> and \\c rhs don't have the same\n          *          value. \\c false otherwise.\n          */\n         bool operator!= (const LuaValue& rhs) const\n         { return !(*this == rhs); }\n\n         /** Returns a reference to a field of this \\c LuaValue (assuming it is\n          *  a table). If there is no value associated with the key passed as\n          *  parameter, inserts a new value (\\c nil) and returns a reference to\n          *  it.\n          *  @throw TypeMismatchError If this \\c LuaValue does not hold a table.\n          */\n         LuaValue& operator[] (const LuaValue& key);\n\n         /** Returns a \\c const reference to a field of this \\c LuaValue\n          *  (assuming it is a table). If there is no value associated with the\n          *  key passed as parameter, returns \\c Nil.\n          *  @throw TypeMismatchError If this \\c LuaValue does not hold a table.\n          */\n         const LuaValue& operator[] (const LuaValue& key) const;\n\n      private:\n\n         /** Destroys the object allocated at the \\c data_ member, freeing its\n          *  resources.\n          */\n         void destroyObjectAtData();\n\n         /// This is used just to know the size of the \\c data_ member.\n         union PossibleTypes\n         {\n               lua_Number typeNumber;\n               char typeString[sizeof(std::string)];\n               bool typeBool;\n               char typeLuaValueMap[sizeof(LuaValueMap)];\n               char typeFunction[sizeof(LuaFunction)];\n               char typeUserData[sizeof(LuaUserData)];\n         };\n\n         /** This stores the actual data of this \\c LuaValue.\n          *  <p>Implementation details: This member is large enough to store the\n          *  largest value. The values are allocated here using placement new,\n          *  with destructors explicitly called whenever necessary.\n          */\n         char data_[sizeof(PossibleTypes)];\n\n         /** The actual type stored in this \\c LuaValue. The values here are the\n          *  type constants defined by Lua, like \\c LUA_TNUMBER and \\c LUA_TNIL.\n          */\n         int dataType_;\n   };\n\n\n\n   /// A constant with the value of \\c nil.\n   const LuaValue Nil;\n\n   /// A constant that is an empty \\c LuaValueMap.\n   const LuaValueMap EmptyLuaValueMap;\n\n   /// A constant with value of an empty table.\n   const LuaValue EmptyTable (EmptyLuaValueMap);\n\n} // namespace Diluculum\n\n\n#endif // _DILUCULUM_LUA_VALUE_HPP_\n"
  },
  {
    "path": "jni/highlight/include/Diluculum/LuaVariable.hpp",
    "content": "/******************************************************************************\\\n* LuaVariable.hpp                                                              *\n* A variable living in a Lua interpreter.                                      *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#ifndef _DILUCULUM_LUA_VARIABLE_HPP_\n#define _DILUCULUM_LUA_VARIABLE_HPP_\n\n#include <vector>\n#include <Diluculum/LuaValue.hpp>\n\n\nnamespace Diluculum\n{\n   /** A variable living in a Lua state. Notice the crucial difference: unlike a\n    *  \\c LuaValue, a \\c LuaVariable necessarily has a real counterpart in a Lua\n    *  state. Thus, when something is assigned to a \\c LuaVariable, the value of\n    *  the corresponding variable in the Lua state is changed, too.\n    *  <p><tt>LuaVariable</tt>s cannot be directly constructed. They are\n    *  designed to be returned by <tt>LuaState</tt>'s subscript operator.\n    */\n   class LuaVariable\n   {\n      friend class LuaState;\n\n      public:\n         /** Assigns a new value to this \\c LuaVariable. The corresponding\n          *  variable in the Lua state is updated accordingly.\n          *  @note Notice that this is the assignment of a new value to a\n          *        variable. The user is also allowed to assign a\n          *        \\c LuaVariable to another \\c LuaVariable (using the\n          *        compiler-generated assignment operator). In that case, the\n          *        \\c LuaVariable at the left hand side will refer to the same\n          *        variable as the \\c LuaVariable at the right hand side, but no\n          *        values will be changed.\n          *  @param rhs The new value for the variable.\n          *  @return \\c rhs, so that a sequence of assignments, like\n          *          <tt>a = b = c = 1;</tt> works. Actually, returning\n          *          \\c rhs is the same as returning <tt>this->value()</tt>,\n          *          that perhaps make more sense.\n          *  @throw TypeMismatchError If this \\c LuaVariable tries to subscript\n          *         something that is not a table.\n          *  @note Part of this method's implementation is identical to the\n          *        implementation of the \\c DILUCULUM_REGISTER_OBJECT() macro.\n          *        If someday the implementation here is replaced with something\n          *        better, remember to change there, too.\n          */\n         const LuaValue& operator= (const LuaValue& rhs);\n\n         /** Returns the value associated with this variable. If the variable\n          *  does not exist, returns \\c Nil.\n          *  @throw TypeMismatchError If this \\c LuaVariable tries to subscript\n          *         something that is not a table.\n          */\n         LuaValue value() const;\n\n         /** Assuming that this \\c LuaVariable holds a table, returns the value\n          *  whose index is \\c key.\n          *  @param key The key whose value is desired.\n          *  @return The value whose index is \\c key.\n          *  @note This method doesn't throw anything, even if this\n          *        \\c LuaVariable doesn't hold a table. But an exception will\n          *        be thrown if one tries to access the value of the returned\n          *        variable (see \\c value()).\n          */\n         LuaVariable operator[] (const LuaValue& key) const;\n\n         /** Assuming that this \\c LuaVariable holds a function, calls this\n          *  function and returns its return values. Both \"pure\" Lua functions\n          *  and functions written in C/C++ and \"exported\" to Lua are supported.\n          *  @param params All the parameters to be passed to the function being\n          *         called. The first parameter at index 0, the second at\n          *         index 1 and so on.\n          *  @return All the values returned by the called function. The first\n          *          return value at index 0, the second at index 1 and so on.\n          *  @throw TypeMismatchError If this \\c LuaVariable tries to subscript\n          *         something that is not a table.\n          *  @throw LuaRunTimeError If something bad happens while executing the\n          *         function.\n          */\n         LuaValueList operator()(const LuaValueList& params);\n\n         /** Assuming that this \\c LuaVariable holds a function, calls this\n          *  function (without passing any parameter to it) and returns its\n          *  return values. Both \"pure\" Lua functions and functions written in\n          *  C/C++ and \"exported\" to Lua are supported.\n          *  @return All the values returned by the called function. The first\n          *          return value at index 0, the second at index 1 and so on.\n          *  @throw TypeMismatchError If this \\c LuaVariable tries to subscript\n          *         something that is not a table.\n          *  @throw LuaRunTimeError If something bad happens while executing the\n          *         function.\n          */\n         LuaValueList operator()();\n\n         /** Assuming that this \\c LuaVariable holds a function, calls this\n          *  function and returns its return values. Both \"pure\" Lua functions\n          *  and functions written in C/C++ and \"exported\" to Lua are supported.\n          *  @param param The one and only parameter to be passed to the\n          *         function being called\n          *  @return All the values returned by the called function. The first\n          *          return value at index 0, the second at index 1 and so on.\n          *  @throw TypeMismatchError If this \\c LuaVariable tries to subscript\n          *         something that is not a table.\n          *  @throw LuaRunTimeError If something bad happens while executing the\n          *         function.\n          */\n         LuaValueList operator() (const LuaValue& param);\n\n         /** Assuming that this \\c LuaVariable holds a function, calls this\n          *  function and returns its return values. Both \"pure\" Lua functions\n          *  and functions written in C/C++ and \"exported\" to Lua are supported.\n          *  @param param1 The first parameter to be passed to the function\n          *         being called\n          *  @param param2 The second parameter to be passed to the function\n          *         being called\n          *  @return All the values returned by the called function. The first\n          *          return value at index 0, the second at index 1 and so on.\n          *  @throw TypeMismatchError If this \\c LuaVariable tries to subscript\n          *         something that is not a table.\n          *  @throw LuaRunTimeError If something bad happens while executing the\n          *         function.\n          */\n         LuaValueList operator() (const LuaValue& param1,\n                                  const LuaValue& param2);\n\n         /** Assuming that this \\c LuaVariable holds a function, calls this\n          *  function and returns its return values. Both \"pure\" Lua functions\n          *  and functions written in C/C++ and \"exported\" to Lua are supported.\n          *  @param param1 The first parameter to be passed to the function\n          *         being called\n          *  @param param2 The second parameter to be passed to the function\n          *         being called\n          *  @param param3 The third parameter to be passed to the function\n          *         being called\n          *  @return All the values returned by the called function. The first\n          *          return value at index 0, the second at index 1 and so on.\n          *  @throw TypeMismatchError If this \\c LuaVariable tries to subscript\n          *         something that is not a table.\n          *  @throw LuaRunTimeError If something bad happens while executing the\n          *         function.\n          */\n         LuaValueList operator() (const LuaValue& param1,\n                                  const LuaValue& param2,\n                                  const LuaValue& param3);\n\n         /** Assuming that this \\c LuaVariable holds a function, calls this\n          *  function and returns its return values. Both \"pure\" Lua functions\n          *  and functions written in C/C++ and \"exported\" to Lua are supported.\n          *  @param param1 The first parameter to be passed to the function\n          *         being called\n          *  @param param2 The second parameter to be passed to the function\n          *         being called\n          *  @param param3 The third parameter to be passed to the function\n          *         being called\n          *  @param param4 The fourth parameter to be passed to the function\n          *         being called\n          *  @return All the values returned by the called function. The first\n          *          return value at index 0, the second at index 1 and so on.\n          *  @throw TypeMismatchError If this \\c LuaVariable tries to subscript\n          *         something that is not a table.\n          *  @throw LuaRunTimeError If something bad happens while executing the\n          *         function.\n          */\n         LuaValueList operator() (const LuaValue& param1,\n                                  const LuaValue& param2,\n                                  const LuaValue& param3,\n                                  const LuaValue& param4);\n\n         /** Assuming that this \\c LuaVariable holds a function, calls this\n          *  function and returns its return values. Both \"pure\" Lua functions\n          *  and functions written in C/C++ and \"exported\" to Lua are supported.\n          *  @param param1 The first parameter to be passed to the function\n          *         being called\n          *  @param param2 The second parameter to be passed to the function\n          *         being called\n          *  @param param3 The third parameter to be passed to the function\n          *         being called\n          *  @param param4 The fourth parameter to be passed to the function\n          *         being called\n          *  @param param5 The fifth parameter to be passed to the function\n          *         being called\n          *  @return All the values returned by the called function. The first\n          *          return value at index 0, the second at index 1 and so on.\n          *  @throw TypeMismatchError If this \\c LuaVariable tries to subscript\n          *         something that is not a table.\n          *  @throw LuaRunTimeError If something bad happens while executing the\n          *         function.\n          */\n         LuaValueList operator() (const LuaValue& param1,\n                                  const LuaValue& param2,\n                                  const LuaValue& param3,\n                                  const LuaValue& param4,\n                                  const LuaValue& param5);\n\n         /** Checks whether the value stored in this variable is equal to the\n          *  value at \\c rhs.\n          *  @param rhs The value against which the comparison will be done.\n          *  @return \\c true if this variable's value is equal to \\c rhs.\n          *          \\c false otherwise.\n          *  @throw TypeMismatchError If this \\c LuaVariable tries to subscript\n          *         something that is not a table.\n          */\n         bool operator== (const LuaValue& rhs) const\n         { return value() == rhs; }\n\n         /** Checks whether this \\c LuaVariable refers to the same variable as\n          *  \\c rhs.\n          *  @param rhs The variable against which the comparison will be done.\n          *  @return \\c true if both involved <tt>LuaVariable</tt>s refer to the\n          *          same variable. \\c false otherwise.\n          */\n         bool operator== (const LuaVariable& rhs) const\n         { return state_ == rhs.state_ && keys_ == rhs.keys_; }\n\n         /** Checks whether this \\c LuaVariable refers to a different variable\n          *  than \\c rhs.\n          *  @param rhs The variable against which the comparison will be done.\n          *  @return \\c false if both involved <tt>LuaVariable</tt>s refer to the\n          *          same variable. \\c true otherwise.\n          */\n         bool operator!= (const LuaVariable& rhs) const\n         { return state_ != rhs.state_ || keys_ != rhs.keys_; }\n\n         /// A sequence of keys, used to access nested tables.\n         typedef std::vector<LuaValue> KeyList;\n\n         /** Returns the sequence of keys used to reach this variable.\n          *  @note This method exists mostly to allow a nicer implementation of\n          *        other Diluculum features. Users aren't expected to call this.\n          */\n         const KeyList& getKeys() const { return keys_; }\n\n         /** Pushes into the Lua stack the table storing this variable. Now,\n          *  let's try to make this clearer... First, every Lua variable is\n          *  stored in a table (even global variables, because Lua stores them\n          *  in a \"table of globals\"). So, this method will find the table where\n          *  this variable is stored (traversing a sequence of nested tables, if\n          *  necessary), and push it onto the Lua stack (of the \\c state_ Lua\n          *  state).\n          *  @note This method exists mostly to allow a nicer implementation of\n          *        other Diluculum features. Users aren't expected to call this.\n          */\n         void pushLastTable();\n\n         /** Returns the LuaState in which this \\c LuaVariable lives.\n          *  @note This method exists mostly to allow a nicer implementation of\n          *        other Diluculum features. Users aren't expected to call this.\n          */\n         lua_State* getState() { return state_; }\n\n      private:\n\n         /** Constructs a \\c LuaVariable.\n          *   @note This is private because no one is expected to construct a\n          *         \\c LuaVariable directly. For Diluculum users, the only\n          *         allowed way to create a new \\c LuaVariable is by using\n          *         <tt>LuaState</tt>'s subscript operator.\n          *   @param state The <tt>lua_State*</tt> in which the variable\n          *          represented by this \\c LuaVariable resides.\n          *   @param key The \"key\" used to access the variable represented by\n          *          this \\c LuaVariable. This can be variable name (for the case\n          *          of a global variable) or a \"real\" key (when it is a field in\n          *          a possibly nested table).\n          *   @param predKeys The sequence of keys used to access the table that\n          *          contains the variable represented by this \\c LuaVariable.\n          *          For a global variable, this list will be empty. For a\n          *          variable stored in a possibly nested table, the list can be\n          *          arbitrarily long.\n          */\n         LuaVariable (lua_State* state, const LuaValue& key,\n                      const KeyList& predKeys = KeyList());\n\n         /** Pushes onto the Lua stack the value referenced by this\n          *  \\c LuaVariable.\n          *  @throw TypeMismatchError If this \\c LuaVariable tries to subscript\n          *         something that is not a table.\n          */\n         void pushTheReferencedValue() const;\n\n         /// The Lua state in which this \\c LuaVariable lives.\n         lua_State* state_;\n\n         /** The sequence of keys used to get to this variable. For a global\n          *  variable, this will consist of a single key; for variables inside\n          *  nested tables, this sequence can be arbitrarily long.\n          *  <p>Just to relate this with the parameters passed to the\n          *  constructor: this sequence equals to \\c predKeys parameter, with\n          *  the \\c key parameter appended to it.\n          */\n         KeyList keys_;\n   };\n\n} // namespace Diluculum\n\n#endif // _DILUCULUM_LUA_VARIABLE_HPP_\n"
  },
  {
    "path": "jni/highlight/include/Diluculum/LuaWrappers.hpp",
    "content": "/******************************************************************************\\\n* LuaWrappers.hpp                                                              *\n* Making C++ stuff accessible from Lua.                                        *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#ifndef _DILUCULUM_LUA_WRAPPERS_HPP_\n#define _DILUCULUM_LUA_WRAPPERS_HPP_\n\n#include <algorithm>\n#include <string>\n#include <boost/bind.hpp>\n#include <Diluculum/CppObject.hpp>\n#include <Diluculum/LuaExceptions.hpp>\n#include <Diluculum/LuaState.hpp>\n#include <Diluculum/LuaUtils.hpp>\n\n\nnamespace Diluculum\n{\n   namespace Impl\n   {\n      /** Calls \\c lua_error() with a proper error message. The error message is\n       *  composed of things that may help to find out what's the error, like\n       *  the function name.\n       *  @param ls The <tt>lua_State*</tt> on which the function will operate.\n       *  @param what A message to be included in the error message created by\n       *         this function.\n       *  @note This is not intended to be called by Diluculum users.\n       */\n      void ReportErrorFromCFunction (lua_State* ls, const::std::string& what);\n\n\n\n      /** Helper class, used by the \\c DILUCULUM_CLASS_METHOD() macro, as a\n       *  means register a method in the table that represents a class being\n       *  exported to Lua. Everything is done in the constructor. This is just\n       *  a way to get some code executed in a macro call that happens at the\n       *  global scope, outside of a function definition.\n       */\n      class ClassTableFiller\n      {\n         public:\n            /** Adds the function \\c func to the table \\c classTable, with a key\n             *  \\c name.\n             *  @param classTable The table representing the class being\n             *         exported to Lua.\n             *  @param name The name by which the method will be known in the\n             *         Lua side.\n             *  @param func The C function wrapping the method.\n             */\n            ClassTableFiller (Diluculum::LuaValueMap& classTable,\n                              const std::string& name,\n                              lua_CFunction func)\n            {\n               classTable[name] = func;\n            }\n      };\n   }\n}\n\n\n\n/** Returns the name of the wrapper function that is created by\n *  \\c DILUCULUM_WRAP_FUNCTION() for a given function name.\n *  @param FUNC The function whose wrapper name is desired.\n */\n#define DILUCULUM_WRAPPER_FUNCTION(FUNC)        \\\n   Diluculum__ ## FUNC ## __Wrapper_Function\n\n\n\n/** Creates a \\c lua_CFunction that wraps a function with the signature like the\n *  following one:\n *  <p><tt>Diluculum::LuaValueList Func (const Diluculum::LuaValueList& params)</tt>\n *  <p>Notice that, thanks to the use of <tt>Diluculum::LuaValueList</tt>s, the\n *  wrapped function can effectively take and return an arbitrary number of\n *  values.\n *  @note The name of the created wrapper function is a decorated version of the\n *        \\c FUNC parameter. The decoration scheme can be quite complicated and\n *        is subject to change in future releases of Diluculum, so don't try to\n *        use it directly. Use the \\c DILUCULUM_WRAPPER_FUNCTION() macro to\n *        obtain it instead.\n *  @note The proper way to report errors from the function being wrapped is by\n *        <tt>throw</tt>ing a \\c Diluculum::LuaError. The created wrapper\n *        function will handle these exceptions and \"translate\" them to a call\n *        to \\c lua_error().\n *  @see DILUCULUM_WRAPPER_FUNCTION() To find out the name of the created\n *       wrapper function.\n *  @param FUNC The function to be wrapped.\n */\n#define DILUCULUM_WRAP_FUNCTION(FUNC)                                         \\\nint DILUCULUM_WRAPPER_FUNCTION(FUNC) (lua_State* ls)                          \\\n{                                                                             \\\n   using std::for_each;                                                       \\\n   using boost::bind;                                                         \\\n   using Diluculum::PushLuaValue;                                             \\\n   using Diluculum::Impl::ReportErrorFromCFunction;                           \\\n                                                                              \\\n   try                                                                        \\\n   {                                                                          \\\n      /* Read parameters and empty the stack */                               \\\n      const int numParams = lua_gettop (ls);                                  \\\n      Diluculum::LuaValueList params;                                         \\\n      for (int i = 1; i <= numParams; ++i)                                    \\\n         params.push_back (Diluculum::ToLuaValue (ls, i));                    \\\n      lua_pop (ls, numParams);                                                \\\n                                                                              \\\n      /* Call the wrapped function */                                         \\\n      Diluculum::LuaValueList ret = FUNC (params);                            \\\n                                                                              \\\n      /* Push the return values and return */                                 \\\n      for_each (ret.begin(), ret.end(), bind (PushLuaValue, ls, _1));         \\\n                                                                              \\\n      return ret.size();                                                      \\\n   }                                                                          \\\n   catch (Diluculum::LuaError& e)                                             \\\n   {                                                                          \\\n      ReportErrorFromCFunction (ls, e.what());                                \\\n      return 0;                                                               \\\n   }                                                                          \\\n   catch(...)                                                                 \\\n   {                                                                          \\\n      ReportErrorFromCFunction (ls, \"Unknown exception caught by wrapper.\");  \\\n      return 0;                                                               \\\n   }                                                                          \\\n}\n\n\n\n/** Returns the name of the table that represent the class \\c CLASS.\n *  @note This is used internally. Users can ignore this macro.\n */\n#define DILUCULUM_CLASS_TABLE(CLASS) \\\nDiluculum__Class_Table__ ## CLASS\n\n\n\n/** Starts a block of class wrapping macro calls. This must be followed by calls\n *  to \\c DILUCULUM_CLASS_METHOD() for each method to be exported to Lua and a\n *  final call to \\c DILUCULUM_END_CLASS().\n *  @param CLASS The class being exported.\n */\n#define DILUCULUM_BEGIN_CLASS(CLASS)                                          \\\nnamespace                                                                     \\\n{                                                                             \\\n   /* the table representing the class */                                     \\\n   Diluculum::LuaValueMap DILUCULUM_CLASS_TABLE(CLASS);                       \\\n}                                                                             \\\n                                                                              \\\n/* The Constructor */                                                         \\\nint Diluculum__ ## CLASS ## __Constructor_Wrapper_Function (lua_State* ls)    \\\n{                                                                             \\\n   using Diluculum::PushLuaValue;                                             \\\n   using Diluculum::Impl::CppObject;                                          \\\n   using Diluculum::Impl::ReportErrorFromCFunction;                           \\\n                                                                              \\\n   try                                                                        \\\n   {                                                                          \\\n      /* Read parameters and empty the stack */                               \\\n      const int numParams = lua_gettop (ls);                                  \\\n      Diluculum::LuaValueList params;                                         \\\n      for (int i = 1; i <= numParams; ++i)                                    \\\n         params.push_back (Diluculum::ToLuaValue (ls, i));                    \\\n      lua_pop (ls, numParams);                                                \\\n                                                                              \\\n      /* Construct the object, wrap it in a userdata, and return */           \\\n      void* ud = lua_newuserdata (ls, sizeof(CppObject));                     \\\n      CppObject* cppObj = reinterpret_cast<CppObject*>(ud);                   \\\n      cppObj->ptr = new CLASS (params);                                       \\\n      cppObj->deleteMe = true;                                                \\\n                                                                              \\\n      lua_getglobal (ls, \"__Diluculum__Class_Metatables\");                    \\\n      lua_getfield (ls, -1, #CLASS);                                          \\\n      lua_setmetatable (ls, -3);                                              \\\n      lua_pop (ls, 1); /* pop the table of metatables */                      \\\n                                                                              \\\n      return 1;                                                               \\\n   }                                                                          \\\n   catch (Diluculum::LuaError& e)                                             \\\n   {                                                                          \\\n      ReportErrorFromCFunction (ls, e.what());                                \\\n      return 0;                                                               \\\n   }                                                                          \\\n   catch(...)                                                                 \\\n   {                                                                          \\\n      ReportErrorFromCFunction (ls, \"Unknown exception caught by wrapper.\");  \\\n      return 0;                                                               \\\n   }                                                                          \\\n}                                                                             \\\n                                                                              \\\n/* Destructor */                                                              \\\nint Diluculum__ ## CLASS ## __Destructor_Wrapper_Function (lua_State* ls)     \\\n{                                                                             \\\n   using Diluculum::Impl::CppObject;                                          \\\n                                                                              \\\n   CppObject* cppObj =                                                        \\\n      reinterpret_cast<CppObject*>(lua_touserdata (ls, -1));                  \\\n                                                                              \\\n   if (cppObj->deleteMe)                                                      \\\n   {                                                                          \\\n      cppObj->deleteMe = false; /* don't delete again when gc'ed! */          \\\n      CLASS* pObj = reinterpret_cast<CLASS*>(cppObj->ptr);                    \\\n      delete pObj;                                                            \\\n   }                                                                          \\\n                                                                              \\\n   return 0;                                                                  \\\n}\n\n\n\n/** Returns the name of the function used to wrap a method \\c METHOD of the\n *  class \\c CLASS.\n *  @note This is used internally. Users can ignore this macro.\n */\n#define DILUCULUM_METHOD_WRAPPER(CLASS, METHOD)                      \\\n   Diluculum__ ## CLASS ## __ ## METHOD ## __Method_Wrapper_Function\n\n\n\n/** Exports a given class' method. This macro must be called between calls to\n *  \\c DILUCULUM_BEGIN_CLASS() and \\c DILUCULUM_END_CLASS().\n *  @param CLASS The class whose method is being exported.\n *  @param METHOD The method being exported.\n */\n#define DILUCULUM_CLASS_METHOD(CLASS, METHOD)                                 \\\nint DILUCULUM_METHOD_WRAPPER(CLASS, METHOD) (lua_State* ls)                   \\\n{                                                                             \\\n   using std::for_each;                                                       \\\n   using boost::bind;                                                         \\\n   using Diluculum::PushLuaValue;                                             \\\n   using Diluculum::Impl::CppObject;                                          \\\n   using Diluculum::Impl::ReportErrorFromCFunction;                           \\\n                                                                              \\\n   try                                                                        \\\n   {                                                                          \\\n      /* Read parameters and empty the stack */                               \\\n      const int numParams = lua_gettop (ls);                                  \\\n      Diluculum::LuaValue ud = Diluculum::ToLuaValue (ls, 1);                 \\\n      Diluculum::LuaValueList params;                                         \\\n      for (int i = 2; i <= numParams; ++i)                                    \\\n         params.push_back (Diluculum::ToLuaValue (ls, i));                    \\\n      lua_pop (ls, numParams);                                                \\\n                                                                              \\\n      /* Get the object pointer and call the method */                        \\\n      CppObject* cppObj =                                                     \\\n         reinterpret_cast<CppObject*>(ud.asUserData().getData());             \\\n      CLASS* pObj = reinterpret_cast<CLASS*>(cppObj->ptr);                    \\\n                                                                              \\\n      Diluculum::LuaValueList ret = pObj->METHOD (params);                    \\\n                                                                              \\\n      /* Push the return values and return */                                 \\\n      for_each (ret.begin(), ret.end(), bind (PushLuaValue, ls, _1));         \\\n                                                                              \\\n      return ret.size();                                                      \\\n   }                                                                          \\\n   catch (Diluculum::LuaError& e)                                             \\\n   {                                                                          \\\n      ReportErrorFromCFunction (ls, e.what());                                \\\n      return 0;                                                               \\\n   }                                                                          \\\n   catch(...)                                                                 \\\n   {                                                                          \\\n      ReportErrorFromCFunction (ls, \"Unknown exception caught by wrapper.\");  \\\n      return 0;                                                               \\\n   }                                                                          \\\n}                                                                             \\\n                                                                              \\\nnamespace                                                                     \\\n{                                                                             \\\n   Diluculum::Impl::ClassTableFiller                                          \\\n      Diluculum__ ## CLASS ## _ ## METHOD ## __ ## Filler(                    \\\n         DILUCULUM_CLASS_TABLE(CLASS),                                        \\\n         #METHOD,                                                             \\\n         DILUCULUM_METHOD_WRAPPER(CLASS, METHOD));                            \\\n}\n\n\n\n/** Ends a block of class wrapping macro calls (which was opened by a call to\n *  \\c DILUCULUM_BEGIN_CLASS()).\n *  @param CLASS The class being exported.\n */\n#define DILUCULUM_END_CLASS(CLASS)                                            \\\n                                                                              \\\n/* The function used to register the class in a 'LuaState' */                 \\\nvoid Diluculum_Register_Class__ ## CLASS (Diluculum::LuaVariable className)   \\\n{                                                                             \\\n   Diluculum::LuaState ls (className.getState());                             \\\n                                                                              \\\n   if (ls[\"__Diluculum__Class_Metatables\"].value().type() == LUA_TNIL)        \\\n     ls[\"__Diluculum__Class_Metatables\"] = Diluculum::EmptyLuaValueMap;       \\\n                                                                              \\\n   static bool isInited = false;                                              \\\n   if (!isInited)                                                             \\\n   {                                                                          \\\n      isInited = true;                                                        \\\n                                                                              \\\n      DILUCULUM_CLASS_TABLE(CLASS)[\"classname\"] = #CLASS;                     \\\n                                                                              \\\n      DILUCULUM_CLASS_TABLE(CLASS)[\"new\"] =                                   \\\n         Diluculum__ ## CLASS ## __Constructor_Wrapper_Function;              \\\n                                                                              \\\n      DILUCULUM_CLASS_TABLE(CLASS)[\"delete\"] =                                \\\n         Diluculum__ ## CLASS ## __Destructor_Wrapper_Function;               \\\n                                                                              \\\n      DILUCULUM_CLASS_TABLE(CLASS)[\"__gc\"] =                                  \\\n         Diluculum__ ## CLASS ## __Destructor_Wrapper_Function;               \\\n                                                                              \\\n      DILUCULUM_CLASS_TABLE(CLASS)[\"__index\"] = DILUCULUM_CLASS_TABLE(CLASS); \\\n   }                                                                          \\\n                                                                              \\\n   className = DILUCULUM_CLASS_TABLE(CLASS);                                  \\\n                                                                              \\\n   ls[\"__Diluculum__Class_Metatables\"][#CLASS] =                              \\\n      DILUCULUM_CLASS_TABLE(CLASS);                                           \\\n} /* end of Diluculum_Register_Class__CLASS */\n\n\n\n/** Registers a class in a given \\c Diluculum::LuaState. The class must have\n *  been previously exported by calls to \\c DILUCULUM_BEGIN_CLASS(),\n *  \\c DILUCULUM_END_CLASS() and probably \\c DILUCULUM_CLASS_METHOD().\n *  @param LUA_VARIABLE The \\c Diluculum::LuaVariable that will store the class\n *         after this call.\n *  @param CLASS The class being registered.\n */\n#define DILUCULUM_REGISTER_CLASS(LUA_VARIABLE, CLASS)  \\\n   Diluculum_Register_Class__ ## CLASS (LUA_VARIABLE);\n\n\n\n/** Registers an object instantiated in C++ into a Lua state. This way, this\n *  object's methods can be called from Lua. The registered C++ object will\n *  \\e not be destroyed when the corresponding Lua object is garbage-collected.\n *  Destroying it is responsibility of the programmer on the C++ side.\n *  @param LUA_VARIABLE The \\c Diluculum::LuaVariable where the object will be\n *         stored. Notice that a \\c Diluculum::LuaVariable contains a reference\n *         to a <tt>lua_State*</tt>, so the Lua state in which the object will\n *         be stored is passed here, too, albeit indirectly.\n *  @param CLASS The class of the object being registered. This class must have\n *         been previously registered in the target Lua state with a call to the\n *         \\c DILUCULUM_REGISTER_CLASS() macro.\n *  @param OBJECT The object to be registered to the Lua state.\n */\n#define DILUCULUM_REGISTER_OBJECT(LUA_VARIABLE, CLASS, OBJECT)                \\\n{                                                                             \\\n   /* leave the table where 'OBJECT' is to be stored at the stack top */      \\\n   LUA_VARIABLE.pushLastTable();                                              \\\n                                                                              \\\n   /* push the field where the object will be stored */                       \\\n   Diluculum::PushLuaValue (LUA_VARIABLE.getState(),                          \\\n                            LUA_VARIABLE.getKeys().back());                   \\\n                                                                              \\\n   /* create the userdata, set its metatable */                               \\\n   void* ud = lua_newuserdata (LUA_VARIABLE.getState(),                       \\\n                               sizeof(Diluculum::Impl::CppObject));           \\\n                                                                              \\\n   Diluculum::Impl::CppObject* cppObj =                                       \\\n      reinterpret_cast<Diluculum::Impl::CppObject*>(ud);                      \\\n                                                                              \\\n   cppObj->ptr = &OBJECT;                                                     \\\n   cppObj->deleteMe = false;                                                  \\\n                                                                              \\\n   lua_getglobal (LUA_VARIABLE.getState(), \"__Diluculum__Class_Metatables\");  \\\n   lua_getfield (LUA_VARIABLE.getState(), -1, #CLASS);                        \\\n   lua_setmetatable (LUA_VARIABLE.getState(), -3);                            \\\n                                                                              \\\n   lua_pop (LUA_VARIABLE.getState(), 1); /* pop the table of metatables */    \\\n                                                                              \\\n   /* store the userdata */                                                   \\\n   lua_settable (LUA_VARIABLE.getState(), -3);                                \\\n}\n\n\n\n/** Starts a block declaring a dynamically loadable module, that is, a module\n *  that is expected to be compiled as a shared library. The block must be\n *  closed by a call to \\c DILUCULUM_END_MODULE() and contain some calls to\n *  macros like \\c DILUCULUM_MODULE_ADD_CLASS() and\n *  \\c DILUCULUM_MODULE_ADD_FUNCTION() in its body.\n *  <p>For those who know the way things happen in Lua, this block will provide\n *  a \\c luaopen_MyModule() function, which initializes the module when loaded.\n *  @param MODNAME The module name. This is how the module will be called in\n *         Lua. Also, the dynamic library to which the model will be compiled\n *         should be named like this (plus an extension like <tt>.so</tt> or\n *         <tt>.dll</tt>). Well, actually the rules for naming the module file\n *         are more complex than this. Check the\n *         <a href=\"http://www.lua.org/docs.html\">Lua manual</a> for the dirty\n *         details.\n */\n#define DILUCULUM_BEGIN_MODULE(MODNAME)                  \\\nextern \"C\" int luaopen_ ## MODNAME (lua_State *luaState) \\\n{                                                        \\\n   using Diluculum::LuaState;                            \\\n   using Diluculum::LuaVariable;                         \\\n   using Diluculum::EmptyLuaValueMap;                    \\\n   LuaState ls (luaState);                               \\\n                                                         \\\n   ls[#MODNAME] = EmptyLuaValueMap;                      \\\n   LuaVariable theModule = ls[#MODNAME];\n\n\n\n/** Adds a class to the module. Must be called between calls to\n *  \\c DILUCULUM_BEGIN_MODULE() and \\c DILUCULUM_END_MODULE().\n *  @param CLASS The name of the class being added, as it is known in the\n *         C++ side.\n *  @param LUACLASS The name by which the class will be known in the Lua side.\n */\n#define DILUCULUM_MODULE_ADD_CLASS(CLASS, LUACLASS)      \\\n   DILUCULUM_REGISTER_CLASS(theModule[LUACLASS], CLASS);\n\n\n\n/** Adds a function to the module. Must be called between calls to\n *  \\c DILUCULUM_BEGIN_MODULE() and \\c DILUCULUM_END_MODULE().\n *  @param CFUNC The name of the function being added, as it is known in the\n *         C++ side.\n *  @param LUAFUNC The name by which the function will be known in the Lua side.\n */\n#define DILUCULUM_MODULE_ADD_FUNCTION(CFUNC, LUAFUNC) \\\n   theModule[LUAFUNC] = CFUNC;\n\n\n\n/** Closes a block (started by \\c DILUCULUM_BEGIN_MODULE()) that defines a\n *  dynamically loadable Lua module.\n *  @bug In principle, this function should return one parameter: the table\n *       containing the module (this is more or less a convention). The current\n *       implementation not only ignores the convention: it also seems to return\n *       something invalid (function looks to be returning 1 without anything on\n *       the stack).\n */\n#define DILUCULUM_END_MODULE() \\\n   return 1;                   \\\n}\n\n#endif // _DILUCULUM_LUA_WRAPPERS_HPP_\n"
  },
  {
    "path": "jni/highlight/include/Diluculum/Types.hpp",
    "content": "/******************************************************************************\\\n* Types.hpp                                                                    *\n* The place for assorted types.                                                *\n*                                                                              *\n*                                                                              *\n* Copyright (C) 2005-2013 by Leandro Motta Barros.                             *\n*                                                                              *\n* Permission is hereby granted, free of charge, to any person obtaining a copy *\n* of this software and associated documentation files (the \"Software\"), to     *\n* deal in the Software without restriction, including without limitation the   *\n* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  *\n* sell copies of the Software, and to permit persons to whom the Software is   *\n* furnished to do so, subject to the following conditions:                     *\n*                                                                              *\n* The above copyright notice and this permission notice shall be included in   *\n* all copies or substantial portions of the Software.                          *\n*                                                                              *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR   *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,     *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER       *\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      *\n* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS *\n* IN THE SOFTWARE.                                                             *\n\\******************************************************************************/\n\n#ifndef _DILUCULUM_TYPES_HPP_\n#define _DILUCULUM_TYPES_HPP_\n\n#include <map>\n#include <vector>\n\n\nnamespace Diluculum\n{\n   class LuaValue;\n\n   /** A list of <tt>LuaValue</tt>s. Used, for example, to represent the return\n    *  value of a Lua function call. In this case, the first return value is\n    *  stored at the 0th \\c vector position, the second return value at the 1st\n    *  \\c vector position and so on.\n    */\n   typedef std::vector<LuaValue> LuaValueList;\n\n   /** Type mapping from <tt>LuaValue</tt>s to <tt>LuaValue</tt>s. Think of it\n    *  as a C++ approximation of a Lua table.\n    */\n   typedef std::map<LuaValue, LuaValue> LuaValueMap;\n\n} // namespace Diluculum\n\n#endif // _DILUCULUM_TYPES_HPP_\n"
  },
  {
    "path": "jni/highlight/include/ansigenerator.h",
    "content": "/***************************************************************************\n                         ansicode.h  -  description\n                             -------------------\n    begin                : Jul 5 2004\n    copyright            : (C) 2004-2007 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef ANSIGENERATOR_H\n#define ANSIGENERATOR_H\n\n#include <string>\n\n#include \"codegenerator.h\"\n#include \"charcodes.h\"\n#include \"version.h\"\n\nnamespace highlight\n{\n\n\t/**\n\t   \\brief This class generates ANSI escape sequences.\n\n\t   It contains information about the resulting document structure (document\n\t   header and footer), the colour system, white space handling and text\n\t   formatting attributes.\n\n\t* @author Andre Simon\n\t*/\n\n\tclass AnsiGenerator : public highlight::CodeGenerator\n\t{\n\t\tpublic:\n\t\t\tAnsiGenerator();\n\t\t\t~AnsiGenerator();\n\n\t\t\t/** prints document header\n\t\t\t */\n\t\t\tstring getHeader();\n\n\t\t\t/** Prints document footer*/\n\t\t\tstring getFooter();\n\n\t\t\t/** Prints document body*/\n\t\t\tvoid printBody();\n\n\t\tprivate:\n\n\t\t\t/** \\return escaped character*/\n\t\t\tvirtual string maskCharacter ( unsigned char );\n\n\n\t\t\t/** gibt ANSI-\"Tags\" zurueck (Farbindex+bold+kursiv)*/\n\t\t\tstring getOpenTag ( const string&font,\n\t\t\t                    const string&fgCol, const string&bgCol=\"\" );\n\n\t\t\t/** initialize tags in specific format according to colouring information provided in DucumentStyle */\n\t\t\tvoid initOutputTags();\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching sequence to begin a new element formatting*/\n\t\t\tstring getKeywordOpenTag ( unsigned int styleID );\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching  sequence to stop element formatting*/\n\t\t\tstring getKeywordCloseTag ( unsigned int styleID );\n\t};\n\n}\n#endif\n"
  },
  {
    "path": "jni/highlight/include/astyle/ASStreamIterator.h",
    "content": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *\n *   Copyright (C) 2006-2008 by Jim Pattee <jimp03@email.com>\n *   Copyright (C) 1998-2002 by Tal Davidson\n *   <http://www.gnu.org/licenses/lgpl-3.0.html>\n *\n *   This file is a part of Artistic Style - an indentation and\n *   reformatting tool for C, C++, C# and Java source files.\n *   <http://astyle.sourceforge.net>\n *\n *   Artistic Style is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU Lesser General Public License as published\n *   by the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   Artistic Style is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU Lesser General Public License for more details.\n *\n *   You should have received a copy of the GNU Lesser General Public License\n *   along with Artistic Style.  If not, see <http://www.gnu.org/licenses/>.\n *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n */\n\n\n#ifndef ASSTREAMITERATOR_H\n#define ASSTREAMITERATOR_H\n\n#include \"astyle.h\"\n#include <iostream>\n\nnamespace astyle\n{\n\nclass ASStreamIterator : public ASSourceIterator\n{\n\tpublic:\n\t\tbool checkForEmptyLine;\n\n\t\t// function declarations\n\t\tASStreamIterator(istream *in);\n\t\tvirtual ~ASStreamIterator();\n\t\tstring nextLine(bool emptyLineWasDeleted);\n\t\tstring peekNextLine();\n\t\tvoid peekReset();\n\t\tvoid saveLastInputLine();\n\n\t\t// inline functions\n\t\tbool compareToInputBuffer(const string &nextLine) const { return nextLine == prevBuffer; }\n\t\tconst char* getOutputEOL() const { return outputEOL; }\n\t\tbool hasMoreLines() const { return !inStream->eof(); }\n\t\t\n\t\tint getStreamLength() const { return 0; }\n\t\tstreamoff tellg() { return 0; }\n\n\tprivate:\n\t\tistream * inStream;          // pointer to the input stream\n\t\tstring buffer;         // current input line\n\t\tstring prevBuffer;     // previous input line\n\t\tint eolWindows;        // number of Windows line endings (CRLF)\n\t\tint eolLinux;          // number of Linux line endings (LF)\n\t\tint eolMacOld;         // number of old Mac line endings (CR)\n\t\tint peekStart;         // starting position for peekNextLine()\n\t\tchar outputEOL[4];     // output end of line char\n\t\tbool prevLineDeleted;  // the previous input line was deleted\n};\n\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/astyle/astyle.h",
    "content": "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *   astyle.h\n\n *   Copyright (C) 2014 by Jim Pattee\n *   <http://www.gnu.org/licenses/lgpl-3.0.html>\n *\n *   This file is a part of Artistic Style - an indentation and\n *   reformatting tool for C, C++, C# and Java source files.\n *   <http://astyle.sourceforge.net>\n *\n *   Artistic Style is free software: you can redistribute it and/or modify\n *   it under the terms of the GNU Lesser General Public License as published\n *   by the Free Software Foundation, either version 3 of the License, or\n *   (at your option) any later version.\n *\n *   Artistic Style is distributed in the hope that it will be useful,\n *   but WITHOUT ANY WARRANTY; without even the implied warranty of\n *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *   GNU Lesser General Public License for more details.\n *\n *   You should have received a copy of the GNU Lesser General Public License\n *   along with Artistic Style.  If not, see <http://www.gnu.org/licenses/>.\n *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n */\n\n#ifndef ASTYLE_H\n#define ASTYLE_H\n\n#ifdef __VMS\n\t#define __USE_STD_IOSTREAM 1\n\t#include <assert>\n#else\n\t#include <cassert>\n#endif\n\n#include <cctype>\n#include <iostream>\t\t// for cout\n#include <string>\n#include <vector>\n\n#ifdef __GNUC__\n\t#include <string.h>\t\t// need both string and string.h for GCC\n#endif\n\n#ifdef _MSC_VER\n\t#pragma warning(disable: 4996)  // secure version deprecation warnings\n\t#pragma warning(disable: 4267)  // 64 bit signed/unsigned loss of data\n#endif\n\n#ifdef __BORLANDC__\n\t#pragma warn -8004\t            // variable is assigned a value that is never used\n#endif\n\n#ifdef __INTEL_COMPILER\n\t#pragma warning(disable:  383)  // value copied to temporary, reference to temporary used\n\t#pragma warning(disable:  981)  // operands are evaluated in unspecified order\n#endif\n\n#ifdef __clang__\n\t#pragma clang diagnostic ignored \"-Wshorten-64-to-32\"\n#endif\n\nnamespace astyle {\n\nusing namespace std;\n\nenum FileType { C_TYPE = 0, JAVA_TYPE = 1, SHARP_TYPE = 2 };\n\n/* The enums below are not recognized by 'vectors' in Microsoft Visual C++\n   V5 when they are part of a namespace!!!  Use Visual C++ V6 or higher.\n*/\nenum FormatStyle\n{\n\tSTYLE_NONE,\n\tSTYLE_ALLMAN,\n\tSTYLE_JAVA,\n\tSTYLE_KR,\n\tSTYLE_STROUSTRUP,\n\tSTYLE_WHITESMITH,\n\tSTYLE_VTK,\n\tSTYLE_BANNER,\n\tSTYLE_GNU,\n\tSTYLE_LINUX,\n\tSTYLE_HORSTMANN,\n\tSTYLE_1TBS,\n\tSTYLE_GOOGLE,\n\tSTYLE_PICO,\n\tSTYLE_LISP\n};\n\nenum BracketMode\n{\n\tNONE_MODE,\n\tATTACH_MODE,\n\tBREAK_MODE,\n\tLINUX_MODE,\n\tSTROUSTRUP_MODE,\n\tRUN_IN_MODE\n};\n\nenum BracketType\n{\n\tNULL_TYPE = 0,\n\tNAMESPACE_TYPE = 1,\t\t\t// also a DEFINITION_TYPE\n\tCLASS_TYPE = 2,\t\t\t\t// also a DEFINITION_TYPE\n\tSTRUCT_TYPE = 4,\t\t\t// also a DEFINITION_TYPE\n\tINTERFACE_TYPE = 8,\t\t\t// also a DEFINITION_TYPE\n\tDEFINITION_TYPE = 16,\n\tCOMMAND_TYPE = 32,\n\tARRAY_NIS_TYPE = 64,\t\t// also an ARRAY_TYPE\n\tENUM_TYPE = 128,\t\t\t// also an ARRAY_TYPE\n\tINIT_TYPE = 256,\t\t\t// also an ARRAY_TYPE\n\tARRAY_TYPE = 512,\n\tEXTERN_TYPE = 1024,\t\t\t// extern \"C\", not a command type extern\n\tSINGLE_LINE_TYPE = 2048\n};\n\nenum MinConditional\n{\n\tMINCOND_ZERO,\n\tMINCOND_ONE,\n\tMINCOND_TWO,\n\tMINCOND_ONEHALF,\n\tMINCOND_END\n};\n\nenum ObjCColonPad\n{\n\tCOLON_PAD_NO_CHANGE,\n\tCOLON_PAD_NONE,\n\tCOLON_PAD_ALL,\n\tCOLON_PAD_AFTER,\n\tCOLON_PAD_BEFORE\n};\n\nenum PointerAlign\n{\n\tPTR_ALIGN_NONE,\n\tPTR_ALIGN_TYPE,\n\tPTR_ALIGN_MIDDLE,\n\tPTR_ALIGN_NAME\n};\n\nenum ReferenceAlign\n{\n\tREF_ALIGN_NONE = PTR_ALIGN_NONE,\n\tREF_ALIGN_TYPE = PTR_ALIGN_TYPE,\n\tREF_ALIGN_MIDDLE = PTR_ALIGN_MIDDLE,\n\tREF_ALIGN_NAME = PTR_ALIGN_NAME,\n\tREF_SAME_AS_PTR\n};\n\nenum FileEncoding\n{\n\tENCODING_8BIT,\n\tUTF_16BE,\n\tUTF_16LE,     // Windows default\n\tUTF_32BE,\n\tUTF_32LE\n};\n\nenum LineEndFormat\n{\n\tLINEEND_DEFAULT,\t// Use line break that matches most of the file\n\tLINEEND_WINDOWS,\n\tLINEEND_LINUX,\n\tLINEEND_MACOLD,\n\tLINEEND_CRLF = LINEEND_WINDOWS,\n\tLINEEND_LF   = LINEEND_LINUX,\n\tLINEEND_CR   = LINEEND_MACOLD\n};\n\n//-----------------------------------------------------------------------------\n// Class ASSourceIterator\n// A pure virtual class is used by ASFormatter and ASBeautifier instead of\n// ASStreamIterator. This allows programs using AStyle as a plug-in to define\n// their own ASStreamIterator. The ASStreamIterator class must inherit\n// this class.\n//-----------------------------------------------------------------------------\n\nclass ASSourceIterator\n{\n\tpublic:\n\t\tASSourceIterator() {}\n\t\tvirtual ~ASSourceIterator() {}\n\t\tvirtual int getStreamLength() const = 0;\n\t\tvirtual bool hasMoreLines() const = 0;\n\t\tvirtual string nextLine(bool emptyLineWasDeleted = false) = 0;\n\t\tvirtual string peekNextLine() = 0;\n\t\tvirtual void peekReset() = 0;\n\t\tvirtual streamoff tellg() = 0;\n};\n\n//-----------------------------------------------------------------------------\n// Class ASResource\n//-----------------------------------------------------------------------------\n\nclass ASResource\n{\n\tpublic:\n\t\tASResource() {}\n\t\tvirtual ~ASResource() {}\n\t\tvoid buildAssignmentOperators(vector<const string*>* assignmentOperators);\n\t\tvoid buildCastOperators(vector<const string*>* castOperators);\n\t\tvoid buildHeaders(vector<const string*>* headers, int fileType, bool beautifier = false);\n\t\tvoid buildIndentableMacros(vector<const pair<const string, const string>* >* indentableMacros);\n\t\tvoid buildIndentableHeaders(vector<const string*>* indentableHeaders);\n\t\tvoid buildNonAssignmentOperators(vector<const string*>* nonAssignmentOperators);\n\t\tvoid buildNonParenHeaders(vector<const string*>* nonParenHeaders, int fileType, bool beautifier = false);\n\t\tvoid buildOperators(vector<const string*>* operators, int fileType);\n\t\tvoid buildPreBlockStatements(vector<const string*>* preBlockStatements, int fileType);\n\t\tvoid buildPreCommandHeaders(vector<const string*>* preCommandHeaders, int fileType);\n\t\tvoid buildPreDefinitionHeaders(vector<const string*>* preDefinitionHeaders, int fileType);\n\n\tpublic:\n\t\tstatic const string AS_IF, AS_ELSE;\n\t\tstatic const string AS_DO, AS_WHILE;\n\t\tstatic const string AS_FOR;\n\t\tstatic const string AS_SWITCH, AS_CASE, AS_DEFAULT;\n\t\tstatic const string AS_TRY, AS_CATCH, AS_THROW, AS_THROWS, AS_FINALLY;\n\t\tstatic const string _AS_TRY, _AS_FINALLY, _AS_EXCEPT;\n\t\tstatic const string AS_PUBLIC, AS_PROTECTED, AS_PRIVATE;\n\t\tstatic const string AS_CLASS, AS_STRUCT, AS_UNION, AS_INTERFACE, AS_NAMESPACE;\n\t\tstatic const string AS_END;\n\t\tstatic const string AS_SELECTOR;\n\t\tstatic const string AS_EXTERN, AS_ENUM;\n\t\tstatic const string AS_STATIC, AS_CONST, AS_SEALED, AS_OVERRIDE, AS_VOLATILE, AS_NEW;\n\t\tstatic const string AS_NOEXCEPT, AS_INTERRUPT, AS_AUTORELEASEPOOL;\n\t\tstatic const string AS_WHERE, AS_LET, AS_SYNCHRONIZED;\n\t\tstatic const string AS_OPERATOR, AS_TEMPLATE;\n\t\tstatic const string AS_OPEN_BRACKET, AS_CLOSE_BRACKET;\n\t\tstatic const string AS_OPEN_LINE_COMMENT, AS_OPEN_COMMENT, AS_CLOSE_COMMENT;\n\t\tstatic const string AS_BAR_DEFINE, AS_BAR_INCLUDE, AS_BAR_IF, AS_BAR_EL, AS_BAR_ENDIF;\n\t\tstatic const string AS_RETURN;\n\t\tstatic const string AS_CIN, AS_COUT, AS_CERR;\n\t\tstatic const string AS_ASSIGN, AS_PLUS_ASSIGN, AS_MINUS_ASSIGN, AS_MULT_ASSIGN;\n\t\tstatic const string AS_DIV_ASSIGN, AS_MOD_ASSIGN, AS_XOR_ASSIGN, AS_OR_ASSIGN, AS_AND_ASSIGN;\n\t\tstatic const string AS_GR_GR_ASSIGN, AS_LS_LS_ASSIGN, AS_GR_GR_GR_ASSIGN, AS_LS_LS_LS_ASSIGN;\n\t\tstatic const string AS_GCC_MIN_ASSIGN, AS_GCC_MAX_ASSIGN;\n\t\tstatic const string AS_EQUAL, AS_PLUS_PLUS, AS_MINUS_MINUS, AS_NOT_EQUAL, AS_GR_EQUAL, AS_GR_GR_GR, AS_GR_GR;\n\t\tstatic const string AS_LS_EQUAL, AS_LS_LS_LS, AS_LS_LS;\n\t\tstatic const string AS_QUESTION_QUESTION, AS_LAMBDA;\n\t\tstatic const string AS_ARROW, AS_AND, AS_OR;\n\t\tstatic const string AS_SCOPE_RESOLUTION;\n\t\tstatic const string AS_PLUS, AS_MINUS, AS_MULT, AS_DIV, AS_MOD, AS_GR, AS_LS;\n\t\tstatic const string AS_NOT, AS_BIT_XOR, AS_BIT_OR, AS_BIT_AND, AS_BIT_NOT;\n\t\tstatic const string AS_QUESTION, AS_COLON, AS_SEMICOLON, AS_COMMA;\n\t\tstatic const string AS_ASM, AS__ASM__, AS_MS_ASM, AS_MS__ASM;\n\t\tstatic const string AS_QFOREACH, AS_QFOREVER, AS_FOREVER;\n\t\tstatic const string AS_FOREACH, AS_LOCK, AS_UNSAFE, AS_FIXED;\n\t\tstatic const string AS_GET, AS_SET, AS_ADD, AS_REMOVE;\n\t\tstatic const string AS_DELEGATE, AS_UNCHECKED;\n\t\tstatic const string AS_CONST_CAST, AS_DYNAMIC_CAST, AS_REINTERPRET_CAST, AS_STATIC_CAST;\n\t\tstatic const string AS_NS_DURING, AS_NS_HANDLER;\n};  // Class ASResource\n\n//-----------------------------------------------------------------------------\n// Class ASBase\n//-----------------------------------------------------------------------------\n\nclass ASBase\n{\n\tprivate:\n\t\t// all variables should be set by the \"init\" function\n\t\tint baseFileType;      // a value from enum FileType\n\n\tprotected:\n\t\tASBase() : baseFileType(C_TYPE) { }\n\t\tvirtual ~ASBase() {}\n\n\t\t// functions definitions are at the end of ASResource.cpp\n\t\tbool findKeyword(const string &line, int i, const string &keyword) const;\n\t\tstring getCurrentWord(const string &line, size_t index) const;\n\n\tprotected:\n\t\tvoid init(int fileTypeArg) { baseFileType = fileTypeArg; }\n\t\tbool isCStyle() const { return (baseFileType == C_TYPE); }\n\t\tbool isJavaStyle() const { return (baseFileType == JAVA_TYPE); }\n\t\tbool isSharpStyle() const { return (baseFileType == SHARP_TYPE); }\n\n\t\t// check if a specific character is a digit\n\t\t// NOTE: Visual C isdigit() gives assert error if char > 256\n\t\tbool isDigit(char ch) const {\n\t\t\treturn (ch >= '0' && ch <= '9');\n\t\t}\n\n\t\t// check if a specific character can be used in a legal variable/method/class name\n\t\tbool isLegalNameChar(char ch) const {\n\t\t\tif (isWhiteSpace(ch)) return false;\n\t\t\tif ((unsigned) ch > 127) return false;\n\t\t\treturn (isalnum((unsigned char)ch)\n\t\t\t        || ch == '.' || ch == '_'\n\t\t\t        || (isJavaStyle() && ch == '$')\n\t\t\t        || (isSharpStyle() && ch == '@'));  // may be used as a prefix\n\t\t}\n\n\t\t// check if a specific character can be part of a header\n\t\tbool isCharPotentialHeader(const string &line, size_t i) const {\n\t\t\tassert(!isWhiteSpace(line[i]));\n\t\t\tchar prevCh = ' ';\n\t\t\tif (i > 0) prevCh = line[i - 1];\n\t\t\tif (!isLegalNameChar(prevCh) && isLegalNameChar(line[i]))\n\t\t\t\treturn true;\n\t\t\treturn false;\n\t\t}\n\n\t\t// check if a specific character can be part of an operator\n\t\tbool isCharPotentialOperator(char ch) const {\n\t\t\tassert(!isWhiteSpace(ch));\n\t\t\tif ((unsigned) ch > 127) return false;\n\t\t\treturn (ispunct((unsigned char)ch)\n\t\t\t        && ch != '{' && ch != '}'\n\t\t\t        && ch != '(' && ch != ')'\n\t\t\t        && ch != '[' && ch != ']'\n\t\t\t        && ch != ';' && ch != ','\n\t\t\t        && ch != '#' && ch != '\\\\'\n\t\t\t        && ch != '\\'' && ch != '\\\"');\n\t\t}\n\n\t\t// check if a specific character is a whitespace character\n\t\tbool isWhiteSpace(char ch) const { return (ch == ' ' || ch == '\\t'); }\n\n\t\t// peek at the next unread character.\n\t\tchar peekNextChar(const string &line, int i) const {\n\t\t\tchar ch = ' ';\n\t\t\tsize_t peekNum = line.find_first_not_of(\" \\t\", i + 1);\n\t\t\tif (peekNum == string::npos)\n\t\t\t\treturn ch;\n\t\t\tch = line[peekNum];\n\t\t\treturn ch;\n\t\t}\n};  // Class ASBase\n\n//-----------------------------------------------------------------------------\n// Class ASBeautifier\n//-----------------------------------------------------------------------------\n\nclass ASBeautifier : protected ASResource, protected ASBase\n{\n\tpublic:\n\t\tASBeautifier();\n\t\tvirtual ~ASBeautifier();\n\t\tvirtual void init(ASSourceIterator* iter);\n\t\tvirtual string beautify(const string &line);\n\t\tvoid setCaseIndent(bool state);\n\t\tvoid setClassIndent(bool state);\n\t\tvoid setCStyle();\n\t\tvoid setDefaultTabLength();\n\t\tvoid setEmptyLineFill(bool state);\n\t\tvoid setForceTabXIndentation(int length);\n\t\tvoid setJavaStyle();\n\t\tvoid setLabelIndent(bool state);\n\t\tvoid setMaxInStatementIndentLength(int max);\n\t\tvoid setMinConditionalIndentOption(int min);\n\t\tvoid setMinConditionalIndentLength();\n\t\tvoid setModeManuallySet(bool state);\n\t\tvoid setModifierIndent(bool state);\n\t\tvoid setNamespaceIndent(bool state);\n\t\tvoid setAlignMethodColon(bool state);\n\t\tvoid setSharpStyle();\n\t\tvoid setSpaceIndentation(int length = 4);\n\t\tvoid setSwitchIndent(bool state);\n\t\tvoid setTabIndentation(int length = 4, bool forceTabs = false);\n\t\tvoid setPreprocDefineIndent(bool state);\n\t\tvoid setPreprocConditionalIndent(bool state);\n\t\tint  getBeautifierFileType() const;\n\t\tint  getFileType() const;\n\t\tint  getIndentLength(void) const;\n\t\tint  getTabLength(void) const;\n\t\tstring getIndentString(void) const;\n\t\tstring getNextWord(const string &line, size_t currPos) const;\n\t\tbool getBracketIndent(void) const;\n\t\tbool getBlockIndent(void) const;\n\t\tbool getCaseIndent(void) const;\n\t\tbool getClassIndent(void) const;\n\t\tbool getEmptyLineFill(void) const;\n\t\tbool getForceTabIndentation(void) const;\n\t\tbool getModeManuallySet(void) const;\n\t\tbool getModifierIndent(void) const;\n\t\tbool getNamespaceIndent(void) const;\n\t\tbool getPreprocDefineIndent(void) const;\n\t\tbool getSwitchIndent(void) const;\n\n\tprotected:\n\t\tvoid deleteBeautifierVectors();\n\t\tconst string* findHeader(const string &line, int i,\n\t\t                         const vector<const string*>* possibleHeaders) const;\n\t\tconst string* findOperator(const string &line, int i,\n\t\t                           const vector<const string*>* possibleOperators) const;\n\t\tint  getNextProgramCharDistance(const string &line, int i) const;\n\t\tint  indexOf(vector<const string*> &container, const string* element) const;\n\t\tvoid setBlockIndent(bool state);\n\t\tvoid setBracketIndent(bool state);\n\t\tvoid setBracketIndentVtk(bool state);\n\t\tstring extractPreprocessorStatement(const string &line) const;\n\t\tstring trim(const string &str) const;\n\t\tstring rtrim(const string &str) const;\n\n\t\t// variables set by ASFormatter - must be updated in activeBeautifierStack\n\t\tint  inLineNumber;\n\t\tint  horstmannIndentInStatement;\n\t\tint  nonInStatementBracket;\n\t\tbool lineCommentNoBeautify;\n\t\tbool isElseHeaderIndent;\n\t\tbool isCaseHeaderCommentIndent;\n\t\tbool isNonInStatementArray;\n\t\tbool isSharpAccessor;\n\t\tbool isSharpDelegate;\n\t\tbool isInExternC;\n\t\tbool isInBeautifySQL;\n\t\tbool isInIndentableStruct;\n\t\tbool isInIndentablePreproc;\n\n\tprivate:  // functions\n\t\tASBeautifier(const ASBeautifier &copy);\n\t\tASBeautifier &operator=(ASBeautifier &);       // not to be implemented\n\n\t\tvoid adjustParsedLineIndentation(size_t iPrelim, bool isInExtraHeaderIndent);\n\t\tvoid computePreliminaryIndentation();\n\t\tvoid parseCurrentLine(const string &line);\n\t\tvoid popLastInStatementIndent();\n\t\tvoid processPreprocessor(const string &preproc, const string &line);\n\t\tvoid registerInStatementIndent(const string &line, int i, int spaceIndentCount,\n\t\t                               int tabIncrementIn, int minIndent, bool updateParenStack);\n\t\tvoid registerInStatementIndentColon(const string &line, int i, int tabIncrementIn);\n\t\tvoid initVectors();\n\t\tvoid initTempStacksContainer(vector<vector<const string*>*>* &container,\n\t\t                             vector<vector<const string*>*>* value);\n\t\tvoid clearObjCMethodDefinitionAlignment();\n\t\tvoid deleteBeautifierContainer(vector<ASBeautifier*>* &container);\n\t\tvoid deleteTempStacksContainer(vector<vector<const string*>*>* &container);\n\t\tint  adjustIndentCountForBreakElseIfComments() const;\n\t\tint  computeObjCColonAlignment(string &line, int colonAlignPosition) const;\n\t\tint  convertTabToSpaces(int i, int tabIncrementIn) const;\n\t\tint  getInStatementIndentAssign(const string &line, size_t currPos) const;\n\t\tint  getInStatementIndentComma(const string &line, size_t currPos) const;\n\t\tbool isIndentedPreprocessor(const string &line, size_t currPos) const;\n\t\tbool isLineEndComment(const string &line, int startPos) const;\n\t\tbool isPreprocessorConditionalCplusplus(const string &line) const;\n\t\tbool isInPreprocessorUnterminatedComment(const string &line);\n\t\tbool statementEndsWithComma(const string &line, int index) const;\n\t\tstring &getIndentedLineReturn(string &newLine, const string &originalLine) const;\n\t\tstring preLineWS(int lineIndentCount, int lineSpaceIndentCount) const;\n\t\ttemplate<typename T> void deleteContainer(T &container);\n\t\ttemplate<typename T> void initContainer(T &container, T value);\n\t\tvector<vector<const string*>*>* copyTempStacks(const ASBeautifier &other) const;\n\t\tpair<int, int> computePreprocessorIndent();\n\n\tprivate:  // variables\n\t\tint beautifierFileType;\n\t\tvector<const string*>* headers;\n\t\tvector<const string*>* nonParenHeaders;\n\t\tvector<const string*>* preBlockStatements;\n\t\tvector<const string*>* preCommandHeaders;\n\t\tvector<const string*>* assignmentOperators;\n\t\tvector<const string*>* nonAssignmentOperators;\n\t\tvector<const string*>* indentableHeaders;\n\n\t\tvector<ASBeautifier*>* waitingBeautifierStack;\n\t\tvector<ASBeautifier*>* activeBeautifierStack;\n\t\tvector<int>* waitingBeautifierStackLengthStack;\n\t\tvector<int>* activeBeautifierStackLengthStack;\n\t\tvector<const string*>* headerStack;\n\t\tvector< vector<const string*>* >* tempStacks;\n\t\tvector<int>* blockParenDepthStack;\n\t\tvector<bool>* blockStatementStack;\n\t\tvector<bool>* parenStatementStack;\n\t\tvector<bool>* bracketBlockStateStack;\n\t\tvector<int>* inStatementIndentStack;\n\t\tvector<int>* inStatementIndentStackSizeStack;\n\t\tvector<int>* parenIndentStack;\n\t\tvector<pair<int, int> >* preprocIndentStack;\n\n\t\tASSourceIterator* sourceIterator;\n\t\tconst string* currentHeader;\n\t\tconst string* previousLastLineHeader;\n\t\tconst string* probationHeader;\n\t\tconst string* lastLineHeader;\n\t\tstring indentString;\n\t\tstring verbatimDelimiter;\n\t\tbool isInQuote;\n\t\tbool isInVerbatimQuote;\n\t\tbool haveLineContinuationChar;\n\t\tbool isInAsm;\n\t\tbool isInAsmOneLine;\n\t\tbool isInAsmBlock;\n\t\tbool isInComment;\n\t\tbool isInPreprocessorComment;\n\t\tbool isInHorstmannComment;\n\t\tbool isInCase;\n\t\tbool isInQuestion;\n\t\tbool isInStatement;\n\t\tbool isInHeader;\n\t\tbool isInTemplate;\n\t\tbool isInDefine;\n\t\tbool isInDefineDefinition;\n\t\tbool classIndent;\n\t\tbool isIndentModeOff;\n\t\tbool isInClassHeader;\t\t\t// is in a class before the opening bracket\n\t\tbool isInClassHeaderTab;\t\t// is in an indentable class header line\n\t\tbool isInClassInitializer;\t\t// is in a class after the ':' initializer\n\t\tbool isInClass;\t\t\t\t\t// is in a class after the opening bracket\n\t\tbool isInObjCMethodDefinition;\n\t\tbool isImmediatelyPostObjCMethodDefinition;\n\t\tbool isInIndentablePreprocBlock;\n\t\tbool isInObjCInterface;\n\t\tbool isInEnum;\n\t\tbool isInEnumTypeID;\n\t\tbool isInLet;\n\t\tbool modifierIndent;\n\t\tbool switchIndent;\n\t\tbool caseIndent;\n\t\tbool namespaceIndent;\n\t\tbool bracketIndent;\n\t\tbool bracketIndentVtk;\n\t\tbool blockIndent;\n\t\tbool labelIndent;\n\t\tbool shouldIndentPreprocDefine;\n\t\tbool isInConditional;\n\t\tbool isModeManuallySet;\n\t\tbool shouldForceTabIndentation;\n\t\tbool emptyLineFill;\n\t\tbool backslashEndsPrevLine;\n\t\tbool lineOpensWithLineComment;\n\t\tbool lineOpensWithComment;\n\t\tbool lineStartsInComment;\n\t\tbool blockCommentNoIndent;\n\t\tbool blockCommentNoBeautify;\n\t\tbool previousLineProbationTab;\n\t\tbool lineBeginsWithOpenBracket;\n\t\tbool lineBeginsWithCloseBracket;\n\t\tbool lineBeginsWithComma;\n\t\tbool lineIsCommentOnly;\n\t\tbool lineIsLineCommentOnly;\n\t\tbool shouldIndentBrackettedLine;\n\t\tbool isInSwitch;\n\t\tbool foundPreCommandHeader;\n\t\tbool foundPreCommandMacro;\n\t\tbool shouldAlignMethodColon;\n\t\tbool shouldIndentPreprocConditional;\n\t\tint  indentCount;\n\t\tint  spaceIndentCount;\n\t\tint  spaceIndentObjCMethodDefinition;\n\t\tint  colonIndentObjCMethodDefinition;\n\t\tint  lineOpeningBlocksNum;\n\t\tint  lineClosingBlocksNum;\n\t\tint  fileType;\n\t\tint  minConditionalOption;\n\t\tint  minConditionalIndent;\n\t\tint  parenDepth;\n\t\tint  indentLength;\n\t\tint  tabLength;\n\t\tint  blockTabCount;\n\t\tint  maxInStatementIndent;\n\t\tint  classInitializerIndents;\n\t\tint  templateDepth;\n\t\tint  squareBracketCount;\n\t\tint  prevFinalLineSpaceIndentCount;\n\t\tint  prevFinalLineIndentCount;\n\t\tint  defineIndentCount;\n\t\tint  preprocBlockIndent;\n\t\tchar quoteChar;\n\t\tchar prevNonSpaceCh;\n\t\tchar currentNonSpaceCh;\n\t\tchar currentNonLegalCh;\n\t\tchar prevNonLegalCh;\n};  // Class ASBeautifier\n\n//-----------------------------------------------------------------------------\n// Class ASEnhancer\n//-----------------------------------------------------------------------------\n\nclass ASEnhancer : protected ASBase\n{\n\tpublic:  // functions\n\t\tASEnhancer();\n\t\tvirtual ~ASEnhancer();\n\t\tvoid init(int, int, int, bool, bool, bool, bool, bool, bool, bool,\n\t\t          vector<const pair<const string, const string>* >*);\n\t\tvoid enhance(string &line, bool isInNamespace, bool isInPreprocessor, bool isInSQL);\n\n\tprivate:  // functions\n\t\tvoid    convertForceTabIndentToSpaces(string  &line) const;\n\t\tvoid    convertSpaceIndentToForceTab(string &line) const;\n\t\tsize_t  findCaseColon(string  &line, size_t caseIndex) const;\n\t\tint     indentLine(string  &line, int indent) const;\n\t\tbool    isBeginDeclareSectionSQL(string  &line, size_t index) const;\n\t\tbool    isEndDeclareSectionSQL(string  &line, size_t index) const;\n\t\tbool    isOneLineBlockReached(string &line, int startChar) const;\n\t\tvoid    parseCurrentLine(string &line, bool isInPreprocessor, bool isInSQL);\n\t\tsize_t  processSwitchBlock(string  &line, size_t index);\n\t\tint     unindentLine(string  &line, int unindent) const;\n\n\tprivate:\n\t\t// options from command line or options file\n\t\tint  indentLength;\n\t\tint  tabLength;\n\t\tbool useTabs;\n\t\tbool forceTab;\n\t\tbool namespaceIndent;\n\t\tbool caseIndent;\n\t\tbool preprocBlockIndent;\n\t\tbool preprocDefineIndent;\n\t\tbool emptyLineFill;\n\n\t\t// parsing variables\n\t\tint  lineNumber;\n\t\tbool isInQuote;\n\t\tbool isInComment;\n\t\tchar quoteChar;\n\n\t\t// unindent variables\n\t\tint  bracketCount;\n\t\tint  switchDepth;\n\t\tint  eventPreprocDepth;\n\t\tbool lookingForCaseBracket;\n\t\tbool unindentNextLine;\n\t\tbool shouldUnindentLine;\n\t\tbool shouldUnindentComment;\n\n\t\t// struct used by ParseFormattedLine function\n\t\t// contains variables used to unindent the case blocks\n\t\tstruct switchVariables\n\t\t{\n\t\t\tint  switchBracketCount;\n\t\t\tint  unindentDepth;\n\t\t\tbool unindentCase;\n\t\t};\n\n\t\tswitchVariables sw;                      // switch variables struct\n\t\tvector<switchVariables> switchStack;     // stack vector of switch variables\n\n\t\t// event table variables\n\t\tbool nextLineIsEventIndent;             // begin event table indent is reached\n\t\tbool isInEventTable;                    // need to indent an event table\n\t\tvector<const pair<const string, const string>* >* indentableMacros;\n\n\t\t// SQL variables\n\t\tbool nextLineIsDeclareIndent;           // begin declare section indent is reached\n\t\tbool isInDeclareSection;                // need to indent a declare section\n\n};  // Class ASEnhancer\n\n//-----------------------------------------------------------------------------\n// Class ASFormatter\n//-----------------------------------------------------------------------------\n\nclass ASFormatter : public ASBeautifier\n{\n\tpublic:\t// functions\n\t\tASFormatter();\n\t\tvirtual ~ASFormatter();\n\t\tvirtual void init(ASSourceIterator* iter);\n\t\tvirtual bool hasMoreLines() const;\n\t\tvirtual string nextLine();\n\t\tLineEndFormat getLineEndFormat() const;\n\t\tbool getIsLineReady() const;\n\t\tvoid setFormattingStyle(FormatStyle style);\n\t\tvoid setAddBracketsMode(bool state);\n\t\tvoid setAddOneLineBracketsMode(bool state);\n\t\tvoid setRemoveBracketsMode(bool state);\n\t\tvoid setAttachClass(bool state);\n\t\tvoid setAttachExternC(bool state);\n\t\tvoid setAttachNamespace(bool state);\n\t\tvoid setAttachInline(bool state);\n\t\tvoid setBracketFormatMode(BracketMode mode);\n\t\tvoid setBreakAfterMode(bool state);\n\t\tvoid setBreakClosingHeaderBracketsMode(bool state);\n\t\tvoid setBreakBlocksMode(bool state);\n\t\tvoid setBreakClosingHeaderBlocksMode(bool state);\n\t\tvoid setBreakElseIfsMode(bool state);\n\t\tvoid setBreakOneLineBlocksMode(bool state);\n\t\tvoid setMethodPrefixPaddingMode(bool state);\n\t\tvoid setMethodPrefixUnPaddingMode(bool state);\n\t\tvoid setCloseTemplatesMode(bool state);\n\t\tvoid setDeleteEmptyLinesMode(bool state);\n\t\tvoid setIndentCol1CommentsMode(bool state);\n\t\tvoid setLineEndFormat(LineEndFormat fmt);\n\t\tvoid setMaxCodeLength(int max);\n\t\tvoid setObjCColonPaddingMode(ObjCColonPad mode);\n\t\tvoid setOperatorPaddingMode(bool mode);\n\t\tvoid setParensOutsidePaddingMode(bool mode);\n\t\tvoid setParensFirstPaddingMode(bool mode);\n\t\tvoid setParensInsidePaddingMode(bool mode);\n\t\tvoid setParensHeaderPaddingMode(bool mode);\n\t\tvoid setParensUnPaddingMode(bool state);\n\t\tvoid setPointerAlignment(PointerAlign alignment);\n\t\tvoid setPreprocBlockIndent(bool state);\n\t\tvoid setReferenceAlignment(ReferenceAlign alignment);\n\t\tvoid setSingleStatementsMode(bool state);\n\t\tvoid setStripCommentPrefix(bool state);\n\t\tvoid setTabSpaceConversionMode(bool state);\n\t\tsize_t getChecksumIn() const;\n\t\tsize_t getChecksumOut() const;\n\t\tint  getChecksumDiff() const;\n\t\tint  getFormatterFileType() const;\n\n\tprivate:  // functions\n\t\tASFormatter(const ASFormatter &copy);       // copy constructor not to be implemented\n\t\tASFormatter &operator=(ASFormatter &);      // assignment operator not to be implemented\n\t\ttemplate<typename T> void deleteContainer(T &container);\n\t\ttemplate<typename T> void initContainer(T &container, T value);\n\t\tchar peekNextChar() const;\n\t\tBracketType getBracketType();\n\t\tbool adjustChecksumIn(int adjustment);\n\t\tbool computeChecksumIn(const string &currentLine_);\n\t\tbool computeChecksumOut(const string &beautifiedLine);\n\t\tbool addBracketsToStatement();\n\t\tbool removeBracketsFromStatement();\n\t\tbool commentAndHeaderFollows();\n\t\tbool getNextChar();\n\t\tbool getNextLine(bool emptyLineWasDeleted = false);\n\t\tbool isArrayOperator() const;\n\t\tbool isBeforeComment() const;\n\t\tbool isBeforeAnyComment() const;\n\t\tbool isBeforeAnyLineEndComment(int startPos) const;\n\t\tbool isBeforeMultipleLineEndComments(int startPos) const;\n\t\tbool isBracketType(BracketType a, BracketType b) const;\n\t\tbool isClassInitializer() const;\n\t\tbool isClosingHeader(const string* header) const;\n\t\tbool isCurrentBracketBroken() const;\n\t\tbool isDereferenceOrAddressOf() const;\n\t\tbool isExecSQL(string  &line, size_t index) const;\n\t\tbool isEmptyLine(const string &line) const;\n\t\tbool isExternC() const;\n\t\tbool isNextWordSharpNonParenHeader(int startChar) const;\n\t\tbool isNonInStatementArrayBracket() const;\n\t\tbool isOkToSplitFormattedLine();\n\t\tbool isPointerOrReference() const;\n\t\tbool isPointerOrReferenceCentered() const;\n\t\tbool isPointerOrReferenceVariable(string &word) const;\n\t\tbool isSharpStyleWithParen(const string* header) const;\n\t\tbool isStructAccessModified(string  &firstLine, size_t index) const;\n\t\tbool isIndentablePreprocessorBlock(string  &firstLine, size_t index);\n\t\tbool isUnaryOperator() const;\n\t\tbool isUniformInitializerBracket() const;\n\t\tbool isImmediatelyPostCast() const;\n\t\tbool isInExponent() const;\n\t\tbool isInSwitchStatement() const;\n\t\tbool isNextCharOpeningBracket(int startChar) const;\n\t\tbool isOkToBreakBlock(BracketType bracketType) const;\n\t\tbool isOperatorPaddingDisabled() const;\n\t\tbool pointerSymbolFollows() const;\n\t\tint  getCurrentLineCommentAdjustment();\n\t\tint  getNextLineCommentAdjustment();\n\t\tint  isOneLineBlockReached(string &line, int startChar) const;\n\t\tvoid adjustComments();\n\t\tvoid appendChar(char ch, bool canBreakLine);\n\t\tvoid appendCharInsideComments();\n\t\tvoid appendOperator(const string &sequence, bool canBreakLine = true);\n\t\tvoid appendSequence(const string &sequence, bool canBreakLine = true);\n\t\tvoid appendSpacePad();\n\t\tvoid appendSpaceAfter();\n\t\tvoid breakLine(bool isSplitLine = false);\n\t\tvoid buildLanguageVectors();\n\t\tvoid updateFormattedLineSplitPoints(char appendedChar);\n\t\tvoid updateFormattedLineSplitPointsOperator(const string &sequence);\n\t\tvoid checkIfTemplateOpener();\n\t\tvoid clearFormattedLineSplitPoints();\n\t\tvoid convertTabToSpaces();\n\t\tvoid deleteContainer(vector<BracketType>* &container);\n\t\tvoid formatArrayRunIn();\n\t\tvoid formatRunIn();\n\t\tvoid formatArrayBrackets(BracketType bracketType, bool isOpeningArrayBracket);\n\t\tvoid formatClosingBracket(BracketType bracketType);\n\t\tvoid formatCommentBody();\n\t\tvoid formatCommentOpener();\n\t\tvoid formatCommentCloser();\n\t\tvoid formatLineCommentBody();\n\t\tvoid formatLineCommentOpener();\n\t\tvoid formatOpeningBracket(BracketType bracketType);\n\t\tvoid formatQuoteBody();\n\t\tvoid formatQuoteOpener();\n\t\tvoid formatPointerOrReference();\n\t\tvoid formatPointerOrReferenceCast();\n\t\tvoid formatPointerOrReferenceToMiddle();\n\t\tvoid formatPointerOrReferenceToName();\n\t\tvoid formatPointerOrReferenceToType();\n\t\tvoid fixOptionVariableConflicts();\n\t\tvoid goForward(int i);\n\t\tvoid isLineBreakBeforeClosingHeader();\n\t\tvoid initContainer(vector<BracketType>* &container, vector<BracketType>* value);\n\t\tvoid initNewLine();\n\t\tvoid padObjCMethodColon();\n\t\tvoid padOperators(const string* newOperator);\n\t\tvoid padParens();\n\t\tvoid processPreprocessor();\n\t\tvoid resetEndOfStatement();\n\t\tvoid setAttachClosingBracketMode(bool state);\n\t\tvoid setBreakBlocksVariables();\n\t\tvoid stripCommentPrefix();\n\t\tvoid testForTimeToSplitFormattedLine();\n\t\tvoid trimContinuationLine();\n\t\tvoid updateFormattedLineSplitPointsPointerOrReference(size_t index);\n\t\tsize_t findFormattedLineSplitPoint() const;\n\t\tsize_t findNextChar(string &line, char searchChar, int searchStart = 0);\n\t\tconst string* checkForHeaderFollowingComment(const string &firstLine) const;\n\t\tconst string* getFollowingOperator() const;\n\t\tstring getPreviousWord(const string &line, int currPos) const;\n\t\tstring peekNextText(const string &firstLine, bool endOnEmptyLine = false, bool shouldReset = false) const;\n\n\tprivate:  // variables\n\t\tint formatterFileType;\n\t\tvector<const string*>* headers;\n\t\tvector<const string*>* nonParenHeaders;\n\t\tvector<const string*>* preDefinitionHeaders;\n\t\tvector<const string*>* preCommandHeaders;\n\t\tvector<const string*>* operators;\n\t\tvector<const string*>* assignmentOperators;\n\t\tvector<const string*>* castOperators;\n\t\tvector<const pair<const string, const string>* >* indentableMacros;\t// for ASEnhancer\n\n\t\tASSourceIterator* sourceIterator;\n\t\tASEnhancer* enhancer;\n\n\t\tvector<const string*>* preBracketHeaderStack;\n\t\tvector<BracketType>* bracketTypeStack;\n\t\tvector<int>* parenStack;\n\t\tvector<bool>* structStack;\n\t\tvector<bool>* questionMarkStack;\n\n\t\tstring currentLine;\n\t\tstring formattedLine;\n\t\tstring readyFormattedLine;\n\t\tstring verbatimDelimiter;\n\t\tconst string* currentHeader;\n\t\tconst string* previousOperator;    // used ONLY by pad-oper\n\t\tchar currentChar;\n\t\tchar previousChar;\n\t\tchar previousNonWSChar;\n\t\tchar previousCommandChar;\n\t\tchar quoteChar;\n\t\tstreamoff preprocBlockEnd;\n\t\tint  charNum;\n\t\tint  horstmannIndentChars;\n\t\tint  nextLineSpacePadNum;\n\t\tint  preprocBracketTypeStackSize;\n\t\tint  spacePadNum;\n\t\tint  tabIncrementIn;\n\t\tint  templateDepth;\n\t\tint  squareBracketCount;\n\t\tsize_t checksumIn;\n\t\tsize_t checksumOut;\n\t\tsize_t currentLineFirstBracketNum;\t// first bracket location on currentLine\n\t\tsize_t formattedLineCommentNum;     // comment location on formattedLine\n\t\tsize_t leadingSpaces;\n\t\tsize_t maxCodeLength;\n\n\t\t// possible split points\n\t\tsize_t maxSemi;\t\t\t// probably a 'for' statement\n\t\tsize_t maxAndOr;\t\t// probably an 'if' statement\n\t\tsize_t maxComma;\n\t\tsize_t maxParen;\n\t\tsize_t maxWhiteSpace;\n\t\tsize_t maxSemiPending;\n\t\tsize_t maxAndOrPending;\n\t\tsize_t maxCommaPending;\n\t\tsize_t maxParenPending;\n\t\tsize_t maxWhiteSpacePending;\n\n\t\tsize_t previousReadyFormattedLineLength;\n\t\tFormatStyle formattingStyle;\n\t\tBracketMode bracketFormatMode;\n\t\tBracketType previousBracketType;\n\t\tPointerAlign pointerAlignment;\n\t\tReferenceAlign referenceAlignment;\n\t\tObjCColonPad objCColonPadMode;\n\t\tLineEndFormat lineEnd;\n\t\tbool isVirgin;\n\t\tbool shouldPadOperators;\n\t\tbool shouldPadParensOutside;\n\t\tbool shouldPadFirstParen;\n\t\tbool shouldPadParensInside;\n\t\tbool shouldPadHeader;\n\t\tbool shouldStripCommentPrefix;\n\t\tbool shouldUnPadParens;\n\t\tbool shouldConvertTabs;\n\t\tbool shouldIndentCol1Comments;\n\t\tbool shouldIndentPreprocBlock;\n\t\tbool shouldCloseTemplates;\n\t\tbool shouldAttachExternC;\n\t\tbool shouldAttachNamespace;\n\t\tbool shouldAttachClass;\n\t\tbool shouldAttachInline;\n\t\tbool isInLineComment;\n\t\tbool isInComment;\n\t\tbool isInCommentStartLine;\n\t\tbool noTrimCommentContinuation;\n\t\tbool isInPreprocessor;\n\t\tbool isInPreprocessorBeautify;\n\t\tbool isInTemplate;\n\t\tbool doesLineStartComment;\n\t\tbool lineEndsInCommentOnly;\n\t\tbool lineIsCommentOnly;\n\t\tbool lineIsLineCommentOnly;\n\t\tbool lineIsEmpty;\n\t\tbool isImmediatelyPostCommentOnly;\n\t\tbool isImmediatelyPostEmptyLine;\n\t\tbool isInClassInitializer;\n\t\tbool isInQuote;\n\t\tbool isInVerbatimQuote;\n\t\tbool haveLineContinuationChar;\n\t\tbool isInQuoteContinuation;\n\t\tbool isHeaderInMultiStatementLine;\n\t\tbool isSpecialChar;\n\t\tbool isNonParenHeader;\n\t\tbool foundQuestionMark;\n\t\tbool foundPreDefinitionHeader;\n\t\tbool foundNamespaceHeader;\n\t\tbool foundClassHeader;\n\t\tbool foundStructHeader;\n\t\tbool foundInterfaceHeader;\n\t\tbool foundPreCommandHeader;\n\t\tbool foundPreCommandMacro;\n\t\tbool foundCastOperator;\n\t\tbool isInLineBreak;\n\t\tbool endOfAsmReached;\n\t\tbool endOfCodeReached;\n\t\tbool lineCommentNoIndent;\n\t\tbool isFormattingModeOff;\n\t\tbool isInEnum;\n\t\tbool isInExecSQL;\n\t\tbool isInAsm;\n\t\tbool isInAsmOneLine;\n\t\tbool isInAsmBlock;\n\t\tbool isLineReady;\n\t\tbool elseHeaderFollowsComments;\n\t\tbool caseHeaderFollowsComments;\n\t\tbool isPreviousBracketBlockRelated;\n\t\tbool isInPotentialCalculation;\n\t\tbool isCharImmediatelyPostComment;\n\t\tbool isPreviousCharPostComment;\n\t\tbool isCharImmediatelyPostLineComment;\n\t\tbool isCharImmediatelyPostOpenBlock;\n\t\tbool isCharImmediatelyPostCloseBlock;\n\t\tbool isCharImmediatelyPostTemplate;\n\t\tbool isCharImmediatelyPostReturn;\n\t\tbool isCharImmediatelyPostThrow;\n\t\tbool isCharImmediatelyPostOperator;\n\t\tbool isCharImmediatelyPostPointerOrReference;\n\t\tbool isInObjCMethodDefinition;\n\t\tbool isInObjCInterface;\n\t\tbool isInObjCSelector;\n\t\tbool breakCurrentOneLineBlock;\n\t\tbool shouldRemoveNextClosingBracket;\n\t\tbool isInHorstmannRunIn;\n\t\tbool currentLineBeginsWithBracket;\n\t\tbool attachClosingBracketMode;\n\t\tbool shouldBreakOneLineBlocks;\n\t\tbool shouldReparseCurrentChar;\n\t\tbool shouldBreakOneLineStatements;\n\t\tbool shouldBreakClosingHeaderBrackets;\n\t\tbool shouldBreakElseIfs;\n\t\tbool shouldBreakLineAfterLogical;\n\t\tbool shouldAddBrackets;\n\t\tbool shouldAddOneLineBrackets;\n\t\tbool shouldRemoveBrackets;\n\t\tbool shouldPadMethodColon;\n\t\tbool shouldPadMethodPrefix;\n\t\tbool shouldUnPadMethodPrefix;\n\t\tbool shouldDeleteEmptyLines;\n\t\tbool needHeaderOpeningBracket;\n\t\tbool shouldBreakLineAtNextChar;\n\t\tbool shouldKeepLineUnbroken;\n\t\tbool passedSemicolon;\n\t\tbool passedColon;\n\t\tbool isImmediatelyPostNonInStmt;\n\t\tbool isCharImmediatelyPostNonInStmt;\n\t\tbool isImmediatelyPostComment;\n\t\tbool isImmediatelyPostLineComment;\n\t\tbool isImmediatelyPostEmptyBlock;\n\t\tbool isImmediatelyPostPreprocessor;\n\t\tbool isImmediatelyPostReturn;\n\t\tbool isImmediatelyPostThrow;\n\t\tbool isImmediatelyPostOperator;\n\t\tbool isImmediatelyPostTemplate;\n\t\tbool isImmediatelyPostPointerOrReference;\n\t\tbool shouldBreakBlocks;\n\t\tbool shouldBreakClosingHeaderBlocks;\n\t\tbool isPrependPostBlockEmptyLineRequested;\n\t\tbool isAppendPostBlockEmptyLineRequested;\n\t\tbool isIndentableProprocessor;\n\t\tbool isIndentableProprocessorBlock;\n\t\tbool prependEmptyLine;\n\t\tbool appendOpeningBracket;\n\t\tbool foundClosingHeader;\n\t\tbool isInHeader;\n\t\tbool isImmediatelyPostHeader;\n\t\tbool isInCase;\n\t\tbool isFirstPreprocConditional;\n\t\tbool processedFirstConditional;\n\t\tbool isJavaStaticConstructor;\n\n\tprivate:  // inline functions\n\t\t// append the CURRENT character (curentChar) to the current formatted line.\n\t\tvoid appendCurrentChar(bool canBreakLine = true) {\n\t\t\tappendChar(currentChar, canBreakLine);\n\t\t}\n\n\t\t// check if a specific sequence exists in the current placement of the current line\n\t\tbool isSequenceReached(const char* sequence) const {\n\t\t\treturn currentLine.compare(charNum, strlen(sequence), sequence) == 0;\n\t\t}\n\n\t\t// call ASBase::findHeader for the current character\n\t\tconst string* findHeader(const vector<const string*>* headers_) {\n\t\t\treturn ASBeautifier::findHeader(currentLine, charNum, headers_);\n\t\t}\n\n\t\t// call ASBase::findOperator for the current character\n\t\tconst string* findOperator(const vector<const string*>* headers_) {\n\t\t\treturn ASBeautifier::findOperator(currentLine, charNum, headers_);\n\t\t}\n};  // Class ASFormatter\n\n\n//-----------------------------------------------------------------------------\n// astyle namespace global declarations\n//-----------------------------------------------------------------------------\n// sort comparison functions for ASResource\nbool sortOnLength(const string* a, const string* b);\nbool sortOnName(const string* a, const string* b);\n\n}   // end of astyle namespace\n\n// end of astyle namespace  --------------------------------------------------\n\n#endif // closes ASTYLE_H\n"
  },
  {
    "path": "jni/highlight/include/bbcodegenerator.h",
    "content": "/***************************************************************************\n                         bbcodegenerator.h  -  description\n                             -------------------\n    begin                : Jul 20 2009\n    copyright            : (C) 2004-2007 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef BBCODEGENERATOR_H\n#define BBCODEGENERATOR_H\n\n#include <string>\n\n#include \"codegenerator.h\"\n#include \"charcodes.h\"\n#include \"version.h\"\n\nnamespace highlight\n{\n\n\t/**\n\t   \\brief This class generates BBCode.\n\n\t   It contains information about the resulting document structure (document\n\t   header and footer), the colour system, white space handling and text\n\t   formatting attributes.\n\n\t* @author Andre Simon\n\t*/\n\n\tclass BBCodeGenerator : public highlight::CodeGenerator\n\t{\n\t\tpublic:\n\t\t\tBBCodeGenerator();\n\t\t\t~BBCodeGenerator();\n\n\t\t\t/** prints document header\n\t\t\t */\n\t\t\tstring getHeader();\n\n\t\t\t/** Prints document footer*/\n\t\t\tstring getFooter();\n\n\t\t\t/** Prints document body*/\n\t\t\tvoid printBody();\n\n\t\tprivate:\n\n\t\t\t/** \\return escaped character*/\n\t\t\tvirtual string maskCharacter ( unsigned char );\n\n\t\t\t/** @return BBcode open tags */\n\t\t\tstring getOpenTag (const ElementStyle & elem );\n\n\t\t\t/** @return BBcode close tags */\n\t\t\tstring  getCloseTag ( const ElementStyle &elem );\n\n\t\t\t/** initialize tags in specific format according to colouring information provided in DucumentStyle */\n\t\t\tvoid initOutputTags();\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching sequence to begin a new element formatting*/\n\t\t\tstring getKeywordOpenTag ( unsigned int styleID );\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching  sequence to stop element formatting*/\n\t\t\tstring getKeywordCloseTag ( unsigned int styleID );\n\t};\n\n}\n#endif\n"
  },
  {
    "path": "jni/highlight/include/charcodes.h",
    "content": "/***************************************************************************\n                          charcodes.cpp  -  description\n                             -------------------\n    begin                : Wed Nov 24 2003\n    copyright            : (C) 2003 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef CHAR_CODES\n#define CHAR_CODES\n\n#ifdef _WIN32\n\n#define AUML_LC 228\n#define OUML_LC 246\n#define UUML_LC 252\n\n#define AUML_UC 196\n#define OUML_UC 214\n#define UUML_UC 220\n\n\n#define AACUTE_LC 225\n#define EACUTE_LC 233\n#define OACUTE_LC 243\n#define UACUTE_LC 250\n\n#define AACUTE_UC 193\n#define EACUTE_UC 201\n#define OACUTE_UC 211\n#define UACUTE_UC 218\n\n#define AGRAVE_LC 224\n#define EGRAVE_LC 232\n#define OGRAVE_LC 242\n#define UGRAVE_LC 249\n\n#define AGRAVE_UC 192\n#define EGRAVE_UC 200\n#define OGRAVE_UC 210\n#define UGRAVE_UC 217\n\n#define SZLIG 223\n\n#else\n\n#define AUML_LC 164\n#define OUML_LC 182\n#define UUML_LC 188\n\n#define AUML_UC 132\n#define OUML_UC 150\n#define UUML_UC 156\n\n\n#define AACUTE_LC 161\n#define EACUTE_LC 169\n#define OACUTE_LC 179\n#define UACUTE_LC 186\n\n#define AACUTE_UC 129\n#define EACUTE_UC 137\n#define OACUTE_UC 147\n#define UACUTE_UC 154\n\n#define AGRAVE_LC 160\n#define EGRAVE_LC 168\n#define OGRAVE_LC 178\n#define UGRAVE_LC 185\n\n#define AGRAVE_UC 128\n#define EGRAVE_UC 136\n#define OGRAVE_UC 146\n#define UGRAVE_UC 153\n\n#define SZLIG 159\n\n#endif\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/codegenerator.h",
    "content": "/***************************************************************************\n                          codegenerator.h  -  description\n                             -------------------\n    begin                : Die Jul 9 2002\n    copyright            : (C) 2002-2010 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef CODEPARSER_H\n#define CODEPARSER_H\n\n#include <iostream>\n#include <sstream>\n#include <string>\n#include <iomanip>\n#include <vector>\n\n#include \"syntaxreader.h\"\n#include \"themereader.h\"\n#include \"astyle/astyle.h\"\n#include \"preformatter.h\"\n#include \"enums.h\"\n#include \"stringtools.h\"\n\n/// The highlight namespace contains all classes and data structures needed for parsing input data.\n\nnamespace highlight {\n    /** \\brief Regular Expression Information\n\n        This class associates a processing state with a keyword class and the length of the matched token.\n\n\n\n    * @author Andre Simon\n    */\n\n    class Object {\n    public:\n        State state;\n        string str;\n        string style;\n    };\n\n    class ReGroup {\n    public:\n\n        /// Constructor\n        ReGroup() : length(0), state(STANDARD), kwClass(0), name() {\n        }\n\n        /// Constructor\n        ReGroup(State s, unsigned int l, unsigned int c, const string &n) :\n                length(l), state(s), kwClass(c), name(n) {\n        }\n\n        /// Copy Constructor\n        ReGroup(const ReGroup &other) {\n            length = other.length;\n            state = other.state;\n            kwClass = other.kwClass;\n            name = other.name;\n        }\n\n        /// Operator overloading\n        ReGroup &operator=(const ReGroup &other) {\n            length = other.length;\n            state = other.state;\n            kwClass = other.kwClass;\n            name = other.name;\n            return *this;\n        }\n\n        ~ReGroup() {\n        }\n\n        unsigned int length;    ///< length of the token\n        State state;            ///< state of the matched token (keyword, string, etc)\n        unsigned int kwClass;   ///< keyword class if state is keyword\n        string name;           ///< language name needed to handle embedded languages\n    };\n\n\n    /** \\brief Base class for parsing. Works like a finite state machine.\n\n        The virtual class provides source code parsing functionality, based on\n        information stored in language definitions.<br>\n        The derived classes have to define the output format.<br>\n        The colour information is stored in a ThemeReader instance.<br>\n        Codegenerator is a singleton class.<br>\n        Use getInstance for a singleton class instance. Then call the init* methods\n        and loadLanguage to initialize the parser. Init methods have to be called first.\n        Call generate* methods to get results.\n\n    * @author Andre Simon\n    */\n\n    class CodeGenerator {\n\n    public:\n\n        virtual ~CodeGenerator();\n\n        /**\n          Get appropriate Codegenerator instance (should be used with auto_ptr)\n          \\param type Output file type (HTML, XHTML, RTF, LATEX, TEX, ANSI, XTERM256)\n          \\return CodeGenerator\n        */\n        static CodeGenerator *getInstance(OutputType type);\n\n        /**\n          Delete CodeGenerator instance (this is intended for SWIG integration only,\n          in normal C++ code the result of getInstance() should be saved in an auto_ptr)\n          \\param CodeGenerator* CodeGenerator instance\n        */\n        static void deleteInstance(CodeGenerator *inst) { if (inst) delete inst; }\n\n        /**\n         Define colour theme information; needs to be called before using a generate* method.\n         Call this method before loadLanguage().\n         \\param themePath Path of style description file\n         \\return true if successfull\n        */\n        bool initTheme(const string &themePath);\n\n        /**\n         \\return description of the theme init error\n        */\n        string getThemeInitError();\n\n        /**\n         \\return description of the plug-in script error\n        */\n        string getPluginScriptError();\n\n        /** initialize source code indentation and reformatting scheme;\n            needs to be called before using a generate* method\n            \\param indentScheme Name of indentation scheme\n            \\return true if successfull\n         */\n        bool initIndentationScheme(const string &indentScheme);\n\n        /** \\param langDefPath Absolute path to language definition, may be used multiple times for a generator instance\n            \\return   LOAD_OK,\n                  LOAD_FAILED,\n                  LOAD_FAILED_REGEX,\n                  LOAD_FAILED_LUA\n        */\n        LoadResult loadLanguage(const string &langDefPath);\n\n        /**\n         Generate output file from input file\n         \\param inFileName Path of input file (if empty use stdin)\n         \\param outFileName Path of output file (if empty use stdout)\n         \\return ParseError\n        */\n        ParseError generateFile(const string &inFileName, const string &outFileName);\n\n        /**\n         Generate output string from input string\n         \\param input input code string\n         \\return formatted output code\n        */\n        string generateString(const string &input);\n\n        vector <Object> generateObject(const string &input);\n\n        /**\n         Generate output string from input file\n         \\param inFileName file path\n         \\return formatted output code\n        */\n        string generateStringFromFile(const string &inFileName);\n\n        /** Print style definitions to external file or stdout\n          \\param outFile Path of external style definition; print to stdout if empty\n           \\return true if successfull\n          */\n        bool printExternalStyle(const string &outFile);\n\n        /** Print index file with all input file names\n           \\param fileList List of output file names\n           \\param outPath Output path\n            \\return true if successfull\n         */\n        virtual bool printIndexFile(const vector <string> &fileList,\n                                    const string &outPath);\n\n        /** define the preformatting parameters. Preformatting takes place before\n            the optional astyle reformatting and indenting is performed (defined by initIndentationScheme)\n           \\param lineWrappingStyle wrapping style (WRAP_DISABLED, WRAP_SIMPLE, WRAP_DEFAULT)\n           \\param lineLength max line length\n           \\param numberSpaces number of spaces which replace a tab\n        */\n        void setPreformatting(WrapMode lineWrappingStyle, unsigned int lineLength,\n                              int numberSpaces);\n\n        /** \\deprecated\n            \\return True if document style was found */\n        bool styleFound();\n\n        /** \\return True if reformatting of current input is disabled */\n        bool formattingDisabled();\n\n        /** \\return True if reformatting of current input is possible */\n        bool formattingIsPossible();\n\n        /** output line numbers\n           \\param flag true if line numbers should be printed\n           \\param startCnt line number starting count\n        */\n        void setPrintLineNumbers(bool flag, unsigned int startCnt = 1);\n\n        /** \\return line number flag */\n        bool getPrintLineNumbers();\n\n        /** output line numbers filled with zeroes\n            \\param  flag true if zeroes should be printed\n        */\n        void setPrintZeroes(bool flag);\n\n        /** \\return print zeroes flag */\n        bool getPrintZeroes();\n\n        /** omit document header and footer\n           \\param  flag true if output should be fragmented\n        */\n        void setFragmentCode(bool flag);\n\n        /** \\return fragment flag */\n        bool getFragmentCode();\n\n        /** define line number width\n           \\param  w width\n        */\n        void setLineNumberWidth(int w);\n\n        /** \\return line number width */\n        int getLineNumberWidth();\n\n        /** check if input is binary or text\n           \\param  flag true if input should be checked\n        */\n        void setValidateInput(bool flag);\n\n        /** \\return input validation flag */\n        bool getValidateInput();\n\n        /** if true, wrapped lines receive unique line numbers.\n         *  else, wrapped lines don't have line numbers at all. */\n        void setNumberWrappedLines(bool flag);\n\n        /** return number wrapped lines flag */\n        bool getNumberWrappedLines();\n\n        /** \\return style path */\n        const string &getStyleName();\n\n        /** use this font as base font\n        \\param s the font name, e.g. \"Courier New\"\n         */\n        void setBaseFont(const string &s);\n\n        /** \\return base font */\n        const string getBaseFont() const;\n\n        /** use this size as base font size\n        \\param s the font size, e.g. \"12\"\n         */\n        void setBaseFontSize(const string &s);\n\n        /** \\return base font size*/\n        const string getBaseFontSize();\n\n        /** tell parser the include style definition in output\n            \\param flag true if style should be included\n         */\n        void setIncludeStyle(bool flag);\n\n        /** tell parser to omit trailing newline character\n            \\param flag true if no trailing newline should be printed\n         */\n        void disableTrailingNL(bool flag);\n\n        /** Set style input path\n            \\param path path to style input file\n          */\n        void setStyleInputPath(const string &path);\n\n        /** Set style output path\n          \\param path path to style output file\n        */\n        void setStyleOutputPath(const string &path);\n\n        /** Set encoding (output encoding must match input file)\n          \\param encodingName encoding name\n        */\n        void setEncoding(const string &encodingName);\n\n        /** \\return style input file path */\n        const string &getStyleInputPath();\n\n        /** \\return style output file path */\n        const string &getStyleOutputPath();\n\n        /** \\param title Document title */\n        void setTitle(const string &title);\n\n        /** \\return Document title */\n        string getTitle();\n\n        /** \\param cnt maximum number of input lines to be processed */\n        void setMaxInputLineCnt(unsigned int cnt);\n\n        /** \\param keyCase Keyword case */\n        void setKeyWordCase(StringTools::KeywordCase keyCase);\n\n        /** \\param delim End of line delimiter (default: NL)\n        */\n        void setEOLDelimiter(char delim);\n\n        /** Define the name of a nested langage which is located at the beginning of input.\n            The opening embedded delimiter is missing, but the closing delimiter must exist.\n            \\param langName name of nested language\n        */\n        void setStartingNestedLang(const string &langName);\n\n        /** \\param path path of plugin input file\n        */\n        void setPluginReadFile(const string &path);\n\n        /** Load the Lua functions og the plug-in script\n            \\param script path of the plug-in script\n            \\param scriptInputFile path of the optional file to be read by the plugin\n        */\n        bool initPluginScript(const string &script);\n\n        /** \\return Syntaxreader Regex error message */\n        string getSyntaxRegexError();\n\n        /** \\return Syntaxreader Lua error message */\n        string getSyntaxLuaError();\n\n        /** \\return Syntaxreader description */\n        string getSyntaxDescription();\n\n        /** \\return Pointer Syntaxreader, intended for debug output  */\n        SyntaxReader *getSyntaxReader() { return currentSyntax; }\n\n        /** set HTML output anchor flag\n         */\n        virtual void setHTMLAttachAnchors(bool) { };\n\n        /** set HTML output ordered list flag\n         */\n        virtual void setHTMLOrderedList(bool) { };\n\n        /** set HTML output inline CSS flag\n         */\n        virtual void setHTMLInlineCSS(bool) { };\n\n        /** set HTML output enclose pre tag flag\n         */\n        virtual void setHTMLEnclosePreTag(bool) { };\n\n        /** set HTML output replace space by &nbsp; flag\n         */\n        virtual void setHTMLUseNonBreakingSpace(bool) { };\n\n        /** set HTML output anchor prefix\n         */\n        virtual void setHTMLAnchorPrefix(const string &) { };\n\n        /** set HTML output class name\n         */\n        virtual void setHTMLClassName(const string &) { };\n\n        /** set LaTeX replace quotes flag\n         */\n        virtual void setLATEXReplaceQuotes(bool) { };\n\n        /** set LaTeX no Babel shorthands flag\n         */\n        virtual void setLATEXNoShorthands(bool) { };\n\n        /** set LaTeX pretty Symbols flag\n         */\n        virtual void setLATEXPrettySymbols(bool) { };\n\n        /** set RTF page size\n         */\n        virtual void setRTFPageSize(const string &) { };\n\n        /** set RTF output character styles flag\n         */\n        virtual void setRTFCharStyles(bool) { };\n\n        /** set SVG page size\n         */\n        virtual void setSVGSize(const string &, const string &) { };\n\n    protected:\n\n        static const unsigned int NUMBER_BUILTIN_STATES;  ///< number of token states (without keyword group IDs)\n\n        static const string STY_NAME_STD;\n        static const string STY_NAME_STR;\n        static const string STY_NAME_NUM;\n        static const string STY_NAME_SLC;\n        static const string STY_NAME_COM;\n        static const string STY_NAME_ESC;\n        static const string STY_NAME_DIR;\n        static const string STY_NAME_DST;\n        static const string STY_NAME_LIN;\n        static const string STY_NAME_SYM;\n        static const string STY_NAME_IPL;\n\n        /** \\param type Output type */\n        CodeGenerator(highlight::OutputType type);\n\n        CodeGenerator() { };\n\n        /** \\param c Character to be masked\n            \\return Escape sequence of output format */\n        virtual string maskCharacter(unsigned char c) = 0;\n\n        /** \\param ss destination stream\n            \\param s string */\n        void maskString(ostream &ss, const string &s);\n\n        /** Get current line number\n          \\return line number  */\n        unsigned int getLineNumber();\n\n        vector <string> openTags,   ///< list of format delimiters (open new format descriptions)\n                closeTags;   ///< list of format delimiters (close format descriptions)\n\n        /** Description of document colour style*/\n        ThemeReader docStyle;\n\n        /** Language definition*/\n        SyntaxReader *currentSyntax;\n\n        /** Tag for inserting line feeds*/\n        string newLineTag;\n\n        /** String that represents a white space in output */\n        string spacer;\n\n        //char inputBuffer [1024*1024];\n\n        /** file input*/\n        istream *in;\n\n        /** file output*/\n        ostream *out;\n\n        vector <Object> objects;\n\n        string maskWsBegin,  ///< open whitespace mask\n                maskWsEnd;    ///< close whitespace mask\n\n        string styleCommentOpen,  ///< open comment delimiter\n                styleCommentClose; ///< close comment delimiter\n\n        string embedBlockOpen,  ///< open block delimiter to highlight embedded code\n                embedBlockClose; ///< close block delimiter\n\n        /** Encoding name */\n        string encoding;\n\n        /** document title */\n        string docTitle;\n\n        string inFile,   ///< input file name\n                outFile; ///< output file name\n\n        /** Test if maskWsBegin and maskWsEnd should be applied */\n        bool maskWs;\n\n        /** Test if whitespace sould always be separated from enclosing tokens */\n        bool excludeWs;\n\n        /** Test if header and footer should be omitted */\n        bool fragmentOutput;\n\n        /** Test if line numbers should be printed */\n        bool showLineNumbers;\n\n        /** Test if leading spyce of line number should be filled with zeroes*/\n        bool lineNumberFillZeroes;\n\n        /** Flag to test if newlines should be printed */\n        bool printNewLines;\n\n        /** The base font to use */\n        string baseFont;\n\n        /** The base font size to use */\n        string baseFontSize;\n\n        /** Current line of input file*/\n        string line;\n\n        /** Current line number */\n        unsigned int lineNumber;\n\n        /**output line number count start */\n        int lineNumberOffset;\n\n        /** Current state*/\n        State currentState;\n\n        /** keyword class id, used to apply the corresponding keyword style*/\n        unsigned int currentKeywordClass;\n\n        /** Processes origin state */\n        void processRootState();\n\n        /** \\return line break sequence */\n        virtual string getNewLine();\n\n        /**\n           \\param s current state\n           \\param kwClassID keyword class (has to be set when s=KEYWORD)\n           \\return Index of style tag corresponding to the states\n        */\n        unsigned int getStyleID(State s, unsigned int kwClassID = 0);\n\n        /** \\return line index */\n        unsigned int getLineIndex();\n\n        /** print all remaining white space*/\n        void flushWs();\n\n        /** \\return Content of user defined input style */\n        string readUserStyleDef();\n\n        /** \\return Style definition of the chosen output format */\n        virtual string getStyleDefinition() { return \"\"; };\n\n        /** \\return true id encoding is defined */\n        bool encodingDefined() { return StringTools::change_case(encoding) != \"none\"; }\n\n        /** contains white space, which will be printed after a closing tag */\n        string wsBuffer;\n\n        /** Flag to test if style definition should be included in output document */\n        bool includeStyleDef;\n\n        /** Class for line wrapping and tab replacement*/\n        PreFormatter preFormatter;\n\n        /** Stores if the current line should receive a line number.\n         *  If the line is just the continuation of a wrapped line,\n         *  and numberWrappedLines is false, this is set true. */\n        bool numberCurrentLine;\n    private:\n\n        CodeGenerator(const CodeGenerator &) { }\n\n        CodeGenerator &operator=(CodeGenerator &) { return *this; }\n\n        /** Insert line number at the beginning of current output line */\n        virtual void insertLineNumber(bool insertNewLine = true);\n\n        /** Prints document footer\n            @return footer */\n        virtual string getFooter() = 0;\n\n        /** Prints document body*/\n        virtual void printBody() = 0;\n\n        /** Prints document header\n            @return header\n        */\n        virtual string getHeader() = 0;\n\n        /** initialize tags in specific format according to colouring information provided in DucumentStyle */\n        virtual void initOutputTags() = 0;\n\n        /** \t\\param keyword group id\n            \\return  open tag  */\n        virtual string getKeywordOpenTag(unsigned int) = 0;\n\n        /** \t\\param keyword group id\n            \\return  close tag  */\n        virtual string getKeywordCloseTag(unsigned int) = 0;\n\n        /** return open tag to include ctags meta information\n           \\param info tag information of current token\n           \\return opening tag\n         */\n        //virtual string getMetaInfoOpenTag ( const TagInfo& info ) {return \"\";}\n\n        /** return close tag of meta information\n           \\return closing tag\n         */\n        //virtual string getMetaInfoCloseTag() {return \"\";}\n\n        /** open a new tag, set current state to s*/\n        void openTag(State s);\n\n        /** close opened tag, clear current state */\n        void closeTag(State s);\n\n        /** close Keyword tag of corresponding style ID */\n        void closeKWTag(unsigned int styleID);\n\n        /** open Keyword tag of corresponding style ID */\n        void openKWTag(unsigned int styleID);\n\n        /// path to style definition file\n        string themePath;\n\n        /// path to host language definition\n        string hostLangDefPath;\n\n        /// path to embedded language definition\n        string embedLangDefPath;\n\n        /// path to plugin input file\n        string pluginReadFile;\n\n        /// name of nested language which starts the input (ie opening delim missing, but closing delim exists)\n        string embedLangStart;\n\n        /// contains current position in line\n        unsigned int lineIndex;\n\n        /// width of line numbering coloumn\n        unsigned int lineNumberWidth;\n\n        /**maximum count of input lines to be processed*/\n        unsigned int maxLineCnt;\n\n        /**last character of the last line*/\n        unsigned char terminatingChar;\n\n        /** Class for reformatting */\n        astyle::ASFormatter *formatter;\n\n        /** Flag to test if formatting is enabled with current input document*/\n        bool formattingEnabled;\n\n        /** Flag to test if formatting is possible with current input document*/\n        bool formattingPossible;\n\n        /** Flag to test if input should be validated (binary or text) */\n        bool validateInput;\n\n        /** Flag if wrapped lines should receive unique line numbers as well */\n        bool numberWrappedLines;\n\n        /** Flag to test if ctags information is available */\n        //bool tagsEnabled;\n\n        /** Flag to test if trailing newline should be printed */\n        bool noTrailingNewLine;\n\n        /** indicator if current stae was set by Lua hook function */\n        bool resultOfHook;\n\n#ifdef NACL_BUILD\n        bool readScriptAsFile;\n#endif\n\n        /** flag which determines keyword output (unchangeed, uppercase, lowercase)*/\n        StringTools::KeywordCase keywordCase;\n\n        /** contains the current token*/\n        string token;\n\n        string styleInputPath,   ///< style input file path\n                styleOutputPath;  ///< style output file path\n\n        string userScriptError;  ///< Plug-In script error message\n\n        /** end-of-line delimiter*/\n        char eolDelimiter;\n\n        /** Resets parser to origin state, call this after every file conversion */\n        void reset();\n\n        /** read new line from in stream */\n        bool readNewLine(string &newLine);\n\n        /** return next character from in stream */\n        unsigned char getInputChar();\n\n        /** output file type */\n        OutputType outputType;\n\n        /** return new state */\n        State getCurrentState(State oldState);\n\n        /* Methods that represent a parsing state */\n        bool processKeywordState(State myState);  ///< process keywords\n        bool processNumberState();               ///< process numbers\n        bool processMultiLineCommentState();      ///< process multi line comments\n        bool processSingleLineCommentState();     ///< process single line comments\n        bool processStringState(State oldState);  ///< process strings\n        bool processEscapeCharState();            ///< process escape characters\n        bool processInterpolationState();         ///< process string interpolation sequences\n        bool processDirectiveState();             ///< process directives\n        bool processTagState();                   ///< process tags\n        bool processSymbolState();                ///< process symbols\n        void processWsState();                    ///< process whitespace\n        bool processSyntaxChangeState(\n                State myState); ///< process syntax change of embedded languages\n\n        /** print escaped token and clears it\n\n           \\param flushWhiteSpace set true if white space should be flushed\n           \\param tcase keyword case\n        */\n        void printMaskedToken( /*bool addMetaInfo = false,*/ bool flushWhiteSpace = true,\n                                                             StringTools::KeywordCase tcase = StringTools::CASE_UNCHANGED);\n\n        /** association of matched regexes and the corresponding keyword class ids*/\n        map <int, ReGroup> regexGroups;\n\n        /** association of syntax definitions and their paths*/\n        map<string, SyntaxReader *> syntaxReaders;\n\n        /** test for regular expressions\n            \\param line current input line*/\n        void matchRegex(const string &line);\n\n        /** \\return true if input is no binary stream */\n        bool validateInputStream();\n\n        /** load syntax description of embedded snippet's language\n         \\param embedLangDefPath path to language definition\n          \\return true if successfull */\n        bool loadEmbeddedLang(const string &embedLangDefPath);\n\n        /** call user script OnStateChange function if defined to confirm state change\n         \\param newState new state\n         \\param oldState old state\n         \\param kwClass keyword class ID if newState is KEYWORD\n         */\n        State validateState(State newState, State oldState, unsigned int kwClass);\n\n        /** \\deprecated replace by Lua functionality */\n        bool checkSpecialCmd();\n    };\n\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/datadir.h",
    "content": "/***************************************************************************\n                          datadir.h  -  description\n                             -------------------\n    begin                : Sam March 1 2003\n    copyright            : (C) 2003 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef DATADIR_H\n#define DATADIR_H\n\n#if ANDROID\n#include <android/log.h>\n\t#ifndef TAG_NAME\n\t\t#define TAG_NAME \"highliter\"\n\t#endif\n\t#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, TAG_NAME, __VA_ARGS__))\n\t#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, TAG_NAME, __VA_ARGS__))\n\t#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, TAG_NAME, __VA_ARGS__))\n\t#define LOGV(...) ((void)__android_log_print(ANDROID_LOG_VERBOSE, TAG_NAME, __VA_ARGS__))\n#else\n\t#define LOGI(...)\n\t#define LOGW(...)\n\t#define LOGE(...)\n#endif\n\nusing namespace std;\n\n/** \\brief Manages access to installation directories.\n\n    Apart from the standard installation directory, one can define additional\n    search paths. If the additonal paths do not exist, the default paths are\n    returned.\n **/\n\nclass DataDir\n{\n\tvector <string> possibleDirs;\n\n\tpublic:\n\n\t\tstatic string LSB_DATA_DIR;\n\t\tstatic string LSB_CFG_DIR;\n\t\tstatic string LSB_DOC_DIR;\n\n\t\t/** search for a valid installation directory\n\t\t    \\param  userDefinedDir Directory defined by user\n\t\t    \\return True if directory was found */\n\t\tvoid initSearchDirectories ( const string &userDefinedDir );\n\t\t\n\t\t// Deprecated\n\t\tvoid searchDataDir( const string &userDefinedDir );\n\t\t\n\t\tconst void printConfigPaths();\n\t\t\n\t\tconst string searchFile(const string path);\n\n\t\t/**  \\param file file\n\t\t     \\return Location of given syntax definition */\n\t\tconst string getLangPath ( const string & file) ;\n\n\t\t/** \\return System themes location */\n\t\tconst string getThemePath ( ) ;\n\t\t\n\t\t/** \\return System syntax location */\n\t\tconst string getLangPath ( ) ;\n\t\t\n\t\t/** \\return System syntax location */\n\t\tconst string getSystemDataPath ( ) ;\n\n\t\t/** \\param file file\n\t\t    \\return Location of given theme */\n\t\tconst string getThemePath ( const string & file ) ;\n\t\t\n\t\tconst string getFiletypesConfPath (const string &);\n\t\t\n\t\tconst string getPluginPath (const string &);\n\n\t\tconst string getPluginPath ();\n\t\t\n\t\t/** \\return Location of GUI menu translation files */\n\t\tconst string getI18nDir();\n\n\t\t/** \\return Location of GUI file extension filter files */\n\t\tconst string getExtDir();\n\n\t\t/** \\return Location of documentation (README) files (GUI) */\n\t\tconst string getDocDir();\n};\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/elementstyle.h",
    "content": "/***************************************************************************\n                          elementstyle.h  -  description\n                             -------------------\n    begin                : Son Nov 10 2002\n    copyright            : (C) 2002-2007 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef ELEMENTSTYLE_H\n#define ELEMENTSTYLE_H\n\n#include \"stylecolour.h\"\n\nusing namespace std;\n\nnamespace highlight\n{\n\n\t/** \\brief The class stores the basic text formatting properties.\n\n\t* @author Andre Simon\n\t*/\n\n\tclass ElementStyle\n\t{\n\t\tpublic:\n\n\t\t\t/** Constructor\n\t\t\t    \\param col Style colour\n\t\t\t    \\param b Bold flag\n\t\t\t    \\param i Italic flag\n\t\t\t    \\param u Underline flag */\n\t\t\tElementStyle ( const Colour& col, bool b, bool i, bool u );\n\n\t\t\t/** Constuctor\n\t\t\t     \\param elementStyleString String with formatting information (eg \"00 aa ff bold\") */\n\t\t\tElementStyle ( const string & elementStyleString );\n\n\t\t\t/** Constuctor */\n\t\t\tElementStyle();\n\n\t\t\t/**copy constructor */\n\t\t\tElementStyle ( const ElementStyle &other )\n\t\t\t{\n\t\t\t\tcolour = other.getColour();\n\t\t\t\tbold = other.isBold();\n\t\t\t\titalic = other.isItalic();\n\t\t\t\tunderline = other.isUnderline();\n\t\t\t}\n\n\t\t\t/** operator overloading */\n\t\t\tElementStyle& operator= ( const ElementStyle &other )\n\t\t\t{\n\t\t\t\tcolour = other.getColour();\n\t\t\t\tbold = other.isBold();\n\t\t\t\titalic = other.isItalic();\n\t\t\t\tunderline = other.isUnderline();\n\t\t\t\treturn *this;\n\t\t\t}\n\n\t\t\t~ElementStyle();\n\n\t\t\t/** initialize object\n\t\t\t    \\param elementStyleString String which contains formatting attributes\n\t\t\t           (Format: \"color attr\" where\n\t\t\t            color can be HTML hex notation or a hex RGB tuple (ie \"#2244ff\" or \"22 44 ff\")\n\t\t\t            attr can be a combination of \"italic, \"bold\" and \"underline\")\n\t\t\t*/\n\t\t\tvoid set ( const string & elementStyleString );\n\n\t\t\t/** \\return True if italic */\n\t\t\tbool isItalic() const;\n\n\t\t\t/** \\return True if bold */\n\t\t\tbool isBold() const;\n\n\t\t\t/** \\return True if underline */\n\t\t\tbool isUnderline() const;\n\n\t\t\t/** \\param b set italic flag */\n\t\t\tvoid setItalic ( bool b ) {italic = b;}\n\n\t\t\t/** \\param b set bold flag */\n\t\t\tvoid setBold ( bool b ) { bold = b; }\n\n\t\t\t/** \\param b set underline flag */\n\t\t\tvoid setUnderline ( bool b ) {underline = b; }\n\n\t\t\t/** \\return Element colour */\n\t\t\tColour getColour() const;\n\n\t\t\t/** \\param col colour of this element */\n\t\t\tvoid setColour (const Colour& col ) {colour = col;}\n\n\t\tprivate:\n\t\t\tColour colour;\n\t\t\tbool bold, italic, underline;\n\t};\n\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/enums.h",
    "content": "/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef ENUMS_H\n#define ENUMS_H\n\nnamespace highlight {\n    /** states which may occour during input file parsing\n        TODO Clean up!\n    */\n    enum State {\n        STANDARD = 0,\n        STRING,\n        NUMBER,\n        SL_COMMENT,\n        ML_COMMENT,\n        ESC_CHAR,\n        DIRECTIVE,\n        DIRECTIVE_STRING,\n        LINENUMBER,\n        SYMBOL,\n        STRING_INTERPOLATION,\n\n        // don't use constants > KEYWORD as array indices!\n                KEYWORD,\n        STRING_END,\n        NUMBER_END,\n        SL_COMMENT_END,\n        ML_COMMENT_END,\n        ESC_CHAR_END,\n        DIRECTIVE_END,\n        SYMBOL_END,\n        STRING_INTERPOLATION_END,\n        KEYWORD_END,\n        IDENTIFIER_BEGIN,\n        IDENTIFIER_END,\n        EMBEDDED_CODE_BEGIN,\n        EMBEDDED_CODE_END,\n\n        _UNKNOWN = 100,\n        _EOL,\n        _EOF,\n        _WS\n    };\n\n    /** Parser return values*/\n    enum ParseError {\n        PARSE_OK,\n        BAD_INPUT = 1,\n        BAD_OUTPUT = 2,\n        BAD_STYLE = 4,\n        BAD_BINARY = 8\n    };\n\n    /** line wrapping modes*/\n    enum WrapMode {\n        WRAP_DISABLED,\n        WRAP_SIMPLE,\n        WRAP_DEFAULT\n    };\n\n    /** language definition loading results*/\n    enum LoadResult {\n        LOAD_OK,\n        LOAD_FAILED,\n        LOAD_FAILED_REGEX,\n        LOAD_FAILED_LUA\n    };\n\n    /** output formats */\n    enum OutputType {\n        OBJECT,\n        HTML,\n        XHTML,\n        TEX,\n        LATEX,\n        RTF,\n        ANSI,\n        XTERM256,\n        HTML32,\n        SVG,\n        BBCODE,\n        PANGO,\n        ODTFLAT\n    };\n\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/htmlgenerator.h",
    "content": "/***************************************************************************\n                          htmlgenerator.h  -  description\n                             -------------------\n    begin                : Wed Nov 28 2001\n    copyright            : (C) 2001-2007 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n\n#ifndef HTMLGENERATOR_H\n#define HTMLGENERATOR_H\n\n#include <string>\n\n#include \"codegenerator.h\"\n\n#include \"stylecolour.h\"\n#include \"elementstyle.h\"\n\nnamespace highlight\n{\n\n\t/**\n\t   \\brief This class generates HTML.\n\n\t   It contains information about the resulting document structure (document\n\t   header and footer), the colour system, white space handling and text\n\t   formatting attributes.\n\n\t* @author Andre Simon\n\t*/\n\n\tclass HtmlGenerator  : public highlight::CodeGenerator\n\t{\n\t\tpublic:\n\n\t\t\tHtmlGenerator();\n\n\t\t\t/** Destructor, virtual as it is base for xhtmlgenerator*/\n\t\t\tvirtual ~HtmlGenerator() {};\n\n\t\t\t/** Print style definitions to external file\n\t\t\t \\param outFile Path of external style definition\n\t\t\t */\n\t\t\tbool printExternalStyle ( const string &outFile );\n\n\t\t\t/** Print index file with all input file names\n\t\t\t  \\param fileList List of output file names\n\t\t\t  \\param outPath Output path\n\t\t\t*/\n\t\t\tbool printIndexFile ( const vector<string> & fileList, const string &outPath );\n\n\t\t\t/**\n\t\t\t  \\param  b set true if anchors should be attached to line numbers\n\t\t\t*/\n\t\t\tvoid setHTMLAttachAnchors ( bool b ) { attachAnchors = b; }\n\n\t\t\t/**\n\t\t\t  \\param  prefix anchor prefix\n\t\t\t*/\n\t\t\tvoid setHTMLAnchorPrefix ( const string & prefix ) { anchorPrefix = prefix; }\n\n\t\t\t/**\n\t\t\t  \\param  b if true line numbers should be replaced by list items\n\t\t\t*/\n\t\t\tvoid setHTMLOrderedList ( bool b ) ;\n\n\t\t\t/**\n\t\t\t  \\param  b if true CSS formatting will be inserted into each tag\n\t\t\t*/\n\t\t\tvoid setHTMLInlineCSS ( bool b ) { useInlineCSS = b; }\n\n\t\t\t/**\n\t\t\t  \\param  b if true fragmented output will be enclosed in pre tag\n\t\t\t*/\n\t\t\tvoid setHTMLEnclosePreTag ( bool b ) { enclosePreTag = b; }\n\t\t\t\n\t\t\t/**\n\t\t\t  \\param name CSS Class name\n\t\t\t*/\n\t\t\tvoid setHTMLClassName ( const string& name )\n\t\t\t{\n\t\t\t\tcssClassName  = (StringTools::change_case ( name ) ==\"none\") ? \"\" : name;\n\t\t\t}\n\n\t\tprotected:\n\n\t\t\tstring brTag,       ///< break tag\n\t\t\thrTag,       ///< horizontal ruler tag\n\t\t\tidAttr,      ///< ID tag\n\t\t\tfileSuffix,   ///< filename extension\n\t\t\tcssClassName; ///< css class name prefix\n\n\t\t\t/** caches style definition */\n\t\t\tstring styleDefinitionCache;\n\n\t\t\t/** line count should be replaced by ordered list*/\n\t\t\tbool orderedList;\n\n\t\t\t/** CSS definition should be outputted inline */\n\t\t\tbool useInlineCSS;\n\n\t\t\t/** pre tag should be outputted in fragment mode*/\n\t\t\tbool enclosePreTag;\n\n\t\t\t/** \\return CSS definition */\n\t\t\tstring  getStyleDefinition();\n\n\t\t\t/** \\return Content of user defined style file */\n\t\t\tstring readUserStyleDef();\n\n\t\t\t/** \\param title Dociment title\n\t\t\t    \\return Start of file header */\n\t\t\tvirtual string getHeaderStart ( const string &title );\n\n\t\t\t/** \\return Comment with program information */\n\t\t\tstring getGeneratorComment();\n\n\t\tprivate:\n\n\t\t\t/** insert line number in the beginning of the new line\n\t\t\t*/\n\t\t\tvirtual void insertLineNumber ( bool insertNewLine=true );\n\n\t\t\t/** Print document header\n\t\t\t*/\n\t\t\tstring getHeader();\n\n\t\t\t/** Print document body*/\n\t\t\tvoid printBody();\n\n\t\t\t/** Print document footer*/\n\t\t\tstring getFooter();\n\n\t\t\t/** initialize tags in specific format according to colouring information provided in DucumentStyle */\n\t\t\tvoid initOutputTags();\n\n\t\t\t/**  \\param styleName Style name\n\t\t\t     \\return Opening tag of the given style\n\t\t\t*/\n\t\t\tstring getOpenTag ( const string& styleName );\n\n\t\t\tstring  getOpenTag ( const ElementStyle & elem );\n\n\t\t\t/** \\return escaped character*/\n\t\t\tvirtual string maskCharacter ( unsigned char );\n\n\t\t\t/** test if anchors should be appied to line numbers*/\n\t\t\tbool attachAnchors;\n\n\t\t\t/**Optional anchor prefix */\n\t\t\tstring anchorPrefix;\n\n\t\t\t/**\\return text formatting attributes in HTML format */\n\t\t\tstring  getAttributes ( const string & elemName, const ElementStyle & elem );\n\n\t\t\t/**  \\param styleID Style ID\n\t\t\t     \\return Opening tag of the given style\n\t\t\t*/\n\t\t\tstring getKeywordOpenTag ( unsigned int styleID );\n\n\t\t\t/**  \\param styleID Style ID\n\t\t\t     \\return Closing tag of the given style\n\t\t\t*/\n\t\t\tstring getKeywordCloseTag ( unsigned int styleID );\n\n\t\t\t/** @return Newline string */\n\t\t\tstring getNewLine();\n\t};\n\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/latexgenerator.h",
    "content": "/***************************************************************************\n                          latexgenerator.h  -  description\n                             -------------------\n    begin                : Mit Jul 24 2002\n    copyright            : (C) 2002 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef LATEXGENERATOR_H\n#define LATEXGENERATOR_H\n\n#include <string>\n#include <iostream>\n#include <sstream>\n\n#include \"codegenerator.h\"\n#include \"version.h\"\n#include \"charcodes.h\"\n\n\nnamespace highlight\n{\n\n\t/**\n\t   \\brief This class generates LaTeX.\n\n\t   It contains information about the resulting document structure (document\n\t   header and footer), the colour system, white space handling and text\n\t   formatting attributes.\n\n\t* @author Andre Simon\n\t*/\n\n\tclass LatexGenerator : public highlight::CodeGenerator\n\t{\n\t\tpublic:\n\t\t\tLatexGenerator();\n\t\t\t~LatexGenerator();\n\n\t\t\t/** set replace quotes flag\n\t\t\t   \\param b flag\n\t\t\t*/\n\t\t\tvoid setLATEXReplaceQuotes ( bool b ) { replaceQuotes = b;}\n\n\t\t\t/** set disable babel shorthand flag\n\t\t\t   \\param b flag\n\t\t\t*/\n\t\t\tvoid setLATEXNoShorthands ( bool b ) { disableBabelShortHand = b; }\n\n\t\t\t/** set pretty symbols flag\n\t\t\t   \\param b flag\n\t\t\t*/\n\t\t\tvoid setLATEXPrettySymbols ( bool b ) { prettySymbols = b; }\n\n\t\tprivate:\n\n\t\t\t/** prints document header\n\t\t\t */\n\t\t\tstring getHeader();\n\n\t\t\t/** Prints document footer*/\n\t\t\tstring getFooter();\n\n\t\t\t/** Prints document body*/\n\t\t\tvoid printBody();\n\n\t\t\t/** initialize tags in specific format according to colouring information provided in DucumentStyle */\n\t\t\tvoid initOutputTags();\n\n\t\t\tstring styleDefinitionCache;\n\t\t\tstring longLineTag;\n\n\t\t\t/** \\return escaped character*/\n\t\t\tvirtual string maskCharacter ( unsigned char );\n\n\t\t\t/**\\return text formatting attributes in LaTeX format */\n\t\t\tstring getAttributes ( const string & elemName,\n\t\t\t                       const ElementStyle & elem );\n\n\t\t\t/** test if double quotes should be replaced by \\dq{} */\n\t\t\tbool replaceQuotes;\n\n\t\t\t/** test if Babel shorthand for \" should be disabled */\n\t\t\tbool disableBabelShortHand;\n\n\t\t\t/** test if symbols like <,>,{,},~ should be replaced by nicer definitions */\n\t\t\tbool prettySymbols;\n\n\t\t\tstring getNewLine();\n\n\t\t\tstring getStyleDefinition();\n\n\t\t\tstring getKeywordOpenTag ( unsigned int styleID );\n\t\t\tstring getKeywordCloseTag ( unsigned int styleID );\n\t};\n\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/objectgenerator.h",
    "content": "/***************************************************************************\n                     objectgenerator.h  -  description\n                             -------------------\n    begin                : Wed Nov 28 2015\n    copyright            : (C) 20015-2020 by evilbianry\n    email                : rootdebug@163.com\n ***************************************************************************/\n\n\n\n#ifndef ObjectGenerator_H\n#define ObjectGenerator_H\n\n#include <string>\n\n#include \"codegenerator.h\"\n\n#include \"stylecolour.h\"\n#include \"elementstyle.h\"\n\nnamespace highlight\n{\n\n\t/**\n\t   \\brief This class generates HTML.\n\n\t   It contains information about the resulting document structure (document\n\t   header and footer), the colour system, white space handling and text\n\t   formatting attributes.\n\n\t* @author Andre Simon\n\t*/\n\n\tclass ObjectGenerator  : public highlight::CodeGenerator\n\t{\n\t\tpublic:\n\n\t\t\tObjectGenerator();\n\n\t\t\t/** Destructor, virtual as it is base for xObjectGenerator*/\n\t\t\tvirtual ~ObjectGenerator() {};\n\n\t\t\t/** Print style definitions to external file\n\t\t\t \\param outFile Path of external style definition\n\t\t\t */\n\t\t\tbool printExternalStyle ( const string &outFile );\n\n\t\t\t/** Print index file with all input file names\n\t\t\t  \\param fileList List of output file names\n\t\t\t  \\param outPath Output path\n\t\t\t*/\n\t\t\tbool printIndexFile ( const vector<string> & fileList, const string &outPath );\n\n\t\t\t/**\n\t\t\t  \\param  b set true if anchors should be attached to line numbers\n\t\t\t*/\n\t\t\tvoid setHTMLAttachAnchors ( bool b ) { attachAnchors = b; }\n\n\t\t\t/**\n\t\t\t  \\param  prefix anchor prefix\n\t\t\t*/\n\t\t\tvoid setHTMLAnchorPrefix ( const string & prefix ) { anchorPrefix = prefix; }\n\n\t\t\t/**\n\t\t\t  \\param  b if true line numbers should be replaced by list items\n\t\t\t*/\n\t\t\tvoid setHTMLOrderedList ( bool b ) ;\n\n\t\t\t/**\n\t\t\t  \\param  b if true CSS formatting will be inserted into each tag\n\t\t\t*/\n\t\t\tvoid setHTMLInlineCSS ( bool b ) { useInlineCSS = b; }\n\n\t\t\t/**\n\t\t\t  \\param  b if true fragmented output will be enclosed in pre tag\n\t\t\t*/\n\t\t\tvoid setHTMLEnclosePreTag ( bool b ) { enclosePreTag = b; }\n\t\t\t\n\t\t\t/**\n\t\t\t  \\param name CSS Class name\n\t\t\t*/\n\t\t\tvoid setHTMLClassName ( const string& name )\n\t\t\t{\n\t\t\t\tcssClassName  = (StringTools::change_case ( name ) ==\"none\") ? \"\" : name;\n\t\t\t}\n\n\t\tprotected:\n\n\t\t\tstring brTag,       ///< break tag\n\t\t\thrTag,       ///< horizontal ruler tag\n\t\t\tidAttr,      ///< ID tag\n\t\t\tfileSuffix,   ///< filename extension\n\t\t\tcssClassName; ///< css class name prefix\n\n\t\t\t/** caches style definition */\n\t\t\tstring styleDefinitionCache;\n\n\t\t\t/** line count should be replaced by ordered list*/\n\t\t\tbool orderedList;\n\n\t\t\t/** CSS definition should be outputted inline */\n\t\t\tbool useInlineCSS;\n\n\t\t\t/** pre tag should be outputted in fragment mode*/\n\t\t\tbool enclosePreTag;\n\n\t\t\t/** \\return CSS definition */\n\t\t\tstring  getStyleDefinition();\n\n\t\t\t/** \\return Content of user defined style file */\n\t\t\tstring readUserStyleDef();\n\n\t\t\t/** \\param title Dociment title\n\t\t\t    \\return Start of file header */\n\t\t\tvirtual string getHeaderStart ( const string &title );\n\n\t\t\t/** \\return Comment with program information */\n\t\t\tstring getGeneratorComment();\n\n\t\tprivate:\n\n\t\t\t/** insert line number in the beginning of the new line\n\t\t\t*/\n\t\t\tvirtual void insertLineNumber ( bool insertNewLine=true );\n\n\t\t\t/** Print document header\n\t\t\t*/\n\t\t\tstring getHeader();\n\n\t\t\t/** Print document body*/\n\t\t\tvoid printBody();\n\n\t\t\t/** Print document footer*/\n\t\t\tstring getFooter();\n\n\t\t\t/** initialize tags in specific format according to colouring information provided in DucumentStyle */\n\t\t\tvoid initOutputTags();\n\n\t\t\t/**  \\param styleName Style name\n\t\t\t     \\return Opening tag of the given style\n\t\t\t*/\n\t\t\tstring getOpenTag ( const string& styleName );\n\n\t\t\tstring  getOpenTag ( const ElementStyle & elem );\n\n\t\t\t/** \\return escaped character*/\n\t\t\tvirtual string maskCharacter ( unsigned char );\n\n\t\t\t/** test if anchors should be appied to line numbers*/\n\t\t\tbool attachAnchors;\n\n\t\t\t/**Optional anchor prefix */\n\t\t\tstring anchorPrefix;\n\n\t\t\t/**\\return text formatting attributes in HTML format */\n\t\t\tstring  getAttributes ( const string & elemName, const ElementStyle & elem );\n\n\t\t\t/**  \\param styleID Style ID\n\t\t\t     \\return Opening tag of the given style\n\t\t\t*/\n\t\t\tstring getKeywordOpenTag ( unsigned int styleID );\n\n\t\t\t/**  \\param styleID Style ID\n\t\t\t     \\return Closing tag of the given style\n\t\t\t*/\n\t\t\tstring getKeywordCloseTag ( unsigned int styleID );\n\n\t\t\t/** @return Newline string */\n\t\t\tstring getNewLine();\n\t};\n\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/odtgenerator.h",
    "content": "/***************************************************************************\n                         odtgenerator.h  -  description\n                             -------------------\n    begin                : Jul 19 2012\n    copyright            : (C) 2004-2012 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef ODTGENERATOR_H\n#define ODTGENERATOR_H\n\n#include <string>\n\n#include \"codegenerator.h\"\n#include \"version.h\"\n\nnamespace highlight\n{\n\n\t/**\n\t   \\brief This class generates OpenDocument Textfiles (Flat XML).\n\n\t   It contains information about the resulting document structure (document\n\t   header and footer), the colour system, white space handling and text\n\t   formatting attributes.\n\n\t* @author Andre Simon\n\t*/\n\n\tclass ODTGenerator : public highlight::CodeGenerator\n\t{\n\t\tpublic:\n\t\t\tODTGenerator();\n\t\t\t~ODTGenerator();\n\n\t\t\t/** prints document header\n\t\t\t */\n\t\t\tstring getHeader();\n\n\t\t\t/** Prints document footer*/\n\t\t\tstring getFooter();\n\n\t\t\t/** Prints document body*/\n\t\t\tvoid printBody();\n\n\t\tprivate:\n\n\t\t\t/** \\return escaped character*/\n\t\t\tvirtual string maskCharacter ( unsigned char );\n\n\t\t\t/** @return ODT open tags */\n\t\t\tstring getOpenTag ( const string& styleName );\n\n\t\t\t/** initialize tags in specific format according to colouring information provided in DucumentStyle */\n\t\t\tvoid initOutputTags();\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching sequence to begin a new element formatting*/\n\t\t\tstring getKeywordOpenTag ( unsigned int styleID );\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching  sequence to stop element formatting*/\n\t\t\tstring getKeywordCloseTag ( unsigned int styleID );\n\t\t\t\n\t\t\tstring styleDefinitionCache;\n\n\t\t\tstring getStyleDefinition();\n\n\t\t\tstring getAttributes ( const string &, const ElementStyle & );\n\t};\n\n}\n#endif\n"
  },
  {
    "path": "jni/highlight/include/pangogenerator.h",
    "content": "/***************************************************************************\n                         pangogenerator.h  -  description\n                             -------------------\n    begin                : Sept 5 2014\n    copyright            : (C) 2014 by Dominik Schmidt\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef PANGOGENERATOR_H\n#define PANGOGENERATOR_H\n\n#include <string>\n\n#include \"codegenerator.h\"\n#include \"charcodes.h\"\n#include \"version.h\"\n\nnamespace highlight\n{\n\n\t/**\n\t   \\brief This class generates Pango markup.\n\n\t   It contains information about the resulting document structure (document\n\t   header and footer), the colour system, white space handling and text\n\t   formatting attributes.\n\n\t* @author Dominik Schmidt\n\t*/\n\n\tclass PangoGenerator : public highlight::CodeGenerator\n\t{\n\t\tpublic:\n\t\t\tPangoGenerator();\n\t\t\t~PangoGenerator();\n\n\t\t\t/** prints document header\n\t\t\t */\n\t\t\tstring getHeader();\n\n\t\t\t/** Prints document footer*/\n\t\t\tstring getFooter();\n\n\t\t\t/** Prints document body*/\n\t\t\tvoid printBody();\n\n\t\tprivate:\n\n\t\t\t/** \\return escaped character*/\n\t\t\tvirtual string maskCharacter ( unsigned char );\n\n\t\t\t/**\\return text formatting attributes in Pango markup */\n\t\t\tstring getAttributes ( const ElementStyle & elem );\n\n\t\t\t/** gibt Pangotags zurück*/\n\t\t\tstring getOpenTag ( const ElementStyle & elem );\n\n\t\t\t/** initialize tags in specific format according to colouring information provided in DucumentStyle */\n\t\t\tvoid initOutputTags();\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching sequence to begin a new element formatting*/\n\t\t\tstring getKeywordOpenTag ( unsigned int styleID );\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching  sequence to stop element formatting*/\n\t\t\tstring getKeywordCloseTag ( unsigned int styleID );\n\t};\n\n}\n#endif\n"
  },
  {
    "path": "jni/highlight/include/platform_fs.h",
    "content": "\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n#ifndef PLATFORM_FS__H__INCLUDED\n#define PLATFORM_FS__H__INCLUDED\n\n#include <string>\n#include <iostream>\n#include <vector>\n\nnamespace Platform\n  {\n  extern const char pathSeparator;\n\n  std::string getAppPath();\n\n  std::string getHomePath();\n\n  /** \\param fileList Vector where found entries will be stored\n      \\param  wildcard Directory path and wildcard\n      \\param recursiveSearch Test if directory should be searched recursively */\n  bool getDirectoryEntries ( std::vector<std::string> &fileList,\n\t\t\t    std::string wildcard,\n\t\t\t    bool recursiveSearch=false );\n\n  void getFileNames ( const std::string &directory,const std::string &wildcard,\n\t\t      std::vector<std::string> &fileName );\n\n  int wildcmp ( const char *wild, const char *data );\n\n  bool fileExists(const std::string &fName);\n}\n#endif\n\n"
  },
  {
    "path": "jni/highlight/include/preformatter.h",
    "content": "/***************************************************************************\n                        PreFormatter.cpp  -  description\n                             -------------------\n    begin                : Mo Jan 03 2005\n    copyright            : (C) 2005-2008 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef PreFormatter_H\n#define PreFormatter_H\n\n#include <string>\n#include <set>\n\nnamespace highlight\n{\n\n\t/** \\brief Class which provides intelligent line wrapping.\n\t* @author Andre Simon\n\t*/\n\n\tclass PreFormatter\n\t{\n\t\tpublic:\n\n\t\t\tPreFormatter();\n\n\t\t\t~PreFormatter();\n\n\t\t\t/**\n\t\t\t Set wrapping mode\n\t\t\t \\param wrap set to true if long lines should be wrapped\n\t\t\t*/\n\t\t\tvoid setWrap ( bool wrap ) {wrapLines = wrap;}\n\n\t\t\t/**\n\t\t\t Replace tabs by spaces\n\t\t\t \\param replTabs set to true if tabs should be replaced by spaces\n\t\t\t*/\n\t\t\tvoid setReplaceTabs ( bool replTabs ) {replaceTabs = replTabs;}\n\n\t\t\t/**\n\t\t\t \\return True if current line can be wrapped again\n\t\t\t*/\n\t\t\tbool hasMoreLines();\n\n\t\t\t/**\n\t\t\t Sets new line to be wrapped\n\t\t\t \\param newline New line\n\t\t\t*/\n\t\t\tvoid setLine ( const std::string & newline );\n\n\t\t\t/**\n\t\t\t The method will indent function calls and statements\n\t\t\t \\return Next line\n\t\t\t*/\n\t\t\tstd::string getNextLine();\n\n\t\t\t/**\n\t\t\t \\return True if lines following open braces should be indented\n\t\t\t*/\n\t\t\tbool indentCode();\n\n\t\t\t/**\n\t\t\t  Maximum line length\n\t\t\t  \\param maxlength max. length of output lines\n\t\t\t*/\n\t\t\tvoid setWrapLineLength ( unsigned int maxlength );\n\n\t\t\t/**\n\t\t\t  Indentation mode\n\t\t\t  \\param indentAfterOpenBraces set true if lines should be indented after braces\n\t\t\t*/\n\t\t\tvoid setWrapIndentBraces ( bool indentAfterOpenBraces=true );\n\n\t\t\t/**\n\t\t\t  Number of spaces\n\t\t\t  \\param num number of spaces which replace a tab\n\t\t\t*/\n\t\t\tvoid setNumberSpaces ( unsigned int num );\n\n\t\t\t/**\n\t\t\t  \\return true if preformatting is enabled\n\t\t\t*/\n\t\t\tbool isEnabled()\n\t\t\t{\n\t\t\t\treturn wrapLines || replaceTabs;\n\t\t\t}\n\t\t\t\n\t\t\tbool getReplaceTabs() \n\t\t\t{ \n\t\t\t\treturn replaceTabs; \n\t\t\t}\n\n\t\t\t/**\n\t\t\t  reset preformatting state to use the object with new input data\n\t\t\t*/\n\t\t\tvoid reset ()\n\t\t\t{\n\t\t\t\tlineNumber=0;\n\t\t\t\twrappedLines.clear();\n\t\t\t}\n\n\t\t\t/**\n\t\t\t \\param lineNumber line number\n\t\t\t  \\return true if input line linenumber was wrapped\n\t\t\t*/\n\t\t\tbool isWrappedLine ( int lineNumber )\n\t\t\t{\n\t\t\t\treturn wrappedLines.count ( lineNumber );\n\t\t\t}\n\n\t\tprivate:\n\n\t\t\tunsigned int maxLineLength;\n\n\t\t\tstd::string line, wsPrefix;\n\t\t\tunsigned int index;\n\t\t\tunsigned int numberSpaces;\n\t\t\tunsigned int lineNumber;\n\t\t\tsize_t wsPrefixLength;\n\t\t\tbool hasMore, indentAfterOpenBraces;\n\t\t\tbool redefineWsPrefix;\n\t\t\tbool wrapLines, replaceTabs;\n\n\t\t\tstd::set<int> wrappedLines;\n\n\t\t\tstatic const std::string LB_CHARS;\n\t\t\tstatic const std::string WS_CHARS;\n\t\t\tstatic const std::string INDENT_MARKERS;\n\n\t};\n\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/rtfgenerator.h",
    "content": "/***************************************************************************\n                          rtfcode.h  -  description\n                             -------------------\n    begin                : Die Jul 9 2002\n    copyright            : (C) 2002-2008 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef RTFGENERATOR_H\n#define RTFGENERATOR_H\n\n#include <string>\n\n#include \"codegenerator.h\"\n\nnamespace highlight\n{\n\n\t/**\n\t   PageSize contains the RTF page dimensions.\n\t*/\n\tstruct PageSize\n\t{\n\t\t/// RTF page width\n\t\tint width;\n\t\t/// RTF page height\n\t\tint height;\n\n\t\tPageSize()\n\t\t{\n\t\t}\n\n\t\t/** Constructor to define page dimensions\n\t\t    @param w width\n\t\t    @param h height*/\n\t\tPageSize ( int w, int h )\n\t\t{\n\t\t\twidth=w;\n\t\t\theight = h;\n\t\t}\n\n\t};\n\n\t/** mapping of page size names and dimensions */\n\ttypedef  map<string, struct PageSize> PagesizeMap;\n\n\t/**\n\t   \\brief This class generates RTF.\n\n\t   It contains information about the resulting document structure (document\n\t   header and footer), the colour system, white space handling and text\n\t   formatting attributes.\n\n\t* @author Andre Simon\n\t*/\n\n\tclass RtfGenerator : public highlight::CodeGenerator\n\t{\n\t\tpublic:\n\n\t\t\tRtfGenerator();\n\n\t\t\t~RtfGenerator();\n\n\t\t\t/**  Define RTF page size\n\t\t\t     \\param ps RTF page size (a3, a4, a5, b4, b5, b6, letter, legal) */\n\t\t\tvoid setRTFPageSize ( const string & ps );\n\n\t\t\t/** \\param cs flag to enable character styles*/\n\t\t\tvoid setRTFCharStyles ( bool cs );\n\n\t\tprivate:\n\n\t\t\t/** prints document header\n\t\t\t */\n\t\t\tstring getHeader();\n\n\t\t\t/** Prints document footer*/\n\t\t\tstring getFooter();\n\n\t\t\t/** Prints document body*/\n\t\t\tvoid printBody();\n\n\t\t\t/** initialize tags in specific format according to colouring information provided in DucumentStyle */\n\t\t\tvoid initOutputTags();\n\n\t\t\t/** Map of several pagesizes */\n\t\t\tPagesizeMap psMap;\n\n\t\t\t/** name of page size which is mapped to page dimensions*/\n\t\t\tstring pageSize;\n\n\t\t\t/** flag to add character styles */\n\t\t\tbool addCharStyles;\n\n\t\t\t/** \\return escaped character*/\n\t\t\tvirtual string maskCharacter ( unsigned char );\n\n\t\t\t/**\\return text formatting attributes in RTF format */\n\t\t\tstring  getAttributes ( const ElementStyle & col );\n\n\t\t\t/** @param styleNumber number of current style\n\t\t\t    @param elem associated element style\n\t\t\t    @return RTF formatting seqence (colour index + bold + italic)*/\n\t\t\tstring getOpenTag ( int styleNumber,const ElementStyle &elem );\n\n\t\t\t/** @param styleNumber number of current style\n\t\t\t@param elem associated element style\n\t\t\t@param styleName style name\n\t\t\t@return RTF character style definition */\n\t\t\tstring getCharStyle ( int styleNumber,const ElementStyle &elem, const string&styleName );\n\n\t\t\t/** @param elem associated element style\n\t\t\t    @return RTF formatting sequnce to close element formatting */\n\t\t\tstring getCloseTag ( const ElementStyle &elem );\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching sequence to begin a new element formatting*/\n\t\t\tstring getKeywordOpenTag ( unsigned int styleID );\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching  sequence to stop element formatting*/\n\t\t\tstring getKeywordCloseTag ( unsigned int styleID );\n\t};\n\n}\n#endif\n"
  },
  {
    "path": "jni/highlight/include/stringtools.h",
    "content": "/***************************************************************************\n                          stringtools.h  -  description\n                             -------------------\n    begin                : Mon Dec 10 2001\n    copyright            : (C) 2001-2010 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef STRINGTOOLS_H\n#define STRINGTOOLS_H\n\n#include <string>\n#include <vector>\n#include <sstream>\n\nusing namespace std;\n\n/// Contains methods for string manipulation\n\nnamespace StringTools\n{\n\n\t/** Change Keyword case */\n\tenum KeywordCase\n\t{\n\t\tCASE_UNCHANGED, ///< do not alter case\n\t\tCASE_LOWER,     ///< convert to lower case\n\t\tCASE_UPPER,     ///< convert to upper case\n\t\tCASE_CAPITALIZE ///< convert first character to upper case\n\t};\n\n\t/** Change character case of strings\n\t    \\param s input string\n\t    \\param kcase case modification indicator\n\t    \\return modified string\n\t*/\n\tstring change_case ( const string & s,\n\t                     const KeywordCase kcase = CASE_LOWER ) throw();\n\n\t/** Trim string (remove whitespace)\n\t   \\param value String\n\t   \\return string trimmed on the right\n\t*/\n\tstring trimRight ( const string &value );\n\n\tstring trim(const string& s);\n\n\t/** Split string and return items separated by a delimiter\n\t    \\param s string containing tokens\n\t    \\param delim Token delimiter\n\t    \\return vector containing found tokens */\n\tvector <string> splitString ( const string& s, unsigned char delim );\n\n\t/** Convert string to a numeric value of the given type\n\t    \\param val variable of specified type which will contain the numeric value\n\t    \\param s string containing a number\n\t    \\param f format specifier function (IO manipulator)\n\t    \\return true if successfull */\n\ttemplate <class T>\n\tbool str2num ( T &val, const std::string& s, std::ios_base& ( *f ) ( std::ios_base& ) )\n\t{\n\t\tstd::istringstream iss ( s );\n\t\treturn ! ( iss >> f >> val ).fail();\n\t}\n\n\tint calcWeight(const string&s);\n\n\tstring getPathAcronym(const string&path, char delim);\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/stylecolour.h",
    "content": "/***************************************************************************\n                          stylecolour.h  -  description\n                             -------------------\n    begin                : Die Nov 5 2002\n    copyright            : (C) 2002 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef STYLECOLOUR_H\n#define STYLECOLOUR_H\n\n#include <string>\n\n#include \"enums.h\"\n\n\n\n\nusing namespace std;\n\nnamespace highlight\n{\n\n\t/**\\brief Stores colours and returns red, green and blue values in different formats\n\t* @author Andre Simon\n\t */\n\n\tstruct RGBVal\n\t{\n\t\tint iRed,    ///< Red value\n\t\tiGreen,  ///< Green value\n\t\tiBlue;   ///< Blue value\n\t};\n\n\tclass Colour\n\t{\n\t\tpublic:\n\t\t\t/** Constructor\n\t\t\t    \\param red Red value in hex notation\n\t\t\t    \\param green Blue value in hex notation\n\t\t\t    \\param blue Green value in hex notation\n\t\t\t*/\n\t\t\tColour ( const string & red, const string & green, const string & blue );\n\n\t\t\t/** Constructor\n\t\t\t    \\param ColourString String with rgb values\n\t\t\t*/\n\t\t\tColour ( const string & colourString );\n\n\t\t\tColour();\n\t\t\t~Colour() {};\n\n\t\t\t/** Sets red, green and blue values\n\t\t\t  \\param ColourString String containing colour attributes\n\t\t\t*/\n\t\t\tvoid setRGB ( const string & colourString );\n\n\n\t\t\t/** Sets red value\n\t\t\t    \\param red New red value */\n\t\t\tvoid setRed ( const string & red );\n\n\t\t\t/** Sets green value\n\t\t\t    \\param green New green value */\n\t\t\tvoid setGreen ( const string & green );\n\n\t\t\t/** Sets blue value\n\t\t\t    \\param blue New blue value */\n\t\t\tvoid setBlue ( const string & blue );\n\n\t\t\t/**  @param type Output type\n\t\t\t     @return Red value in color representation according to output type */\n\t\t\tstring getRed ( OutputType type ) const;\n\t\t\t/**  @param type Output type\n\t\t\t     @return Green value in color representation according to output type */\n\t\t\tstring getGreen ( OutputType type ) const;\n\t\t\t/**  @param type Output type\n\t\t\t     @return Blue value in color representation according to output type */\n\t\t\tstring getBlue ( OutputType type ) const;\n\n\t\tprivate:\n\t\t\tRGBVal rgb;\n\t\t\tstring int2str ( int, std::ios_base& ( *f ) ( std::ios_base& ) ) const;\n\t\t\tstring float2str ( double ) const;\n\t};\n\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/svggenerator.h",
    "content": "/***************************************************************************\n                          xmlcode.h  -  description\n                             -------------------\n    begin                : Mo 23.06.2008\n    copyright            : (C) 2008 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef SVGGenerator_H\n#define SVGGenerator_H\n\n#include \"codegenerator.h\"\n\nnamespace highlight\n{\n\n\t/**\n\t   \\brief This class generates SVG.\n\n\t   It contains information about the resulting document structure (document\n\t   header and footer), the colour system, white space handling and text\n\t   formatting attributes.\n\n\t* @author Andre Simon\n\t*/\n\n\tclass SVGGenerator : public highlight::CodeGenerator\n\t{\n\t\tpublic:\n\n\t\t\tSVGGenerator();\n\t\t\t~SVGGenerator();\n\n\t\t\t/** Set SVG dimensions\n\t\t\t    \\param w page width\n\t\t\t    \\param h page height\n\t\t\t*/\n\t\t\tvoid setSVGSize ( const string& w, const string& h );\n\n\t\tprivate:\n\n\t\t\t/** prints document header\n\t\t\t */\n\t\t\tstring getHeader();\n\n\t\t\t/** Prints document footer*/\n\t\t\tstring getFooter();\n\n\t\t\t/** Prints document body*/\n\t\t\tvoid printBody();\n\n\t\t\t/** initialize tags in specific format according to colouring information provided in DucumentStyle */\n\t\t\tvoid initOutputTags();\n\n\t\t\tstring styleDefinitionCache;\n\t\t\tstring width, height;\n\n\t\t\tstring getStyleDefinition();\n\n\t\t\tstring getAttributes ( const string &, const ElementStyle & );\n\n\t\t\t/** \\return escaped character*/\n\t\t\tvirtual string maskCharacter ( unsigned char );\n\n\t\t\tstring getOpenTag ( const string& );\n\n\t\t\tstring getKeywordOpenTag ( unsigned int styleID );\n\t\t\tstring getKeywordCloseTag ( unsigned int styleID );\n\n\t\t\t/** @return Newline string */\n\t\t\tstring getNewLine();\n\t};\n\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/syntaxreader.h",
    "content": "/***************************************************************************\n                          syntaxreader.h  -  description\n                             -------------------\n    begin                : Wed Nov 28 2001\n    copyright            : (C) 2001-2010 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef SYNTAXREADER_H\n#define SYNTAXREADER_H\n\n#include <vector>\n#include <string>\n#include <map>\n#include <iostream>\n#include <fstream>\n#include <iterator>\n#include <sstream>\n\n#include <boost/xpressive/xpressive_dynamic.hpp>\n\n#include <Diluculum/LuaState.hpp>\n#include <Diluculum/LuaVariable.hpp>\n#include <Diluculum/LuaFunction.hpp>\n\n#include \"platform_fs.h\"\n#include \"enums.h\"\n\n#define GLOBAL_INSTANCE_NAME \"HL_SRInstance\"\n\nusing namespace std;\n\n\nnamespace highlight\n{\n\tclass RegexElement;\n\n\t/** maps keywords and the corresponding class IDs*/\n\ttypedef map <string, int> KeywordMap;\n\n\t/** maps embedded langiage names to exit delimiter regexes*/\n\ttypedef map <string, string> EmbedLangDelimMap;\n\n\t/**\\brief Contains specific data of the programming language being processed.\n\n\t* @author Andre  Simon\n\t*/\n\n\tclass SyntaxReader\n\t{\n\n\t\tpublic:\n\n\t\t\tSyntaxReader();\n\n\t\t\t~SyntaxReader();\n\n\t\t\t/** \\return Failed regular expression */\n\t\t\t string getFailedRegex() const { return regexErrorMsg; }\n\n\t\t\t/** \\return Failed Lua exception description */\n\t\t\t string getLuaErrorText() const { return luaErrorMsg; }\n\n\t\t\t/** \\return Prefix of raw strings */\n\t\t\tunsigned char getRawStringPrefix() const { return rawStringPrefix; }\n\n\t\t\t/** \\return Continuation Character */\n\t\t\tunsigned char getContinuationChar() const { return continuationChar; }\n\n\t\t\t/** \\return true if syntax highlighting is enabled*/\n\t\t\tbool highlightingEnabled() const { return !disableHighlighting;}\n\n\t\t\t/** \\return True if language is case sensitive */\n\t\t\tbool isIgnoreCase() const { return ignoreCase;}\n\n\t\t\t/** \\param s String\n\t\t\t     \\return class id of keyword, 0 if s is not a keyword */\n\t\t\tint isKeyword ( const string &s ) ;\n\n\t\t\t/** Load new language definition\n\t\t\t    Will only read a new language definition if the given\n\t\t\t      file path is not equal to the path of the current language definition.\n\t\t\t    \\param langDefPath Path of language definition\n\t\t\t    \\param pluginReadFilePath path to file which is read by plugin\n\t\t\t    \\param outputType output format\n\t\t\t    \\param clear Test if current data should be resetted to defaults\n\t\t\t    \\return LoadResult  */\n\t\t\tLoadResult load( const string& langDefPath, const string& pluginReadFilePath,  OutputType outputType=HTML, bool clear=true );\n\n\t\t\t/** \\return True if multi line comments may be nested */\n\t\t\tbool allowNestedMLComments() const { return allowNestedComments; }\n\n\t\t\t/** \\return True if highlighting is disabled\n                                    TODO remove method */\n\t\t\tbool highlightingDisabled() const  { return disableHighlighting; }\n\n\t\t\t/** \\return True if the next load() call would load a new language definition\n\t\t\t    \\param  langDefPath Path to language definition  */\n\t\t\tbool needsReload ( const string &langDefPath ) const { return currentPath!=langDefPath; }\n\n\t\t\t/** \\return True if current language may be reformatted (c, c++, c#, java) */\n\t\t\tbool enableReformatting() const { return reformatCode;}\n\n\t\t\t/** \\return keywords*/\n\t\t\tconst KeywordMap& getKeywords() const { return keywords; }\n\n\t\t\t/** \\return keyword classes*/\n\t\t\tconst vector<string>& getKeywordClasses() const { return keywordClasses;}\n\n\t\t\t/** \\return regular expressions */\n\t\t\tconst vector<RegexElement*>& getRegexElements() const {return regex;};\n\n\t\t\t/** \\return description of the programming language */\n\t\t\tconst string & getDescription () const {return langDesc;}\n\n\t\t\t/** \\return header string defined by a plug-in */\n\t\t\tconst string & getHeaderInjection () const {return headerInjection;}\n\n\t\t\t/** \\return footer string defined by a plug-in */\n\t\t\tconst string & getFooterInjection () const {return footerInjection;}\n\n\t\t\t/**  \\param delimID delimiter id\n\t\t\t     \\return true,  if no closing delimiter exists (open and close delimiters are equal)\n\t\t\t */\n\t\t\tbool delimiterIsDistinct ( int delimID )\n\t\t\t{\n\t\t\t\treturn delimiterDistinct[delimID];\n\t\t\t}\n\n\t\t\t/**  \\param delimID delimiter id\n\t\t\t     \\return true,  if delimiter indicates a raw string\n\t\t\t */\n\t\t\tbool delimiterIsRawString ( int delimID )\n\t\t\t{\n\t\t\t\treturn rawStringOpenDelims[delimID];\n\t\t\t}\n\n\t\t\t/**  Pairs of open/close delimiters have a unique ID to test if two tokens act as delimiters\n\t\t\t     \\param token delimiter token\n                             \\param s State of delimiter\n\t\t\t     \\return delimiter ID\n\t\t\t */\n\t\t\tint getOpenDelimiterID ( const string& token, State s);\n\n\t\t\t/**  Pairs of open/close delimiters have a unique ID to test if two tokens act as delimiters\n\t\t\t     \\param token delimiter token\n                             \\param s State of delimiter\n                             \\param openDelimId opening delimiter retrieved with getOpenDelimiterID\n\t\t\t     \\return true if delimiter id of token matches openDelimID\n\t\t\t */\n\t\t\tbool matchesOpenDelimiter ( const string& token, State s, int openDelimId);\n\n\t\t\t/** initializes end delimiter regex to switch back to host language\n\t\t\t\t\\param langPath path of embedded language definition\n\t\t\t*/\n\t\t\tvoid restoreLangEndDelim(const string&langPath);\n\n\t\t\t/**\n\t\t\t\t\\param lang language definition name  (no path, no \".lang\" extension)\n\t\t\t\t\\return absolute path based on the previously loaded definition\n\t\t\t*/\n\t\t\tstring getNewPath(const string& lang);\n\n\t\t\t/**\n\t\t\t\t\\return absolute path of currently loaded definition\n\t\t\t*/\n\t\t\tstring getCurrentPath() const { return currentPath;}\n\n\t\t\t/**\n\t\t\t\t\\return pointer to state validation function\n\t\t\t*/\n\t\t\tDiluculum::LuaFunction* getValidateStateChangeFct() const {return validateStateChangeFct;}\n\t\t\t/**\n\t\t\t\t\\return pointer to state decorate function\n\t\t\t*/\n\t\t\tDiluculum::LuaFunction* getDecorateFct() const {return decorateFct;}\n\n\t\t\t/**\n\t\t\t\t\\return pointer to Lua state\n\t\t\t*/\n\t\t\t Diluculum::LuaState* getLuaState() const { return luaState;}\n\n\t\t\t/**\n\t\t\t\t\\param chunk Lua function to be added to the function list\n\t\t\t*/\n\t\t\tvoid addUserChunk(const Diluculum::LuaFunction& chunk){\n\t\t\t  pluginChunks.push_back(new Diluculum::LuaFunction(chunk));\n\t\t\t}\n\n\t\t\t/**\n\t\t\t\t\\param ls Lua state to be initialized with constants\n\t\t\t\t\\param langDefPath absolute path of language definition\n\t\t\t\t\\param pluginReadFilePath absolute path of plugin input file\n\t\t\t*/\n\t\t\tstatic void initLuaState(Diluculum::LuaState& ls, const string& langDefPath, const string& pluginReadFilePath, OutputType outputType=HTML );\n\n\t\tprivate:\n\n\t\t\tstatic const string REGEX_IDENTIFIER;\n\t\t\tstatic const string REGEX_NUMBER;\n\t\t\tstatic const string REGEX_ESCSEQ;\n\t\t\t\n\t\t\t// path to loaded language definition\n\t\t\tstring currentPath;\n\n\t\t\t// Language description\n\t\t\tstring langDesc;\n\t\t\t\n\t\t\tstring headerInjection, footerInjection;\n\n\t\t\tstring regexErrorMsg, luaErrorMsg;\n\n\t\t\tKeywordMap keywords;\n\n\t\t\tvector <string> keywordClasses;\n\n\t\t\tvector <RegexElement*> regex;\n\n\t\t\t// collect delimiters or get current delimiter in CodeGenerator::loadEmbeddedLang\n\t\t\tstatic EmbedLangDelimMap exitDelimiters;\n\n\t\t\t// saves if delimiter pair consists of the same delimiter symbol\n\t\t\tmap <int, bool> delimiterDistinct;\n\n\t\t\tmap <int, bool> rawStringOpenDelims;\n\n\t\t\tmap <int, int> delimIds2;\n\n\t\t\t// keywords are not case sensitive if set\n\t\t\tbool ignoreCase,\n\n\t\t\t// highlighting is disabled\n\t\t\tdisableHighlighting,\n\n\t\t\t// allow nested multi line comment blocks\n\t\t\tallowNestedComments,\n\n\t\t\t// code formatting is enabled if set\n\t\t\treformatCode;\n\n\t\t\t// character which is prefix of raw string (c#)\n\t\t\tunsigned char rawStringPrefix,\n\n\t\t\t//character which continues curreent style on next line\n\t\t\tcontinuationChar;\n\n\t\t\t// generate a unique class ID from the class name\n\t\t\tunsigned int generateNewKWClass ( const string& newClassName );\n\n\t\t\tbool readFlag(const Diluculum::LuaVariable& var) ;\n\n\t\t\t// interface for plug-ins: add keywords dynamically\n\t\t\tstatic int luaAddKeyword (lua_State *L);\n\n\t\t\t// interface for plug-ins: read text file and return content string\n\t\t\t//static int luaReadFile (lua_State *L);\n\n\t\t\tvoid addKeyword(unsigned int groupID, const string& kw);\n\n\t\t\t// Functions accessible in Lua State\n\t\t\tDiluculum::LuaFunction* validateStateChangeFct;\n\t\t\tDiluculum::LuaFunction* decorateFct;\n\n\t\t\tDiluculum::LuaState* luaState; // make member to allow interaction with codeparser instance\n\n\t\t\tstatic vector<Diluculum::LuaFunction*> pluginChunks;\n\t};\n\n\n\t/**\\brief Association of a regex with a state description\n\n\t  A RegexElement associates a regular expression with the state information\n\t  (opening and closing state, pattern, keyword class, keyword group id, language name)\n\t*/\n\tclass RegexElement\n\t{\n\t\tpublic:\n\t\t\tRegexElement()\n\t\t\t:open ( STANDARD ), end ( STANDARD ), kwClass ( 0 ),capturingGroup ( -1 ), langName(), instanceId(instanceCnt++)\n\t\t\t{\n\n\t\t\t}\n\n\t\t\tRegexElement ( State oState, State eState, const string&rePattern, unsigned int cID=0, int group=-1, const string& name=\"\" ) :\n\t\t\t\t\topen ( oState ), end ( eState ), kwClass ( cID ), capturingGroup ( group ), langName(name),instanceId(instanceCnt++)\n\t\t\t{\n\t\t\t\trex=boost::xpressive::sregex::compile(rePattern);\n\t\t\t}\n\n\t\t\t~RegexElement() {  instanceCnt--; }\n\n\t\t\tState open, ///< opening state\n\t\t\tend;  ///< closing state\n\t\t\tboost::xpressive::sregex rex;\n\t\t\tunsigned int kwClass;        ///< keyword class\n\t\t\tint capturingGroup;          ///< capturing group ID\n\t\t\tstring langName;             ///< language name\n\t\t\tstatic int instanceCnt;\n\t\t\tint instanceId;\n\t};\n\n\t/**\\brief Association of a regex and its relevant capturing group\n\t*/\n\tstruct RegexDef\n\t{\n\t\tRegexDef() :capturingGroup ( -1 ) {}\n\t\tstring reString;     ///< regex string\n\t\tint capturingGroup;  ///< capturing group which should be recognized as token\n\t};\n\n}\n#endif\n"
  },
  {
    "path": "jni/highlight/include/texgenerator.h",
    "content": "/***************************************************************************\n                          texcode.h  -  description\n                             -------------------\n    begin                : Mit Jul 24 2002\n    copyright            : (C) 2002 by Andrï¿½Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef TEXGENERATOR_H\n#define TEXGENERATOR_H\n\n#include <string>\n\n#include \"codegenerator.h\"\n\n\nnamespace highlight\n{\n\n\t/**\n\t   \\brief This class generates TeX.\n\n\t   It contains information about the resulting document structure (document\n\t   header and footer), the colour system, white space handling and text\n\t   formatting attributes.\n\n\t* @author Andre Simon\n\t*/\n\n\tclass TexGenerator : public highlight::CodeGenerator\n\t{\n\t\tpublic:\n\n\t\t\tTexGenerator();\n\t\t\t~TexGenerator();\n\n\t\tprivate:\n\n\t\t\t/** prints document header\n\t\t\t */\n\t\t\tstring getHeader();\n\n\t\t\t/** Prints document footer*/\n\t\t\tstring getFooter();\n\n\t\t\t/** Prints document body*/\n\t\t\tvoid printBody();\n\n\t\t\t/** initialize tags in specific format according to colouring information provided in DucumentStyle */\n\t\t\tvoid initOutputTags();\n\n\t\t\tstring styleDefinitionCache;\n\n\t\t\tstring getStyleDefinition();\n\n\t\t\t/** \\return escaped character*/\n\t\t\tvirtual string maskCharacter ( unsigned char );\n\n\t\t\t/**\\return text formatting attributes in RTF format */\n\t\t\tstring getAttributes ( const string & elemName, const ElementStyle & elem );\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching sequence to begin a new element formatting*/\n\t\t\tstring getKeywordOpenTag ( unsigned int styleID );\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching  sequence to stop element formatting*/\n\t\t\tstring getKeywordCloseTag ( unsigned int styleID );\n\n\t};\n\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/themereader.h",
    "content": "/***************************************************************************\n                          themereader.h  -  description\n                             -------------------\n    begin                : Son Nov 10 2002\n    copyright            : (C) 2002-2010 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef THEMEREADER_H\n#define THEMEREADER_H\n\n#include <string>\n#include <Diluculum/LuaFunction.hpp>\n#include <Diluculum/LuaVariable.hpp>\n#include \"elementstyle.h\"\n#include \"stylecolour.h\"\n\nusing namespace std;\n\nnamespace highlight\n{\n\n/** maps keyword class names and the corresponding formatting information*/\ntypedef map <string, ElementStyle> KeywordStyles;\n\n/** iterator for keyword styles*/\ntypedef KeywordStyles::const_iterator KSIterator;\n\n/** \\brief Contains information about document formatting properties.\n * @author Andre Simon\n */\n\nclass ThemeReader\n{\nprivate:\n    ElementStyle comment, slcomment, str, dstr,\n                 escapeChar, number, directive, line, operators, interpolation;\n    ElementStyle defaultElem;\n    ElementStyle canvas;\n\n    string errorMsg;\n    string desc;\n    string themeInjections;\n    //vector <string> injections;\n\n    vector<Diluculum::LuaFunction*> pluginChunks;\n\n    bool fileOK;\n\n    KeywordStyles keywordStyles;\n\n    void initStyle(ElementStyle& style, const Diluculum::LuaVariable& var);\n\npublic:\n    /** Constructor */\n    ThemeReader();\n    ~ThemeReader();\n\n    /** load style definition\n          \\param styleDefinitionFile Style definition path\n          \\return True if successfull */\n    bool load ( const string & styleDefinitionFile, OutputType outputType=HTML );\n\n    void addUserChunk(const Diluculum::LuaFunction& chunk) {\n\n        pluginChunks.push_back(new Diluculum::LuaFunction(chunk));\n    }\n\n    /** \\return class names defined in the theme file */\n    vector <string> getClassNames() const;\n\n    /** \\return keyword styles */\n    KeywordStyles getKeywordStyles() const;\n\n    /** \\return Font size */\n    string getErrorMessage() const;\n\n    string getDescription() const {\n        return desc;\n    }\n\n    string getInjections() const;\n\n    /** \\return Background colour*/\n    Colour getBgColour() const;\n\n    /** \\return Style of default (unrecognized) strings */\n    ElementStyle getDefaultStyle() const;\n\n    /** \\return Comment style*/\n    ElementStyle getCommentStyle() const;\n\n    /** \\return Single line comment style*/\n    ElementStyle getSingleLineCommentStyle() const;\n\n    /** \\return String style*/\n    ElementStyle getStringStyle() const;\n\n    /** \\return Directive line string style*/\n    ElementStyle getPreProcStringStyle() const;\n\n    /** \\return Escape character style*/\n    ElementStyle getEscapeCharStyle() const;\n    \n        /** \\return String interpolation style*/\n    ElementStyle getInterpolationStyle() const;\n\n    /** \\return Number style*/\n    ElementStyle getNumberStyle() const;\n\n    /** \\return Directive style*/\n    ElementStyle getPreProcessorStyle() const;\n\n    /** \\return Type style*/\n    ElementStyle getTypeStyle() const;\n\n    /** \\return Line number style*/\n    ElementStyle getLineStyle() const;\n\n    /** \\return Operator style*/\n    ElementStyle getOperatorStyle() const;\n\n    /** \\param className Name of keyword class (eg kwa, kwb, .., kwd)\n        \\return keyword style of the given className\n    */\n    ElementStyle getKeywordStyle ( const string &className ) ;\n\n    /** \\return True if language definition was found */\n    bool found() const ;\n};\n\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/version.h",
    "content": "/***************************************************************************\n                          version.h  -  description\n                             -------------------\n    begin                : Mon March 3 2003\n    copyright            : (C) 2003-2015 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef VERSION_H\n#define VERSION_H\n\n#define HIGHLIGHT_VERSION \"3.23\"\n\n#define HIGHLIGHT_URL \"http://www.andre-simon.de/\"\n#define HIGHLIGHT_EMAIL \"andre.simon1@gmx.de\"\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/xhtmlgenerator.h",
    "content": "/***************************************************************************\n                         xhtmlgenerator.h  -  description\n                             -------------------\n    begin                : Mo Jun 21 2004\n    copyright            : (C) 2004 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n\n#ifndef XHTMLGENERATOR_H\n#define XHTMLGENERATOR_H\n\n#include \"htmlgenerator.h\"\n\nnamespace highlight\n{\n\n\t/**\n\t   \\brief This class generates XHTML.\n\n\t   It contains information about the resulting document structure (document\n\t   header and footer), the colour system, white space handling and text\n\t   formatting attributes.\n\n\t* @author Andre Simon\n\t*/\n\n\n\tclass XHtmlGenerator : public highlight::HtmlGenerator\n\t{\n\t\tpublic:\n\n\t\t\tXHtmlGenerator();\n\n\t\t\t~XHtmlGenerator() {};\n\n\t\tprivate:\n\n\t\t\t/** prints document header\n\t\t\t*/\n\t\t\tstring getHeader();\n\n\t\t\tstring getHeaderStart ( const string &title );\n\n\t};\n\n}\n\n#endif\n"
  },
  {
    "path": "jni/highlight/include/xterm256generator.h",
    "content": "/***************************************************************************\n                       xterm256generator.h  -  description\n                             -------------------\n    begin                : Oct 13 2006\n    copyright            : (C) 2006-2007 by Andre Simon\n    email                : andre.simon1@gmx.de\n ***************************************************************************/\n\n\n/*\nThis file is part of Highlight.\n\nHighlight is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nHighlight is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Highlight.  If not, see <http://www.gnu.org/licenses/>.\n*/\n\n\n#ifndef XTERM256GENERATOR_H\n#define XTERM256GENERATOR_H\n\n#include <string>\n\n#include \"codegenerator.h\"\n\n\nnamespace highlight\n{\n\n\t/**\n\t   \\brief This class generates xterm 256 color escape sequences.\n\n\t   It contains information about the resulting document structure (document\n\t   header and footer), the colour system, white space handling and text\n\t   formatting attributes.\n\n\t* @author Andre Simon\n\t*/\n\n\tclass Xterm256Generator : public highlight::CodeGenerator\n\t{\n\t\tpublic:\n\t\t\tXterm256Generator();\n\t\t\t~Xterm256Generator();\n\n\t\tprivate:\n\n\t\t\t/** prints document header\n\t\t\t */\n\t\t\tstring getHeader();\n\n\t\t\t/** Prints document footer*/\n\t\t\tstring getFooter();\n\n\t\t\t/** Prints document body*/\n\t\t\tvoid printBody();\n\n\t\t\t/** \\return escaped character*/\n\t\t\tvirtual string maskCharacter ( unsigned char );\n\n\t\t\t/** initialize tags in specific format according to colouring information provided in DucumentStyle */\n\t\t\tvoid initOutputTags();\n\n\t\t\t/** @param style associated element style\n\t\t\t    @return formatting seqence */\n\t\t\tstring getOpenTag (const ElementStyle &style );\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching sequence to begin a new element formatting*/\n\t\t\tstring getKeywordOpenTag ( unsigned int styleID );\n\n\t\t\t/** @param styleID current style ID\n\t\t\t    @return matching sequence to close element formatting*/\n\t\t\tstring getKeywordCloseTag ( unsigned int styleID );\n\n\t\t\t/** convert an xterm color value (0-253) to 3 unsigned chars rgb\n\t\t\t    @param color xterm color\n\t\t\t    @param rgb RGB destination string */\n\t\t\tvoid xterm2rgb ( unsigned char color, unsigned char* rgb );\n\n\t\t\t/** fill the colortable for use with rgb2xterm */\n\t\t\tvoid maketable();\n\n\t\t\t/** selects the nearest xterm color for a 3xBYTE rgb value\n\t\t\t    @param RGB colour string */\n\t\t\tunsigned char rgb2xterm ( unsigned char* rgb );\n\n\t\t\t/// Flag to determine if colourtable is calculated\n\t\t\tstatic bool initialized;\n\n\t\t\t/// color tzable for nearest match calculation\n\t\t\tstatic unsigned char colortable[254][3];\n\n\t\t\t/// the 6 value iterations in the xterm color cube\n\t\t\tstatic const unsigned char valuerange[] ;\n\n\t\t\t/// 16 basic colors\n\t\t\tstatic const unsigned char basic16[16][3];\n\t};\n\n}\n#endif\n"
  },
  {
    "path": "jni/highlight/makefile",
    "content": "# Simple Makefile for Highlight\r\n# This file will compile the highlight library and binaries.\r\n# See INSTALL for instructions.\r\n\r\n# Add -DHL_DATA_DIR=\\\"/your/path/\\\" to CFLAGS if you want to define a\r\n# custom installation directory not listed in INSTALL.\r\n# Copy *.conf, ./langDefs, ./themes amd ./indentSchemes to /your/path/.\r\n# See ../makefile for the definition of ${data_dir}\r\n\r\n# Add -DHL_CONFIG_DIR=\\\"/your/path/\\\" to define the configuration directory\r\n# (default: /etc/highlight)\r\n\r\n# See src/gui-qt/highlight.pro for the Qt GUI compilation options\r\n\r\nCXX=c++\r\n\r\n# Added -qt4 because of Arch Linux Qt5 migration\r\nQMAKE=qmake-qt4\r\n\r\nCFLAGS:=-Wall -O2 ${CFLAGS} -DNDEBUG\r\n#CFLAGS:=-ggdb ${CFLAGS}\r\n\r\nCFLAGS_DILU=-fno-strict-aliasing\r\n\r\nSO_VERSION=3.23\r\n\r\n\r\n# Source paths\r\nCORE_DIR=./core/\r\nCLI_DIR=./cli/\r\nGUI_QT_DIR=./gui-qt/\r\n\r\n# Include path\r\nINCLUDE_DIR=./include/\r\n\r\n\r\n# If Lua 5.2 is not default on your system yet you have to\r\n# use lua5.1 in the pkg-config calls\r\n\r\nLUA_CFLAGS=$(shell pkg-config --cflags lua)\r\n\r\n# default lua lib\r\nLUA_LIBS=$(shell pkg-config --libs lua)\r\n\r\n# luajit lib\r\n# LUA_LIBS=$(shell pkg-config --libs luajit)\r\n\r\n# Third-Party software paths\r\nASTYLE_DIR=${CORE_DIR}astyle/\r\nREGEX_DIR=${CORE_DIR}re/\r\nDILU_DIR=${CORE_DIR}Diluculum/\r\n\r\nifndef HL_CONFIG_DIR\r\n\tHL_CONFIG_DIR = /etc/highlight/\r\nendif\r\nifndef HL_DATA_DIR\r\n\tHL_DATA_DIR = /usr/share/highlight/\r\nendif\r\nifdef PIC\r\n\tCFLAGS+=-fPIC\r\nendif\r\n\r\nLDFLAGS = -ldl\r\n# Do not strip by default (Mac OS X lazy pointer issues)\r\n# Add -static to avoid linking with shared libs (can cause trouble when highlight\r\n# is run as service)\r\n#LDFLAGS = ${LDFLAGS} -s\r\n#LDFLAGS= -Wl,--as-needed\r\n\r\nCXX_COMPILE=${CXX} ${CFLAGS} -c -I ${INCLUDE_DIR} ${LUA_CFLAGS}\r\n\r\n# Data directories (data dir, configuration file dir)\r\nCXX_DIR=-DHL_DATA_DIR=\\\"${HL_DATA_DIR}\\\" -DHL_CONFIG_DIR=\\\"${HL_CONFIG_DIR}\\\"\r\n\r\nAR=ar\r\nARFLAGS=-crs\r\n\r\n# objects files to build the library\r\nCORE_OBJECTS:=stylecolour.o stringtools.o \\\r\n\txhtmlgenerator.o latexgenerator.o texgenerator.o rtfgenerator.o \\\r\n\thtmlgenerator.o ansigenerator.o svggenerator.o codegenerator.o \\\r\n\txterm256generator.o pangogenerator.o bbcodegenerator.o odtgenerator.o\\\r\n\tsyntaxreader.o elementstyle.o themereader.o \\\r\n\tdatadir.o preformatter.o platform_fs.o\\\r\n\tASStreamIterator.o ASResource.o ASFormatter.o ASBeautifier.o ASEnhancer.o\r\n\r\nDILU_OBJECTS:=InternalUtils.o  LuaExceptions.o  LuaFunction.o  LuaState.o\\\r\n\tLuaUserData.o  LuaUtils.o  LuaValue.o  LuaVariable.o  LuaWrappers.o\r\n\r\n# command line interface\r\nCLI_OBJECTS:=arg_parser.o cmdlineoptions.o main.o help.o\r\n\r\n# Qt user interface\r\nGUI_OBJECTS:=${GUI_QT_DIR}main.cpp ${GUI_QT_DIR}mainwindow.cpp ${GUI_QT_DIR}io_report.cpp\\\r\n\t${GUI_QT_DIR}showtextfile.cpp\r\n\r\n\r\ncli: libhighlight.a ${CLI_OBJECTS}\r\n\t${CXX} ${LDFLAGS} -o highlight ${CLI_OBJECTS} -L. -lhighlight ${LUA_LIBS}\r\n\r\nlib-static libhighlight.a: ${CORE_OBJECTS}\r\n\t${AR} ${ARFLAGS} libhighlight.a ${CORE_OBJECTS} ${DILU_OBJECTS}\r\n\r\nlib-shared libhighlight.so.1.0: ${CORE_OBJECTS}\r\n\tld -shared -soname libhighlight.so.1 -o libhighlight.so.${SO_VERSION} -lc ${CORE_OBJECTS}\r\n\r\ngui-qt: highlight-gui\r\n\r\nhighlight-gui: libhighlight.a ${GUI_OBJECTS}\r\n\tcd gui-qt && \\\r\n\t${QMAKE} 'DEFINES+=DATA_DIR=\\\\\\\"${HL_DATA_DIR}\\\\\\\" CONFIG_DIR=\\\\\\\"${HL_CONFIG_DIR}\\\\\\\" DOC_DIR=\\\\\\\"${HL_DOC_DIR}\\\\\\\" ' && \\\r\n\t$(MAKE)\r\n\r\n$(OBJECTFILES) : makefile\r\n\r\n\r\ndatadir.o: ${CORE_DIR}datadir.cpp ${INCLUDE_DIR}datadir.h ${INCLUDE_DIR}platform_fs.h\r\n\t${CXX_COMPILE} ${CORE_DIR}datadir.cpp ${CXX_DIR}\r\n\r\nplatform_fs.o: ${CORE_DIR}platform_fs.cpp ${INCLUDE_DIR}platform_fs.h\r\n\t${CXX_COMPILE} ${CORE_DIR}platform_fs.cpp\r\n\r\nthemereader.o: ${CORE_DIR}themereader.cpp ${INCLUDE_DIR}themereader.h \\\r\n  ${INCLUDE_DIR}stringtools.h ${INCLUDE_DIR}elementstyle.h ${INCLUDE_DIR}stylecolour.h ${DILU_OBJECTS}\r\n\t${CXX_COMPILE} ${CORE_DIR}themereader.cpp\r\n\r\nelementstyle.o: ${CORE_DIR}elementstyle.cpp ${INCLUDE_DIR}elementstyle.h ${INCLUDE_DIR}stylecolour.h\r\n\t${CXX_COMPILE} ${CORE_DIR}elementstyle.cpp\r\n\r\nsyntaxreader.o: ${CORE_DIR}syntaxreader.cpp ${INCLUDE_DIR}syntaxreader.h \\\r\n  ${INCLUDE_DIR}platform_fs.h ${INCLUDE_DIR}enums.h ${INCLUDE_DIR}stringtools.h\r\n\t${CXX_COMPILE} ${CORE_DIR}syntaxreader.cpp\r\n\r\ncodegenerator.o: ${CORE_DIR}codegenerator.cpp ${INCLUDE_DIR}codegenerator.h ${INCLUDE_DIR}syntaxreader.h \\\r\n  ${INCLUDE_DIR}stringtools.h ${INCLUDE_DIR}enums.h ${INCLUDE_DIR}themereader.h \\\r\n  ${INCLUDE_DIR}elementstyle.h ${INCLUDE_DIR}stylecolour.h ${INCLUDE_DIR}preformatter.h \\\r\n  ${INCLUDE_DIR}htmlgenerator.h ${INCLUDE_DIR}version.h ${INCLUDE_DIR}charcodes.h ${INCLUDE_DIR}xhtmlgenerator.h ${INCLUDE_DIR}rtfgenerator.h \\\r\n  ${INCLUDE_DIR}latexgenerator.h ${INCLUDE_DIR}texgenerator.h ${INCLUDE_DIR}ansigenerator.h\r\n\t${CXX_COMPILE} ${CORE_DIR}codegenerator.cpp\r\n\r\nansigenerator.o: ${CORE_DIR}ansigenerator.cpp ${INCLUDE_DIR}ansigenerator.h ${INCLUDE_DIR}codegenerator.h\r\n\t${CXX_COMPILE} ${CORE_DIR}ansigenerator.cpp\r\n\r\nhtmlgenerator.o: ${CORE_DIR}htmlgenerator.cpp ${INCLUDE_DIR}htmlgenerator.h ${INCLUDE_DIR}codegenerator.h\r\n\t${CXX_COMPILE} ${CORE_DIR}htmlgenerator.cpp\r\n\r\nlatexgenerator.o: ${CORE_DIR}latexgenerator.cpp ${INCLUDE_DIR}latexgenerator.h ${INCLUDE_DIR}codegenerator.h\r\n\t${CXX_COMPILE} ${CORE_DIR}latexgenerator.cpp\r\n\r\nbbcodegenerator.o: ${CORE_DIR}bbcodegenerator.cpp ${INCLUDE_DIR}bbcodegenerator.h ${INCLUDE_DIR}codegenerator.h\r\n\t${CXX_COMPILE} ${CORE_DIR}bbcodegenerator.cpp\r\n\r\npangogenerator.o: ${CORE_DIR}pangogenerator.cpp ${INCLUDE_DIR}pangogenerator.h ${INCLUDE_DIR}codegenerator.h\r\n\t${CXX_COMPILE} ${CORE_DIR}pangogenerator.cpp\r\n\r\nodtgenerator.o: ${CORE_DIR}odtgenerator.cpp ${INCLUDE_DIR}odtgenerator.h ${INCLUDE_DIR}codegenerator.h\r\n\t${CXX_COMPILE} ${CORE_DIR}odtgenerator.cpp\r\n\t\r\nrtfgenerator.o: ${CORE_DIR}rtfgenerator.cpp ${INCLUDE_DIR}rtfgenerator.h ${INCLUDE_DIR}codegenerator.h\r\n\t${CXX_COMPILE} ${CORE_DIR}rtfgenerator.cpp\r\n\r\ntexgenerator.o: ${CORE_DIR}texgenerator.cpp ${INCLUDE_DIR}texgenerator.h ${INCLUDE_DIR}codegenerator.h\r\n\t${CXX_COMPILE} ${CORE_DIR}texgenerator.cpp\r\n\r\nxhtmlgenerator.o: ${CORE_DIR}xhtmlgenerator.cpp ${INCLUDE_DIR}xhtmlgenerator.h ${INCLUDE_DIR}htmlgenerator.h \\\r\n  ${INCLUDE_DIR}codegenerator.h\r\n\t${CXX_COMPILE} ${CORE_DIR}xhtmlgenerator.cpp\r\n\r\nsvggenerator.o: ${CORE_DIR}svggenerator.cpp ${INCLUDE_DIR}svggenerator.h ${INCLUDE_DIR}codegenerator.h\r\n\t${CXX_COMPILE} ${CORE_DIR}svggenerator.cpp\r\n\r\nxterm256generator.o: ${CORE_DIR}xterm256generator.cpp ${INCLUDE_DIR}xterm256generator.h ${INCLUDE_DIR}codegenerator.h\r\n\t${CXX_COMPILE} ${CORE_DIR}xterm256generator.cpp\r\n\r\npreformatter.o: ${CORE_DIR}preformatter.cpp ${INCLUDE_DIR}preformatter.h ${INCLUDE_DIR}stringtools.h\r\n\t${CXX_COMPILE} ${CORE_DIR}preformatter.cpp\r\n\r\nstringtools.o: ${CORE_DIR}stringtools.cpp ${INCLUDE_DIR}stringtools.h\r\n\t${CXX_COMPILE} ${CORE_DIR}stringtools.cpp\r\n\r\nstylecolour.o: ${CORE_DIR}stylecolour.cpp ${INCLUDE_DIR}stylecolour.h ${INCLUDE_DIR}enums.h ${INCLUDE_DIR}stringtools.h\r\n\t${CXX_COMPILE} ${CORE_DIR}stylecolour.cpp\r\n\r\n# cli stuff\r\narg_parser.o: ${CLI_DIR}arg_parser.cc\r\n\t${CXX_COMPILE} ${CLI_DIR}arg_parser.cc\r\n\r\ncmdlineoptions.o: ${CLI_DIR}cmdlineoptions.cpp ${CLI_DIR}cmdlineoptions.h\r\n\t${CXX_COMPILE} ${CLI_DIR}cmdlineoptions.cpp\r\n\r\nhelp.o: ${CLI_DIR}help.cpp ${CLI_DIR}help.h\r\n\t${CXX_COMPILE} ${CLI_DIR}help.cpp\r\n\r\nmain.o: ${CLI_DIR}main.cpp ${CLI_DIR}main.h ${CLI_DIR}cmdlineoptions.h ${INCLUDE_DIR}platform_fs.h \\\r\n  ${INCLUDE_DIR}datadir.h ${INCLUDE_DIR}enums.h ${INCLUDE_DIR}codegenerator.h \\\r\n  ${INCLUDE_DIR}syntaxreader.h ${INCLUDE_DIR}themereader.h ${INCLUDE_DIR}elementstyle.h \\\r\n  ${INCLUDE_DIR}stylecolour.h  ${INCLUDE_DIR}preformatter.h \\\r\n  ${CLI_DIR}help.h ${INCLUDE_DIR}version.h\r\n\t${CXX_COMPILE} ${CLI_DIR}main.cpp ${CXX_DIR}\r\n\r\n\r\n#3rd party libs\r\n\r\nASBeautifier.o: ${ASTYLE_DIR}ASBeautifier.cpp\r\n\t${CXX_COMPILE} ${ASTYLE_DIR}ASBeautifier.cpp\r\n\r\nASFormatter.o: ${ASTYLE_DIR}ASFormatter.cpp\r\n\t${CXX_COMPILE} ${ASTYLE_DIR}ASFormatter.cpp\r\n\r\nASResource.o: ${ASTYLE_DIR}ASResource.cpp\r\n\t${CXX_COMPILE} ${ASTYLE_DIR}ASResource.cpp\r\n\r\nASEnhancer.o: ${ASTYLE_DIR}ASResource.cpp\r\n\t${CXX_COMPILE} ${ASTYLE_DIR}ASEnhancer.cpp\r\n\r\nASStreamIterator.o: ${ASTYLE_DIR}ASStreamIterator.cpp\r\n\t${CXX_COMPILE} ${ASTYLE_DIR}ASStreamIterator.cpp\r\n\r\nInternalUtils.o: ${DILU_DIR}InternalUtils.cpp\r\n\t${CXX_COMPILE}  ${DILU_DIR}InternalUtils.cpp\r\nLuaExceptions.o: ${DILU_DIR}LuaExceptions.cpp\r\n\t${CXX_COMPILE}  ${DILU_DIR}LuaExceptions.cpp\r\nLuaFunction.o: ${DILU_DIR}LuaFunction.cpp\r\n\t${CXX_COMPILE} ${DILU_DIR}LuaFunction.cpp\r\nLuaState.o: ${DILU_DIR}LuaState.cpp\r\n\t${CXX_COMPILE} ${DILU_DIR}LuaState.cpp\r\nLuaUserData.o: ${DILU_DIR}LuaUserData.cpp\r\n\t${CXX_COMPILE} ${DILU_DIR}LuaUserData.cpp\r\nLuaUtils.o: ${DILU_DIR}LuaUtils.cpp\r\n\t${CXX_COMPILE} ${DILU_DIR}LuaUtils.cpp\r\nLuaValue.o: ${DILU_DIR}LuaValue.cpp\r\n\t${CXX_COMPILE} ${CFLAGS_DILU} ${DILU_DIR}LuaValue.cpp\r\nLuaVariable.o: ${DILU_DIR}LuaVariable.cpp\r\n\t${CXX_COMPILE} ${DILU_DIR}LuaVariable.cpp\r\nLuaWrappers.o: ${DILU_DIR}LuaWrappers.cpp\r\n\t${CXX_COMPILE} ${DILU_DIR}LuaWrappers.cpp\r\n\r\n.PHONY: ${GUI_OBJECTS}\r\n\r\nclean:\r\n\t@rm -f *.o\r\n\t@rm -f ./highlight\r\n\t@rm -f ./highlight-gui\r\n\t@rm -f ./libhighlight.a\r\n\t@rm -f ./libhighlight.so.*\r\n\t@rm -f ./.deps/*\r\n\t@rm -f gui-qt/*.o\r\n\t@rm -f gui-qt/Makefile*\r\n\t@rm -f gui-qt/object_script.*\r\n\t@rm -f gui-qt/ui_*.h gui-qt/qrc_*.cpp gui-qt/moc_*.cpp\r\n\t@rm -rf gui-qt/highlight-gui.gch/\r\n"
  },
  {
    "path": "jni/lua/Android.mk",
    "content": "LOCAL_PATH := $(call my-dir)\n\ninclude $(CLEAR_VARS)\n\nLOCAL_MODULE    := lua\nLOCAL_SRC_FILES := lapi.c lauxlib.c lbaselib.c lcode.c ldblib.c ldebug.c ldo.c ldump.c lfunc.c lgc.c linit.c liolib.c llex.c lmathlib.c lmem.c loadlib.c lobject.c lopcodes.c loslib.c lparser.c lstate.c lstring.c lstrlib.c ltable.c ltablib.c ltm.c lundump.c lvm.c lzio.c\nLOCAL_LDLIBS    :=  -lm\n\n#include $(BUILD_STATIC_LIBRARY)\ninclude $(BUILD_SHARED_LIBRARY)\n"
  },
  {
    "path": "jni/lua/lapi.c",
    "content": "/*\n** $Id: lapi.c,v 2.55.1.5 2008/07/04 18:41:18 roberto Exp $\n** Lua API\n** See Copyright Notice in lua.h\n*/\n\n\n#include <assert.h>\n#include <math.h>\n#include <stdarg.h>\n#include <string.h>\n\n#define lapi_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"lapi.h\"\n#include \"ldebug.h\"\n#include \"ldo.h\"\n#include \"lfunc.h\"\n#include \"lgc.h\"\n#include \"lmem.h\"\n#include \"lobject.h\"\n#include \"lstate.h\"\n#include \"lstring.h\"\n#include \"ltable.h\"\n#include \"ltm.h\"\n#include \"lundump.h\"\n#include \"lvm.h\"\n\n\n\nconst char lua_ident[] =\n  \"$Lua: \" LUA_RELEASE \" \" LUA_COPYRIGHT \" $\\n\"\n  \"$Authors: \" LUA_AUTHORS \" $\\n\"\n  \"$URL: www.lua.org $\\n\";\n\n\n\n#define api_checknelems(L, n)\tapi_check(L, (n) <= (L->top - L->base))\n\n#define api_checkvalidindex(L, i)\tapi_check(L, (i) != luaO_nilobject)\n\n#define api_incr_top(L)   {api_check(L, L->top < L->ci->top); L->top++;}\n\n\n\nstatic TValue *index2adr (lua_State *L, int idx) {\n  if (idx > 0) {\n    TValue *o = L->base + (idx - 1);\n    api_check(L, idx <= L->ci->top - L->base);\n    if (o >= L->top) return cast(TValue *, luaO_nilobject);\n    else return o;\n  }\n  else if (idx > LUA_REGISTRYINDEX) {\n    api_check(L, idx != 0 && -idx <= L->top - L->base);\n    return L->top + idx;\n  }\n  else switch (idx) {  /* pseudo-indices */\n    case LUA_REGISTRYINDEX: return registry(L);\n    case LUA_ENVIRONINDEX: {\n      Closure *func = curr_func(L);\n      sethvalue(L, &L->env, func->c.env);\n      return &L->env;\n    }\n    case LUA_GLOBALSINDEX: return gt(L);\n    default: {\n      Closure *func = curr_func(L);\n      idx = LUA_GLOBALSINDEX - idx;\n      return (idx <= func->c.nupvalues)\n                ? &func->c.upvalue[idx-1]\n                : cast(TValue *, luaO_nilobject);\n    }\n  }\n}\n\n\nstatic Table *getcurrenv (lua_State *L) {\n  if (L->ci == L->base_ci)  /* no enclosing function? */\n    return hvalue(gt(L));  /* use global table as environment */\n  else {\n    Closure *func = curr_func(L);\n    return func->c.env;\n  }\n}\n\n\nvoid luaA_pushobject (lua_State *L, const TValue *o) {\n  setobj2s(L, L->top, o);\n  api_incr_top(L);\n}\n\n\nLUA_API int lua_checkstack (lua_State *L, int size) {\n  int res = 1;\n  lua_lock(L);\n  if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK)\n    res = 0;  /* stack overflow */\n  else if (size > 0) {\n    luaD_checkstack(L, size);\n    if (L->ci->top < L->top + size)\n      L->ci->top = L->top + size;\n  }\n  lua_unlock(L);\n  return res;\n}\n\n\nLUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {\n  int i;\n  if (from == to) return;\n  lua_lock(to);\n  api_checknelems(from, n);\n  api_check(from, G(from) == G(to));\n  api_check(from, to->ci->top - to->top >= n);\n  from->top -= n;\n  for (i = 0; i < n; i++) {\n    setobj2s(to, to->top++, from->top + i);\n  }\n  lua_unlock(to);\n}\n\n\nLUA_API void lua_setlevel (lua_State *from, lua_State *to) {\n  to->nCcalls = from->nCcalls;\n}\n\n\nLUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {\n  lua_CFunction old;\n  lua_lock(L);\n  old = G(L)->panic;\n  G(L)->panic = panicf;\n  lua_unlock(L);\n  return old;\n}\n\n\nLUA_API lua_State *lua_newthread (lua_State *L) {\n  lua_State *L1;\n  lua_lock(L);\n  luaC_checkGC(L);\n  L1 = luaE_newthread(L);\n  setthvalue(L, L->top, L1);\n  api_incr_top(L);\n  lua_unlock(L);\n  luai_userstatethread(L, L1);\n  return L1;\n}\n\n\n\n/*\n** basic stack manipulation\n*/\n\n\nLUA_API int lua_gettop (lua_State *L) {\n  return cast_int(L->top - L->base);\n}\n\n\nLUA_API void lua_settop (lua_State *L, int idx) {\n  lua_lock(L);\n  if (idx >= 0) {\n    api_check(L, idx <= L->stack_last - L->base);\n    while (L->top < L->base + idx)\n      setnilvalue(L->top++);\n    L->top = L->base + idx;\n  }\n  else {\n    api_check(L, -(idx+1) <= (L->top - L->base));\n    L->top += idx+1;  /* `subtract' index (index is negative) */\n  }\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_remove (lua_State *L, int idx) {\n  StkId p;\n  lua_lock(L);\n  p = index2adr(L, idx);\n  api_checkvalidindex(L, p);\n  while (++p < L->top) setobjs2s(L, p-1, p);\n  L->top--;\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_insert (lua_State *L, int idx) {\n  StkId p;\n  StkId q;\n  lua_lock(L);\n  p = index2adr(L, idx);\n  api_checkvalidindex(L, p);\n  for (q = L->top; q>p; q--) setobjs2s(L, q, q-1);\n  setobjs2s(L, p, L->top);\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_replace (lua_State *L, int idx) {\n  StkId o;\n  lua_lock(L);\n  /* explicit test for incompatible code */\n  if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci)\n    luaG_runerror(L, \"no calling environment\");\n  api_checknelems(L, 1);\n  o = index2adr(L, idx);\n  api_checkvalidindex(L, o);\n  if (idx == LUA_ENVIRONINDEX) {\n    Closure *func = curr_func(L);\n    api_check(L, ttistable(L->top - 1)); \n    func->c.env = hvalue(L->top - 1);\n    luaC_barrier(L, func, L->top - 1);\n  }\n  else {\n    setobj(L, o, L->top - 1);\n    if (idx < LUA_GLOBALSINDEX)  /* function upvalue? */\n      luaC_barrier(L, curr_func(L), L->top - 1);\n  }\n  L->top--;\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_pushvalue (lua_State *L, int idx) {\n  lua_lock(L);\n  setobj2s(L, L->top, index2adr(L, idx));\n  api_incr_top(L);\n  lua_unlock(L);\n}\n\n\n\n/*\n** access functions (stack -> C)\n*/\n\n\nLUA_API int lua_type (lua_State *L, int idx) {\n  StkId o = index2adr(L, idx);\n  return (o == luaO_nilobject) ? LUA_TNONE : ttype(o);\n}\n\n\nLUA_API const char *lua_typename (lua_State *L, int t) {\n  UNUSED(L);\n  return (t == LUA_TNONE) ? \"no value\" : luaT_typenames[t];\n}\n\n\nLUA_API int lua_iscfunction (lua_State *L, int idx) {\n  StkId o = index2adr(L, idx);\n  return iscfunction(o);\n}\n\n\nLUA_API int lua_isnumber (lua_State *L, int idx) {\n  TValue n;\n  const TValue *o = index2adr(L, idx);\n  return tonumber(o, &n);\n}\n\n\nLUA_API int lua_isstring (lua_State *L, int idx) {\n  int t = lua_type(L, idx);\n  return (t == LUA_TSTRING || t == LUA_TNUMBER);\n}\n\n\nLUA_API int lua_isuserdata (lua_State *L, int idx) {\n  const TValue *o = index2adr(L, idx);\n  return (ttisuserdata(o) || ttislightuserdata(o));\n}\n\n\nLUA_API int lua_rawequal (lua_State *L, int index1, int index2) {\n  StkId o1 = index2adr(L, index1);\n  StkId o2 = index2adr(L, index2);\n  return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0\n         : luaO_rawequalObj(o1, o2);\n}\n\n\nLUA_API int lua_equal (lua_State *L, int index1, int index2) {\n  StkId o1, o2;\n  int i;\n  lua_lock(L);  /* may call tag method */\n  o1 = index2adr(L, index1);\n  o2 = index2adr(L, index2);\n  i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 : equalobj(L, o1, o2);\n  lua_unlock(L);\n  return i;\n}\n\n\nLUA_API int lua_lessthan (lua_State *L, int index1, int index2) {\n  StkId o1, o2;\n  int i;\n  lua_lock(L);  /* may call tag method */\n  o1 = index2adr(L, index1);\n  o2 = index2adr(L, index2);\n  i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0\n       : luaV_lessthan(L, o1, o2);\n  lua_unlock(L);\n  return i;\n}\n\n\n\nLUA_API lua_Number lua_tonumber (lua_State *L, int idx) {\n  TValue n;\n  const TValue *o = index2adr(L, idx);\n  if (tonumber(o, &n))\n    return nvalue(o);\n  else\n    return 0;\n}\n\n\nLUA_API lua_Integer lua_tointeger (lua_State *L, int idx) {\n  TValue n;\n  const TValue *o = index2adr(L, idx);\n  if (tonumber(o, &n)) {\n    lua_Integer res;\n    lua_Number num = nvalue(o);\n    lua_number2integer(res, num);\n    return res;\n  }\n  else\n    return 0;\n}\n\n\nLUA_API int lua_toboolean (lua_State *L, int idx) {\n  const TValue *o = index2adr(L, idx);\n  return !l_isfalse(o);\n}\n\n\nLUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {\n  StkId o = index2adr(L, idx);\n  if (!ttisstring(o)) {\n    lua_lock(L);  /* `luaV_tostring' may create a new string */\n    if (!luaV_tostring(L, o)) {  /* conversion failed? */\n      if (len != NULL) *len = 0;\n      lua_unlock(L);\n      return NULL;\n    }\n    luaC_checkGC(L);\n    o = index2adr(L, idx);  /* previous call may reallocate the stack */\n    lua_unlock(L);\n  }\n  if (len != NULL) *len = tsvalue(o)->len;\n  return svalue(o);\n}\n\n\nLUA_API size_t lua_objlen (lua_State *L, int idx) {\n  StkId o = index2adr(L, idx);\n  switch (ttype(o)) {\n    case LUA_TSTRING: return tsvalue(o)->len;\n    case LUA_TUSERDATA: return uvalue(o)->len;\n    case LUA_TTABLE: return luaH_getn(hvalue(o));\n    case LUA_TNUMBER: {\n      size_t l;\n      lua_lock(L);  /* `luaV_tostring' may create a new string */\n      l = (luaV_tostring(L, o) ? tsvalue(o)->len : 0);\n      lua_unlock(L);\n      return l;\n    }\n    default: return 0;\n  }\n}\n\n\nLUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {\n  StkId o = index2adr(L, idx);\n  return (!iscfunction(o)) ? NULL : clvalue(o)->c.f;\n}\n\n\nLUA_API void *lua_touserdata (lua_State *L, int idx) {\n  StkId o = index2adr(L, idx);\n  switch (ttype(o)) {\n    case LUA_TUSERDATA: return (rawuvalue(o) + 1);\n    case LUA_TLIGHTUSERDATA: return pvalue(o);\n    default: return NULL;\n  }\n}\n\n\nLUA_API lua_State *lua_tothread (lua_State *L, int idx) {\n  StkId o = index2adr(L, idx);\n  return (!ttisthread(o)) ? NULL : thvalue(o);\n}\n\n\nLUA_API const void *lua_topointer (lua_State *L, int idx) {\n  StkId o = index2adr(L, idx);\n  switch (ttype(o)) {\n    case LUA_TTABLE: return hvalue(o);\n    case LUA_TFUNCTION: return clvalue(o);\n    case LUA_TTHREAD: return thvalue(o);\n    case LUA_TUSERDATA:\n    case LUA_TLIGHTUSERDATA:\n      return lua_touserdata(L, idx);\n    default: return NULL;\n  }\n}\n\n\n\n/*\n** push functions (C -> stack)\n*/\n\n\nLUA_API void lua_pushnil (lua_State *L) {\n  lua_lock(L);\n  setnilvalue(L->top);\n  api_incr_top(L);\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_pushnumber (lua_State *L, lua_Number n) {\n  lua_lock(L);\n  setnvalue(L->top, n);\n  api_incr_top(L);\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_pushinteger (lua_State *L, lua_Integer n) {\n  lua_lock(L);\n  setnvalue(L->top, cast_num(n));\n  api_incr_top(L);\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {\n  lua_lock(L);\n  luaC_checkGC(L);\n  setsvalue2s(L, L->top, luaS_newlstr(L, s, len));\n  api_incr_top(L);\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_pushstring (lua_State *L, const char *s) {\n  if (s == NULL)\n    lua_pushnil(L);\n  else\n    lua_pushlstring(L, s, strlen(s));\n}\n\n\nLUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt,\n                                      va_list argp) {\n  const char *ret;\n  lua_lock(L);\n  luaC_checkGC(L);\n  ret = luaO_pushvfstring(L, fmt, argp);\n  lua_unlock(L);\n  return ret;\n}\n\n\nLUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) {\n  const char *ret;\n  va_list argp;\n  lua_lock(L);\n  luaC_checkGC(L);\n  va_start(argp, fmt);\n  ret = luaO_pushvfstring(L, fmt, argp);\n  va_end(argp);\n  lua_unlock(L);\n  return ret;\n}\n\n\nLUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {\n  Closure *cl;\n  lua_lock(L);\n  luaC_checkGC(L);\n  api_checknelems(L, n);\n  cl = luaF_newCclosure(L, n, getcurrenv(L));\n  cl->c.f = fn;\n  L->top -= n;\n  while (n--)\n    setobj2n(L, &cl->c.upvalue[n], L->top+n);\n  setclvalue(L, L->top, cl);\n  lua_assert(iswhite(obj2gco(cl)));\n  api_incr_top(L);\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_pushboolean (lua_State *L, int b) {\n  lua_lock(L);\n  setbvalue(L->top, (b != 0));  /* ensure that true is 1 */\n  api_incr_top(L);\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_pushlightuserdata (lua_State *L, void *p) {\n  lua_lock(L);\n  setpvalue(L->top, p);\n  api_incr_top(L);\n  lua_unlock(L);\n}\n\n\nLUA_API int lua_pushthread (lua_State *L) {\n  lua_lock(L);\n  setthvalue(L, L->top, L);\n  api_incr_top(L);\n  lua_unlock(L);\n  return (G(L)->mainthread == L);\n}\n\n\n\n/*\n** get functions (Lua -> stack)\n*/\n\n\nLUA_API void lua_gettable (lua_State *L, int idx) {\n  StkId t;\n  lua_lock(L);\n  t = index2adr(L, idx);\n  api_checkvalidindex(L, t);\n  luaV_gettable(L, t, L->top - 1, L->top - 1);\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_getfield (lua_State *L, int idx, const char *k) {\n  StkId t;\n  TValue key;\n  lua_lock(L);\n  t = index2adr(L, idx);\n  api_checkvalidindex(L, t);\n  setsvalue(L, &key, luaS_new(L, k));\n  luaV_gettable(L, t, &key, L->top);\n  api_incr_top(L);\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_rawget (lua_State *L, int idx) {\n  StkId t;\n  lua_lock(L);\n  t = index2adr(L, idx);\n  api_check(L, ttistable(t));\n  setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1));\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_rawgeti (lua_State *L, int idx, int n) {\n  StkId o;\n  lua_lock(L);\n  o = index2adr(L, idx);\n  api_check(L, ttistable(o));\n  setobj2s(L, L->top, luaH_getnum(hvalue(o), n));\n  api_incr_top(L);\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_createtable (lua_State *L, int narray, int nrec) {\n  lua_lock(L);\n  luaC_checkGC(L);\n  sethvalue(L, L->top, luaH_new(L, narray, nrec));\n  api_incr_top(L);\n  lua_unlock(L);\n}\n\n\nLUA_API int lua_getmetatable (lua_State *L, int objindex) {\n  const TValue *obj;\n  Table *mt = NULL;\n  int res;\n  lua_lock(L);\n  obj = index2adr(L, objindex);\n  switch (ttype(obj)) {\n    case LUA_TTABLE:\n      mt = hvalue(obj)->metatable;\n      break;\n    case LUA_TUSERDATA:\n      mt = uvalue(obj)->metatable;\n      break;\n    default:\n      mt = G(L)->mt[ttype(obj)];\n      break;\n  }\n  if (mt == NULL)\n    res = 0;\n  else {\n    sethvalue(L, L->top, mt);\n    api_incr_top(L);\n    res = 1;\n  }\n  lua_unlock(L);\n  return res;\n}\n\n\nLUA_API void lua_getfenv (lua_State *L, int idx) {\n  StkId o;\n  lua_lock(L);\n  o = index2adr(L, idx);\n  api_checkvalidindex(L, o);\n  switch (ttype(o)) {\n    case LUA_TFUNCTION:\n      sethvalue(L, L->top, clvalue(o)->c.env);\n      break;\n    case LUA_TUSERDATA:\n      sethvalue(L, L->top, uvalue(o)->env);\n      break;\n    case LUA_TTHREAD:\n      setobj2s(L, L->top,  gt(thvalue(o)));\n      break;\n    default:\n      setnilvalue(L->top);\n      break;\n  }\n  api_incr_top(L);\n  lua_unlock(L);\n}\n\n\n/*\n** set functions (stack -> Lua)\n*/\n\n\nLUA_API void lua_settable (lua_State *L, int idx) {\n  StkId t;\n  lua_lock(L);\n  api_checknelems(L, 2);\n  t = index2adr(L, idx);\n  api_checkvalidindex(L, t);\n  luaV_settable(L, t, L->top - 2, L->top - 1);\n  L->top -= 2;  /* pop index and value */\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_setfield (lua_State *L, int idx, const char *k) {\n  StkId t;\n  TValue key;\n  lua_lock(L);\n  api_checknelems(L, 1);\n  t = index2adr(L, idx);\n  api_checkvalidindex(L, t);\n  setsvalue(L, &key, luaS_new(L, k));\n  luaV_settable(L, t, &key, L->top - 1);\n  L->top--;  /* pop value */\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_rawset (lua_State *L, int idx) {\n  StkId t;\n  lua_lock(L);\n  api_checknelems(L, 2);\n  t = index2adr(L, idx);\n  api_check(L, ttistable(t));\n  setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1);\n  luaC_barriert(L, hvalue(t), L->top-1);\n  L->top -= 2;\n  lua_unlock(L);\n}\n\n\nLUA_API void lua_rawseti (lua_State *L, int idx, int n) {\n  StkId o;\n  lua_lock(L);\n  api_checknelems(L, 1);\n  o = index2adr(L, idx);\n  api_check(L, ttistable(o));\n  setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1);\n  luaC_barriert(L, hvalue(o), L->top-1);\n  L->top--;\n  lua_unlock(L);\n}\n\n\nLUA_API int lua_setmetatable (lua_State *L, int objindex) {\n  TValue *obj;\n  Table *mt;\n  lua_lock(L);\n  api_checknelems(L, 1);\n  obj = index2adr(L, objindex);\n  api_checkvalidindex(L, obj);\n  if (ttisnil(L->top - 1))\n    mt = NULL;\n  else {\n    api_check(L, ttistable(L->top - 1));\n    mt = hvalue(L->top - 1);\n  }\n  switch (ttype(obj)) {\n    case LUA_TTABLE: {\n      hvalue(obj)->metatable = mt;\n      if (mt)\n        luaC_objbarriert(L, hvalue(obj), mt);\n      break;\n    }\n    case LUA_TUSERDATA: {\n      uvalue(obj)->metatable = mt;\n      if (mt)\n        luaC_objbarrier(L, rawuvalue(obj), mt);\n      break;\n    }\n    default: {\n      G(L)->mt[ttype(obj)] = mt;\n      break;\n    }\n  }\n  L->top--;\n  lua_unlock(L);\n  return 1;\n}\n\n\nLUA_API int lua_setfenv (lua_State *L, int idx) {\n  StkId o;\n  int res = 1;\n  lua_lock(L);\n  api_checknelems(L, 1);\n  o = index2adr(L, idx);\n  api_checkvalidindex(L, o);\n  api_check(L, ttistable(L->top - 1));\n  switch (ttype(o)) {\n    case LUA_TFUNCTION:\n      clvalue(o)->c.env = hvalue(L->top - 1);\n      break;\n    case LUA_TUSERDATA:\n      uvalue(o)->env = hvalue(L->top - 1);\n      break;\n    case LUA_TTHREAD:\n      sethvalue(L, gt(thvalue(o)), hvalue(L->top - 1));\n      break;\n    default:\n      res = 0;\n      break;\n  }\n  if (res) luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1));\n  L->top--;\n  lua_unlock(L);\n  return res;\n}\n\n\n/*\n** `load' and `call' functions (run Lua code)\n*/\n\n\n#define adjustresults(L,nres) \\\n    { if (nres == LUA_MULTRET && L->top >= L->ci->top) L->ci->top = L->top; }\n\n\n#define checkresults(L,na,nr) \\\n     api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)))\n\t\n\nLUA_API void lua_call (lua_State *L, int nargs, int nresults) {\n  StkId func;\n  lua_lock(L);\n  api_checknelems(L, nargs+1);\n  checkresults(L, nargs, nresults);\n  func = L->top - (nargs+1);\n  luaD_call(L, func, nresults);\n  adjustresults(L, nresults);\n  lua_unlock(L);\n}\n\n\n\n/*\n** Execute a protected call.\n*/\nstruct CallS {  /* data to `f_call' */\n  StkId func;\n  int nresults;\n};\n\n\nstatic void f_call (lua_State *L, void *ud) {\n  struct CallS *c = cast(struct CallS *, ud);\n  luaD_call(L, c->func, c->nresults);\n}\n\n\n\nLUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) {\n  struct CallS c;\n  int status;\n  ptrdiff_t func;\n  lua_lock(L);\n  api_checknelems(L, nargs+1);\n  checkresults(L, nargs, nresults);\n  if (errfunc == 0)\n    func = 0;\n  else {\n    StkId o = index2adr(L, errfunc);\n    api_checkvalidindex(L, o);\n    func = savestack(L, o);\n  }\n  c.func = L->top - (nargs+1);  /* function to be called */\n  c.nresults = nresults;\n  status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func);\n  adjustresults(L, nresults);\n  lua_unlock(L);\n  return status;\n}\n\n\n/*\n** Execute a protected C call.\n*/\nstruct CCallS {  /* data to `f_Ccall' */\n  lua_CFunction func;\n  void *ud;\n};\n\n\nstatic void f_Ccall (lua_State *L, void *ud) {\n  struct CCallS *c = cast(struct CCallS *, ud);\n  Closure *cl;\n  cl = luaF_newCclosure(L, 0, getcurrenv(L));\n  cl->c.f = c->func;\n  setclvalue(L, L->top, cl);  /* push function */\n  api_incr_top(L);\n  setpvalue(L->top, c->ud);  /* push only argument */\n  api_incr_top(L);\n  luaD_call(L, L->top - 2, 0);\n}\n\n\nLUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) {\n  struct CCallS c;\n  int status;\n  lua_lock(L);\n  c.func = func;\n  c.ud = ud;\n  status = luaD_pcall(L, f_Ccall, &c, savestack(L, L->top), 0);\n  lua_unlock(L);\n  return status;\n}\n\n\nLUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,\n                      const char *chunkname) {\n  ZIO z;\n  int status;\n  lua_lock(L);\n  if (!chunkname) chunkname = \"?\";\n  luaZ_init(L, &z, reader, data);\n  status = luaD_protectedparser(L, &z, chunkname);\n  lua_unlock(L);\n  return status;\n}\n\n\nLUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) {\n  int status;\n  TValue *o;\n  lua_lock(L);\n  api_checknelems(L, 1);\n  o = L->top - 1;\n  if (isLfunction(o))\n    status = luaU_dump(L, clvalue(o)->l.p, writer, data, 0);\n  else\n    status = 1;\n  lua_unlock(L);\n  return status;\n}\n\n\nLUA_API int  lua_status (lua_State *L) {\n  return L->status;\n}\n\n\n/*\n** Garbage-collection function\n*/\n\nLUA_API int lua_gc (lua_State *L, int what, int data) {\n  int res = 0;\n  global_State *g;\n  lua_lock(L);\n  g = G(L);\n  switch (what) {\n    case LUA_GCSTOP: {\n      g->GCthreshold = MAX_LUMEM;\n      break;\n    }\n    case LUA_GCRESTART: {\n      g->GCthreshold = g->totalbytes;\n      break;\n    }\n    case LUA_GCCOLLECT: {\n      luaC_fullgc(L);\n      break;\n    }\n    case LUA_GCCOUNT: {\n      /* GC values are expressed in Kbytes: #bytes/2^10 */\n      res = cast_int(g->totalbytes >> 10);\n      break;\n    }\n    case LUA_GCCOUNTB: {\n      res = cast_int(g->totalbytes & 0x3ff);\n      break;\n    }\n    case LUA_GCSTEP: {\n      lu_mem a = (cast(lu_mem, data) << 10);\n      if (a <= g->totalbytes)\n        g->GCthreshold = g->totalbytes - a;\n      else\n        g->GCthreshold = 0;\n      while (g->GCthreshold <= g->totalbytes) {\n        luaC_step(L);\n        if (g->gcstate == GCSpause) {  /* end of cycle? */\n          res = 1;  /* signal it */\n          break;\n        }\n      }\n      break;\n    }\n    case LUA_GCSETPAUSE: {\n      res = g->gcpause;\n      g->gcpause = data;\n      break;\n    }\n    case LUA_GCSETSTEPMUL: {\n      res = g->gcstepmul;\n      g->gcstepmul = data;\n      break;\n    }\n    default: res = -1;  /* invalid option */\n  }\n  lua_unlock(L);\n  return res;\n}\n\n\n\n/*\n** miscellaneous functions\n*/\n\n\nLUA_API int lua_error (lua_State *L) {\n  lua_lock(L);\n  api_checknelems(L, 1);\n  luaG_errormsg(L);\n  lua_unlock(L);\n  return 0;  /* to avoid warnings */\n}\n\n\nLUA_API int lua_next (lua_State *L, int idx) {\n  StkId t;\n  int more;\n  lua_lock(L);\n  t = index2adr(L, idx);\n  api_check(L, ttistable(t));\n  more = luaH_next(L, hvalue(t), L->top - 1);\n  if (more) {\n    api_incr_top(L);\n  }\n  else  /* no more elements */\n    L->top -= 1;  /* remove key */\n  lua_unlock(L);\n  return more;\n}\n\n\nLUA_API void lua_concat (lua_State *L, int n) {\n  lua_lock(L);\n  api_checknelems(L, n);\n  if (n >= 2) {\n    luaC_checkGC(L);\n    luaV_concat(L, n, cast_int(L->top - L->base) - 1);\n    L->top -= (n-1);\n  }\n  else if (n == 0) {  /* push empty string */\n    setsvalue2s(L, L->top, luaS_newlstr(L, \"\", 0));\n    api_incr_top(L);\n  }\n  /* else n == 1; nothing to do */\n  lua_unlock(L);\n}\n\n\nLUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) {\n  lua_Alloc f;\n  lua_lock(L);\n  if (ud) *ud = G(L)->ud;\n  f = G(L)->frealloc;\n  lua_unlock(L);\n  return f;\n}\n\n\nLUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) {\n  lua_lock(L);\n  G(L)->ud = ud;\n  G(L)->frealloc = f;\n  lua_unlock(L);\n}\n\n\nLUA_API void *lua_newuserdata (lua_State *L, size_t size) {\n  Udata *u;\n  lua_lock(L);\n  luaC_checkGC(L);\n  u = luaS_newudata(L, size, getcurrenv(L));\n  setuvalue(L, L->top, u);\n  api_incr_top(L);\n  lua_unlock(L);\n  return u + 1;\n}\n\n\n\n\nstatic const char *aux_upvalue (StkId fi, int n, TValue **val) {\n  Closure *f;\n  if (!ttisfunction(fi)) return NULL;\n  f = clvalue(fi);\n  if (f->c.isC) {\n    if (!(1 <= n && n <= f->c.nupvalues)) return NULL;\n    *val = &f->c.upvalue[n-1];\n    return \"\";\n  }\n  else {\n    Proto *p = f->l.p;\n    if (!(1 <= n && n <= p->sizeupvalues)) return NULL;\n    *val = f->l.upvals[n-1]->v;\n    return getstr(p->upvalues[n-1]);\n  }\n}\n\n\nLUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) {\n  const char *name;\n  TValue *val;\n  lua_lock(L);\n  name = aux_upvalue(index2adr(L, funcindex), n, &val);\n  if (name) {\n    setobj2s(L, L->top, val);\n    api_incr_top(L);\n  }\n  lua_unlock(L);\n  return name;\n}\n\n\nLUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {\n  const char *name;\n  TValue *val;\n  StkId fi;\n  lua_lock(L);\n  fi = index2adr(L, funcindex);\n  api_checknelems(L, 1);\n  name = aux_upvalue(fi, n, &val);\n  if (name) {\n    L->top--;\n    setobj(L, val, L->top);\n    luaC_barrier(L, clvalue(fi), L->top);\n  }\n  lua_unlock(L);\n  return name;\n}\n\n"
  },
  {
    "path": "jni/lua/lapi.h",
    "content": "/*\n** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $\n** Auxiliary functions from Lua API\n** See Copyright Notice in lua.h\n*/\n\n#ifndef lapi_h\n#define lapi_h\n\n\n#include \"lobject.h\"\n\n\nLUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o);\n\n#endif\n"
  },
  {
    "path": "jni/lua/lauxlib.c",
    "content": "/*\n** $Id: lauxlib.c,v 1.159.1.3 2008/01/21 13:20:51 roberto Exp $\n** Auxiliary functions for building Lua libraries\n** See Copyright Notice in lua.h\n*/\n\n\n#include <ctype.h>\n#include <errno.h>\n#include <stdarg.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\n/* This file uses only the official API of Lua.\n** Any function declared here could be written as an application function.\n*/\n\n#define lauxlib_c\n#define LUA_LIB\n\n#include \"lua.h\"\n\n#include \"lauxlib.h\"\n\n\n#define FREELIST_REF\t0\t/* free list of references */\n\n\n/* convert a stack index to positive */\n#define abs_index(L, i)\t\t((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : \\\n\t\t\t\t\tlua_gettop(L) + (i) + 1)\n\n\n/*\n** {======================================================\n** Error-report functions\n** =======================================================\n*/\n\n\nLUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {\n  lua_Debug ar;\n  if (!lua_getstack(L, 0, &ar))  /* no stack frame? */\n    return luaL_error(L, \"bad argument #%d (%s)\", narg, extramsg);\n  lua_getinfo(L, \"n\", &ar);\n  if (strcmp(ar.namewhat, \"method\") == 0) {\n    narg--;  /* do not count `self' */\n    if (narg == 0)  /* error is in the self argument itself? */\n      return luaL_error(L, \"calling \" LUA_QS \" on bad self (%s)\",\n                           ar.name, extramsg);\n  }\n  if (ar.name == NULL)\n    ar.name = \"?\";\n  return luaL_error(L, \"bad argument #%d to \" LUA_QS \" (%s)\",\n                        narg, ar.name, extramsg);\n}\n\n\nLUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) {\n  const char *msg = lua_pushfstring(L, \"%s expected, got %s\",\n                                    tname, luaL_typename(L, narg));\n  return luaL_argerror(L, narg, msg);\n}\n\n\nstatic void tag_error (lua_State *L, int narg, int tag) {\n  luaL_typerror(L, narg, lua_typename(L, tag));\n}\n\n\nLUALIB_API void luaL_where (lua_State *L, int level) {\n  lua_Debug ar;\n  if (lua_getstack(L, level, &ar)) {  /* check function at level */\n    lua_getinfo(L, \"Sl\", &ar);  /* get info about it */\n    if (ar.currentline > 0) {  /* is there info? */\n      lua_pushfstring(L, \"%s:%d: \", ar.short_src, ar.currentline);\n      return;\n    }\n  }\n  lua_pushliteral(L, \"\");  /* else, no information available... */\n}\n\n\nLUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {\n  va_list argp;\n  va_start(argp, fmt);\n  luaL_where(L, 1);\n  lua_pushvfstring(L, fmt, argp);\n  va_end(argp);\n  lua_concat(L, 2);\n  return lua_error(L);\n}\n\n/* }====================================================== */\n\n\nLUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,\n                                 const char *const lst[]) {\n  const char *name = (def) ? luaL_optstring(L, narg, def) :\n                             luaL_checkstring(L, narg);\n  int i;\n  for (i=0; lst[i]; i++)\n    if (strcmp(lst[i], name) == 0)\n      return i;\n  return luaL_argerror(L, narg,\n                       lua_pushfstring(L, \"invalid option \" LUA_QS, name));\n}\n\n\nLUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {\n  lua_getfield(L, LUA_REGISTRYINDEX, tname);  /* get registry.name */\n  if (!lua_isnil(L, -1))  /* name already in use? */\n    return 0;  /* leave previous value on top, but return 0 */\n  lua_pop(L, 1);\n  lua_newtable(L);  /* create metatable */\n  lua_pushvalue(L, -1);\n  lua_setfield(L, LUA_REGISTRYINDEX, tname);  /* registry.name = metatable */\n  return 1;\n}\n\n\nLUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {\n  void *p = lua_touserdata(L, ud);\n  if (p != NULL) {  /* value is a userdata? */\n    if (lua_getmetatable(L, ud)) {  /* does it have a metatable? */\n      lua_getfield(L, LUA_REGISTRYINDEX, tname);  /* get correct metatable */\n      if (lua_rawequal(L, -1, -2)) {  /* does it have the correct mt? */\n        lua_pop(L, 2);  /* remove both metatables */\n        return p;\n      }\n    }\n  }\n  luaL_typerror(L, ud, tname);  /* else error */\n  return NULL;  /* to avoid warnings */\n}\n\n\nLUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) {\n  if (!lua_checkstack(L, space))\n    luaL_error(L, \"stack overflow (%s)\", mes);\n}\n\n\nLUALIB_API void luaL_checktype (lua_State *L, int narg, int t) {\n  if (lua_type(L, narg) != t)\n    tag_error(L, narg, t);\n}\n\n\nLUALIB_API void luaL_checkany (lua_State *L, int narg) {\n  if (lua_type(L, narg) == LUA_TNONE)\n    luaL_argerror(L, narg, \"value expected\");\n}\n\n\nLUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) {\n  const char *s = lua_tolstring(L, narg, len);\n  if (!s) tag_error(L, narg, LUA_TSTRING);\n  return s;\n}\n\n\nLUALIB_API const char *luaL_optlstring (lua_State *L, int narg,\n                                        const char *def, size_t *len) {\n  if (lua_isnoneornil(L, narg)) {\n    if (len)\n      *len = (def ? strlen(def) : 0);\n    return def;\n  }\n  else return luaL_checklstring(L, narg, len);\n}\n\n\nLUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) {\n  lua_Number d = lua_tonumber(L, narg);\n  if (d == 0 && !lua_isnumber(L, narg))  /* avoid extra test when d is not 0 */\n    tag_error(L, narg, LUA_TNUMBER);\n  return d;\n}\n\n\nLUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) {\n  return luaL_opt(L, luaL_checknumber, narg, def);\n}\n\n\nLUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) {\n  lua_Integer d = lua_tointeger(L, narg);\n  if (d == 0 && !lua_isnumber(L, narg))  /* avoid extra test when d is not 0 */\n    tag_error(L, narg, LUA_TNUMBER);\n  return d;\n}\n\n\nLUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg,\n                                                      lua_Integer def) {\n  return luaL_opt(L, luaL_checkinteger, narg, def);\n}\n\n\nLUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) {\n  if (!lua_getmetatable(L, obj))  /* no metatable? */\n    return 0;\n  lua_pushstring(L, event);\n  lua_rawget(L, -2);\n  if (lua_isnil(L, -1)) {\n    lua_pop(L, 2);  /* remove metatable and metafield */\n    return 0;\n  }\n  else {\n    lua_remove(L, -2);  /* remove only metatable */\n    return 1;\n  }\n}\n\n\nLUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {\n  obj = abs_index(L, obj);\n  if (!luaL_getmetafield(L, obj, event))  /* no metafield? */\n    return 0;\n  lua_pushvalue(L, obj);\n  lua_call(L, 1, 1);\n  return 1;\n}\n\n\nLUALIB_API void (luaL_register) (lua_State *L, const char *libname,\n                                const luaL_Reg *l) {\n  luaI_openlib(L, libname, l, 0);\n}\n\n\nstatic int libsize (const luaL_Reg *l) {\n  int size = 0;\n  for (; l->name; l++) size++;\n  return size;\n}\n\n\nLUALIB_API void luaI_openlib (lua_State *L, const char *libname,\n                              const luaL_Reg *l, int nup) {\n  if (libname) {\n    int size = libsize(l);\n    /* check whether lib already exists */\n    luaL_findtable(L, LUA_REGISTRYINDEX, \"_LOADED\", 1);\n    lua_getfield(L, -1, libname);  /* get _LOADED[libname] */\n    if (!lua_istable(L, -1)) {  /* not found? */\n      lua_pop(L, 1);  /* remove previous result */\n      /* try global variable (and create one if it does not exist) */\n      if (luaL_findtable(L, LUA_GLOBALSINDEX, libname, size) != NULL)\n        luaL_error(L, \"name conflict for module \" LUA_QS, libname);\n      lua_pushvalue(L, -1);\n      lua_setfield(L, -3, libname);  /* _LOADED[libname] = new table */\n    }\n    lua_remove(L, -2);  /* remove _LOADED table */\n    lua_insert(L, -(nup+1));  /* move library table to below upvalues */\n  }\n  for (; l->name; l++) {\n    int i;\n    for (i=0; i<nup; i++)  /* copy upvalues to the top */\n      lua_pushvalue(L, -nup);\n    lua_pushcclosure(L, l->func, nup);\n    lua_setfield(L, -(nup+2), l->name);\n  }\n  lua_pop(L, nup);  /* remove upvalues */\n}\n\n\n\n/*\n** {======================================================\n** getn-setn: size for arrays\n** =======================================================\n*/\n\n#if defined(LUA_COMPAT_GETN)\n\nstatic int checkint (lua_State *L, int topop) {\n  int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1;\n  lua_pop(L, topop);\n  return n;\n}\n\n\nstatic void getsizes (lua_State *L) {\n  lua_getfield(L, LUA_REGISTRYINDEX, \"LUA_SIZES\");\n  if (lua_isnil(L, -1)) {  /* no `size' table? */\n    lua_pop(L, 1);  /* remove nil */\n    lua_newtable(L);  /* create it */\n    lua_pushvalue(L, -1);  /* `size' will be its own metatable */\n    lua_setmetatable(L, -2);\n    lua_pushliteral(L, \"kv\");\n    lua_setfield(L, -2, \"__mode\");  /* metatable(N).__mode = \"kv\" */\n    lua_pushvalue(L, -1);\n    lua_setfield(L, LUA_REGISTRYINDEX, \"LUA_SIZES\");  /* store in register */\n  }\n}\n\n\nLUALIB_API void luaL_setn (lua_State *L, int t, int n) {\n  t = abs_index(L, t);\n  lua_pushliteral(L, \"n\");\n  lua_rawget(L, t);\n  if (checkint(L, 1) >= 0) {  /* is there a numeric field `n'? */\n    lua_pushliteral(L, \"n\");  /* use it */\n    lua_pushinteger(L, n);\n    lua_rawset(L, t);\n  }\n  else {  /* use `sizes' */\n    getsizes(L);\n    lua_pushvalue(L, t);\n    lua_pushinteger(L, n);\n    lua_rawset(L, -3);  /* sizes[t] = n */\n    lua_pop(L, 1);  /* remove `sizes' */\n  }\n}\n\n\nLUALIB_API int luaL_getn (lua_State *L, int t) {\n  int n;\n  t = abs_index(L, t);\n  lua_pushliteral(L, \"n\");  /* try t.n */\n  lua_rawget(L, t);\n  if ((n = checkint(L, 1)) >= 0) return n;\n  getsizes(L);  /* else try sizes[t] */\n  lua_pushvalue(L, t);\n  lua_rawget(L, -2);\n  if ((n = checkint(L, 2)) >= 0) return n;\n  return (int)lua_objlen(L, t);\n}\n\n#endif\n\n/* }====================================================== */\n\n\n\nLUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p,\n                                                               const char *r) {\n  const char *wild;\n  size_t l = strlen(p);\n  luaL_Buffer b;\n  luaL_buffinit(L, &b);\n  while ((wild = strstr(s, p)) != NULL) {\n    luaL_addlstring(&b, s, wild - s);  /* push prefix */\n    luaL_addstring(&b, r);  /* push replacement in place of pattern */\n    s = wild + l;  /* continue after `p' */\n  }\n  luaL_addstring(&b, s);  /* push last suffix */\n  luaL_pushresult(&b);\n  return lua_tostring(L, -1);\n}\n\n\nLUALIB_API const char *luaL_findtable (lua_State *L, int idx,\n                                       const char *fname, int szhint) {\n  const char *e;\n  lua_pushvalue(L, idx);\n  do {\n    e = strchr(fname, '.');\n    if (e == NULL) e = fname + strlen(fname);\n    lua_pushlstring(L, fname, e - fname);\n    lua_rawget(L, -2);\n    if (lua_isnil(L, -1)) {  /* no such field? */\n      lua_pop(L, 1);  /* remove this nil */\n      lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */\n      lua_pushlstring(L, fname, e - fname);\n      lua_pushvalue(L, -2);\n      lua_settable(L, -4);  /* set new table into field */\n    }\n    else if (!lua_istable(L, -1)) {  /* field has a non-table value? */\n      lua_pop(L, 2);  /* remove table and value */\n      return fname;  /* return problematic part of the name */\n    }\n    lua_remove(L, -2);  /* remove previous table */\n    fname = e + 1;\n  } while (*e == '.');\n  return NULL;\n}\n\n\n\n/*\n** {======================================================\n** Generic Buffer manipulation\n** =======================================================\n*/\n\n\n#define bufflen(B)\t((B)->p - (B)->buffer)\n#define bufffree(B)\t((size_t)(LUAL_BUFFERSIZE - bufflen(B)))\n\n#define LIMIT\t(LUA_MINSTACK/2)\n\n\nstatic int emptybuffer (luaL_Buffer *B) {\n  size_t l = bufflen(B);\n  if (l == 0) return 0;  /* put nothing on stack */\n  else {\n    lua_pushlstring(B->L, B->buffer, l);\n    B->p = B->buffer;\n    B->lvl++;\n    return 1;\n  }\n}\n\n\nstatic void adjuststack (luaL_Buffer *B) {\n  if (B->lvl > 1) {\n    lua_State *L = B->L;\n    int toget = 1;  /* number of levels to concat */\n    size_t toplen = lua_strlen(L, -1);\n    do {\n      size_t l = lua_strlen(L, -(toget+1));\n      if (B->lvl - toget + 1 >= LIMIT || toplen > l) {\n        toplen += l;\n        toget++;\n      }\n      else break;\n    } while (toget < B->lvl);\n    lua_concat(L, toget);\n    B->lvl = B->lvl - toget + 1;\n  }\n}\n\n\nLUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) {\n  if (emptybuffer(B))\n    adjuststack(B);\n  return B->buffer;\n}\n\n\nLUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) {\n  while (l--)\n    luaL_addchar(B, *s++);\n}\n\n\nLUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {\n  luaL_addlstring(B, s, strlen(s));\n}\n\n\nLUALIB_API void luaL_pushresult (luaL_Buffer *B) {\n  emptybuffer(B);\n  lua_concat(B->L, B->lvl);\n  B->lvl = 1;\n}\n\n\nLUALIB_API void luaL_addvalue (luaL_Buffer *B) {\n  lua_State *L = B->L;\n  size_t vl;\n  const char *s = lua_tolstring(L, -1, &vl);\n  if (vl <= bufffree(B)) {  /* fit into buffer? */\n    memcpy(B->p, s, vl);  /* put it there */\n    B->p += vl;\n    lua_pop(L, 1);  /* remove from stack */\n  }\n  else {\n    if (emptybuffer(B))\n      lua_insert(L, -2);  /* put buffer before new value */\n    B->lvl++;  /* add new value into B stack */\n    adjuststack(B);\n  }\n}\n\n\nLUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {\n  B->L = L;\n  B->p = B->buffer;\n  B->lvl = 0;\n}\n\n/* }====================================================== */\n\n\nLUALIB_API int luaL_ref (lua_State *L, int t) {\n  int ref;\n  t = abs_index(L, t);\n  if (lua_isnil(L, -1)) {\n    lua_pop(L, 1);  /* remove from stack */\n    return LUA_REFNIL;  /* `nil' has a unique fixed reference */\n  }\n  lua_rawgeti(L, t, FREELIST_REF);  /* get first free element */\n  ref = (int)lua_tointeger(L, -1);  /* ref = t[FREELIST_REF] */\n  lua_pop(L, 1);  /* remove it from stack */\n  if (ref != 0) {  /* any free element? */\n    lua_rawgeti(L, t, ref);  /* remove it from list */\n    lua_rawseti(L, t, FREELIST_REF);  /* (t[FREELIST_REF] = t[ref]) */\n  }\n  else {  /* no free elements */\n    ref = (int)lua_objlen(L, t);\n    ref++;  /* create new reference */\n  }\n  lua_rawseti(L, t, ref);\n  return ref;\n}\n\n\nLUALIB_API void luaL_unref (lua_State *L, int t, int ref) {\n  if (ref >= 0) {\n    t = abs_index(L, t);\n    lua_rawgeti(L, t, FREELIST_REF);\n    lua_rawseti(L, t, ref);  /* t[ref] = t[FREELIST_REF] */\n    lua_pushinteger(L, ref);\n    lua_rawseti(L, t, FREELIST_REF);  /* t[FREELIST_REF] = ref */\n  }\n}\n\n\n\n/*\n** {======================================================\n** Load functions\n** =======================================================\n*/\n\ntypedef struct LoadF {\n  int extraline;\n  FILE *f;\n  char buff[LUAL_BUFFERSIZE];\n} LoadF;\n\n\nstatic const char *getF (lua_State *L, void *ud, size_t *size) {\n  LoadF *lf = (LoadF *)ud;\n  (void)L;\n  if (lf->extraline) {\n    lf->extraline = 0;\n    *size = 1;\n    return \"\\n\";\n  }\n  if (feof(lf->f)) return NULL;\n  *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f);\n  return (*size > 0) ? lf->buff : NULL;\n}\n\n\nstatic int errfile (lua_State *L, const char *what, int fnameindex) {\n  const char *serr = strerror(errno);\n  const char *filename = lua_tostring(L, fnameindex) + 1;\n  lua_pushfstring(L, \"cannot %s %s: %s\", what, filename, serr);\n  lua_remove(L, fnameindex);\n  return LUA_ERRFILE;\n}\n\n\nLUALIB_API int luaL_loadfile (lua_State *L, const char *filename) {\n  LoadF lf;\n  int status, readstatus;\n  int c;\n  int fnameindex = lua_gettop(L) + 1;  /* index of filename on the stack */\n  lf.extraline = 0;\n  if (filename == NULL) {\n    lua_pushliteral(L, \"=stdin\");\n    lf.f = stdin;\n  }\n  else {\n    lua_pushfstring(L, \"@%s\", filename);\n    lf.f = fopen(filename, \"r\");\n    if (lf.f == NULL) return errfile(L, \"open\", fnameindex);\n  }\n  c = getc(lf.f);\n  if (c == '#') {  /* Unix exec. file? */\n    lf.extraline = 1;\n    while ((c = getc(lf.f)) != EOF && c != '\\n') ;  /* skip first line */\n    if (c == '\\n') c = getc(lf.f);\n  }\n  if (c == LUA_SIGNATURE[0] && filename) {  /* binary file? */\n    lf.f = freopen(filename, \"rb\", lf.f);  /* reopen in binary mode */\n    if (lf.f == NULL) return errfile(L, \"reopen\", fnameindex);\n    /* skip eventual `#!...' */\n   while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ;\n    lf.extraline = 0;\n  }\n  ungetc(c, lf.f);\n  status = lua_load(L, getF, &lf, lua_tostring(L, -1));\n  readstatus = ferror(lf.f);\n  if (filename) fclose(lf.f);  /* close file (even in case of errors) */\n  if (readstatus) {\n    lua_settop(L, fnameindex);  /* ignore results from `lua_load' */\n    return errfile(L, \"read\", fnameindex);\n  }\n  lua_remove(L, fnameindex);\n  return status;\n}\n\n\ntypedef struct LoadS {\n  const char *s;\n  size_t size;\n} LoadS;\n\n\nstatic const char *getS (lua_State *L, void *ud, size_t *size) {\n  LoadS *ls = (LoadS *)ud;\n  (void)L;\n  if (ls->size == 0) return NULL;\n  *size = ls->size;\n  ls->size = 0;\n  return ls->s;\n}\n\n\nLUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size,\n                                const char *name) {\n  LoadS ls;\n  ls.s = buff;\n  ls.size = size;\n  return lua_load(L, getS, &ls, name);\n}\n\n\nLUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) {\n  return luaL_loadbuffer(L, s, strlen(s), s);\n}\n\n\n\n/* }====================================================== */\n\n\nstatic void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {\n  (void)ud;\n  (void)osize;\n  if (nsize == 0) {\n    free(ptr);\n    return NULL;\n  }\n  else\n    return realloc(ptr, nsize);\n}\n\n\nstatic int panic (lua_State *L) {\n  (void)L;  /* to avoid warnings */\n  fprintf(stderr, \"PANIC: unprotected error in call to Lua API (%s)\\n\",\n                   lua_tostring(L, -1));\n  return 0;\n}\n\n\nLUALIB_API lua_State *luaL_newstate (void) {\n  lua_State *L = lua_newstate(l_alloc, NULL);\n  if (L) lua_atpanic(L, &panic);\n  return L;\n}\n\n"
  },
  {
    "path": "jni/lua/lauxlib.h",
    "content": "/*\n** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $\n** Auxiliary functions for building Lua libraries\n** See Copyright Notice in lua.h\n*/\n\n\n#ifndef lauxlib_h\n#define lauxlib_h\n\n\n#include <stddef.h>\n#include <stdio.h>\n\n#include \"lua.h\"\n\n\n#if defined(LUA_COMPAT_GETN)\nLUALIB_API int (luaL_getn) (lua_State *L, int t);\nLUALIB_API void (luaL_setn) (lua_State *L, int t, int n);\n#else\n#define luaL_getn(L,i)          ((int)lua_objlen(L, i))\n#define luaL_setn(L,i,j)        ((void)0)  /* no op! */\n#endif\n\n#if defined(LUA_COMPAT_OPENLIB)\n#define luaI_openlib\tluaL_openlib\n#endif\n\n\n/* extra error code for `luaL_load' */\n#define LUA_ERRFILE     (LUA_ERRERR+1)\n\n\ntypedef struct luaL_Reg {\n  const char *name;\n  lua_CFunction func;\n} luaL_Reg;\n\n\n\nLUALIB_API void (luaI_openlib) (lua_State *L, const char *libname,\n                                const luaL_Reg *l, int nup);\nLUALIB_API void (luaL_register) (lua_State *L, const char *libname,\n                                const luaL_Reg *l);\nLUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);\nLUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);\nLUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);\nLUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);\nLUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,\n                                                          size_t *l);\nLUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,\n                                          const char *def, size_t *l);\nLUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);\nLUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);\n\nLUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);\nLUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,\n                                          lua_Integer def);\n\nLUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);\nLUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);\nLUALIB_API void (luaL_checkany) (lua_State *L, int narg);\n\nLUALIB_API int   (luaL_newmetatable) (lua_State *L, const char *tname);\nLUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);\n\nLUALIB_API void (luaL_where) (lua_State *L, int lvl);\nLUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);\n\nLUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,\n                                   const char *const lst[]);\n\nLUALIB_API int (luaL_ref) (lua_State *L, int t);\nLUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);\n\nLUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);\nLUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,\n                                  const char *name);\nLUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);\n\nLUALIB_API lua_State *(luaL_newstate) (void);\n\n\nLUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,\n                                                  const char *r);\n\nLUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,\n                                         const char *fname, int szhint);\n\n\n\n\n/*\n** ===============================================================\n** some useful macros\n** ===============================================================\n*/\n\n#define luaL_argcheck(L, cond,numarg,extramsg)\t\\\n\t\t((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))\n#define luaL_checkstring(L,n)\t(luaL_checklstring(L, (n), NULL))\n#define luaL_optstring(L,n,d)\t(luaL_optlstring(L, (n), (d), NULL))\n#define luaL_checkint(L,n)\t((int)luaL_checkinteger(L, (n)))\n#define luaL_optint(L,n,d)\t((int)luaL_optinteger(L, (n), (d)))\n#define luaL_checklong(L,n)\t((long)luaL_checkinteger(L, (n)))\n#define luaL_optlong(L,n,d)\t((long)luaL_optinteger(L, (n), (d)))\n\n#define luaL_typename(L,i)\tlua_typename(L, lua_type(L,(i)))\n\n#define luaL_dofile(L, fn) \\\n\t(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))\n\n#define luaL_dostring(L, s) \\\n\t(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))\n\n#define luaL_getmetatable(L,n)\t(lua_getfield(L, LUA_REGISTRYINDEX, (n)))\n\n#define luaL_opt(L,f,n,d)\t(lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))\n\n/*\n** {======================================================\n** Generic Buffer manipulation\n** =======================================================\n*/\n\n\n\ntypedef struct luaL_Buffer {\n  char *p;\t\t\t/* current position in buffer */\n  int lvl;  /* number of strings in the stack (level) */\n  lua_State *L;\n  char buffer[LUAL_BUFFERSIZE];\n} luaL_Buffer;\n\n#define luaL_addchar(B,c) \\\n  ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \\\n   (*(B)->p++ = (char)(c)))\n\n/* compatibility only */\n#define luaL_putchar(B,c)\tluaL_addchar(B,c)\n\n#define luaL_addsize(B,n)\t((B)->p += (n))\n\nLUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);\nLUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B);\nLUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);\nLUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);\nLUALIB_API void (luaL_addvalue) (luaL_Buffer *B);\nLUALIB_API void (luaL_pushresult) (luaL_Buffer *B);\n\n\n/* }====================================================== */\n\n\n/* compatibility with ref system */\n\n/* pre-defined references */\n#define LUA_NOREF       (-2)\n#define LUA_REFNIL      (-1)\n\n#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \\\n      (lua_pushstring(L, \"unlocked references are obsolete\"), lua_error(L), 0))\n\n#define lua_unref(L,ref)        luaL_unref(L, LUA_REGISTRYINDEX, (ref))\n\n#define lua_getref(L,ref)       lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))\n\n\n#define luaL_reg\tluaL_Reg\n\n#endif\n\n\n"
  },
  {
    "path": "jni/lua/lbaselib.c",
    "content": "/*\n** $Id: lbaselib.c,v 1.191.1.6 2008/02/14 16:46:22 roberto Exp $\n** Basic library\n** See Copyright Notice in lua.h\n*/\n\n\n\n#include <ctype.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define lbaselib_c\n#define LUA_LIB\n\n#include \"lua.h\"\n\n#include \"lauxlib.h\"\n#include \"lualib.h\"\n\n\n\n\n/*\n** If your system does not support `stdout', you can just remove this function.\n** If you need, you can define your own `print' function, following this\n** model but changing `fputs' to put the strings at a proper place\n** (a console window or a log file, for instance).\n*/\nstatic int luaB_print (lua_State *L) {\n  int n = lua_gettop(L);  /* number of arguments */\n  int i;\n  lua_getglobal(L, \"tostring\");\n  for (i=1; i<=n; i++) {\n    const char *s;\n    lua_pushvalue(L, -1);  /* function to be called */\n    lua_pushvalue(L, i);   /* value to print */\n    lua_call(L, 1, 1);\n    s = lua_tostring(L, -1);  /* get result */\n    if (s == NULL)\n      return luaL_error(L, LUA_QL(\"tostring\") \" must return a string to \"\n                           LUA_QL(\"print\"));\n    if (i>1) fputs(\"\\t\", stdout);\n    fputs(s, stdout);\n    lua_pop(L, 1);  /* pop result */\n  }\n  fputs(\"\\n\", stdout);\n  return 0;\n}\n\n\nstatic int luaB_tonumber (lua_State *L) {\n  int base = luaL_optint(L, 2, 10);\n  if (base == 10) {  /* standard conversion */\n    luaL_checkany(L, 1);\n    if (lua_isnumber(L, 1)) {\n      lua_pushnumber(L, lua_tonumber(L, 1));\n      return 1;\n    }\n  }\n  else {\n    const char *s1 = luaL_checkstring(L, 1);\n    char *s2;\n    unsigned long n;\n    luaL_argcheck(L, 2 <= base && base <= 36, 2, \"base out of range\");\n    n = strtoul(s1, &s2, base);\n    if (s1 != s2) {  /* at least one valid digit? */\n      while (isspace((unsigned char)(*s2))) s2++;  /* skip trailing spaces */\n      if (*s2 == '\\0') {  /* no invalid trailing characters? */\n        lua_pushnumber(L, (lua_Number)n);\n        return 1;\n      }\n    }\n  }\n  lua_pushnil(L);  /* else not a number */\n  return 1;\n}\n\n\nstatic int luaB_error (lua_State *L) {\n  int level = luaL_optint(L, 2, 1);\n  lua_settop(L, 1);\n  if (lua_isstring(L, 1) && level > 0) {  /* add extra information? */\n    luaL_where(L, level);\n    lua_pushvalue(L, 1);\n    lua_concat(L, 2);\n  }\n  return lua_error(L);\n}\n\n\nstatic int luaB_getmetatable (lua_State *L) {\n  luaL_checkany(L, 1);\n  if (!lua_getmetatable(L, 1)) {\n    lua_pushnil(L);\n    return 1;  /* no metatable */\n  }\n  luaL_getmetafield(L, 1, \"__metatable\");\n  return 1;  /* returns either __metatable field (if present) or metatable */\n}\n\n\nstatic int luaB_setmetatable (lua_State *L) {\n  int t = lua_type(L, 2);\n  luaL_checktype(L, 1, LUA_TTABLE);\n  luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,\n                    \"nil or table expected\");\n  if (luaL_getmetafield(L, 1, \"__metatable\"))\n    luaL_error(L, \"cannot change a protected metatable\");\n  lua_settop(L, 2);\n  lua_setmetatable(L, 1);\n  return 1;\n}\n\n\nstatic void getfunc (lua_State *L, int opt) {\n  if (lua_isfunction(L, 1)) lua_pushvalue(L, 1);\n  else {\n    lua_Debug ar;\n    int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1);\n    luaL_argcheck(L, level >= 0, 1, \"level must be non-negative\");\n    if (lua_getstack(L, level, &ar) == 0)\n      luaL_argerror(L, 1, \"invalid level\");\n    lua_getinfo(L, \"f\", &ar);\n    if (lua_isnil(L, -1))\n      luaL_error(L, \"no function environment for tail call at level %d\",\n                    level);\n  }\n}\n\n\nstatic int luaB_getfenv (lua_State *L) {\n  getfunc(L, 1);\n  if (lua_iscfunction(L, -1))  /* is a C function? */\n    lua_pushvalue(L, LUA_GLOBALSINDEX);  /* return the thread's global env. */\n  else\n    lua_getfenv(L, -1);\n  return 1;\n}\n\n\nstatic int luaB_setfenv (lua_State *L) {\n  luaL_checktype(L, 2, LUA_TTABLE);\n  getfunc(L, 0);\n  lua_pushvalue(L, 2);\n  if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) {\n    /* change environment of current thread */\n    lua_pushthread(L);\n    lua_insert(L, -2);\n    lua_setfenv(L, -2);\n    return 0;\n  }\n  else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0)\n    luaL_error(L,\n          LUA_QL(\"setfenv\") \" cannot change environment of given object\");\n  return 1;\n}\n\n\nstatic int luaB_rawequal (lua_State *L) {\n  luaL_checkany(L, 1);\n  luaL_checkany(L, 2);\n  lua_pushboolean(L, lua_rawequal(L, 1, 2));\n  return 1;\n}\n\n\nstatic int luaB_rawget (lua_State *L) {\n  luaL_checktype(L, 1, LUA_TTABLE);\n  luaL_checkany(L, 2);\n  lua_settop(L, 2);\n  lua_rawget(L, 1);\n  return 1;\n}\n\nstatic int luaB_rawset (lua_State *L) {\n  luaL_checktype(L, 1, LUA_TTABLE);\n  luaL_checkany(L, 2);\n  luaL_checkany(L, 3);\n  lua_settop(L, 3);\n  lua_rawset(L, 1);\n  return 1;\n}\n\n\nstatic int luaB_gcinfo (lua_State *L) {\n  lua_pushinteger(L, lua_getgccount(L));\n  return 1;\n}\n\n\nstatic int luaB_collectgarbage (lua_State *L) {\n  static const char *const opts[] = {\"stop\", \"restart\", \"collect\",\n    \"count\", \"step\", \"setpause\", \"setstepmul\", NULL};\n  static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,\n    LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL};\n  int o = luaL_checkoption(L, 1, \"collect\", opts);\n  int ex = luaL_optint(L, 2, 0);\n  int res = lua_gc(L, optsnum[o], ex);\n  switch (optsnum[o]) {\n    case LUA_GCCOUNT: {\n      int b = lua_gc(L, LUA_GCCOUNTB, 0);\n      lua_pushnumber(L, res + ((lua_Number)b/1024));\n      return 1;\n    }\n    case LUA_GCSTEP: {\n      lua_pushboolean(L, res);\n      return 1;\n    }\n    default: {\n      lua_pushnumber(L, res);\n      return 1;\n    }\n  }\n}\n\n\nstatic int luaB_type (lua_State *L) {\n  luaL_checkany(L, 1);\n  lua_pushstring(L, luaL_typename(L, 1));\n  return 1;\n}\n\n\nstatic int luaB_next (lua_State *L) {\n  luaL_checktype(L, 1, LUA_TTABLE);\n  lua_settop(L, 2);  /* create a 2nd argument if there isn't one */\n  if (lua_next(L, 1))\n    return 2;\n  else {\n    lua_pushnil(L);\n    return 1;\n  }\n}\n\n\nstatic int luaB_pairs (lua_State *L) {\n  luaL_checktype(L, 1, LUA_TTABLE);\n  lua_pushvalue(L, lua_upvalueindex(1));  /* return generator, */\n  lua_pushvalue(L, 1);  /* state, */\n  lua_pushnil(L);  /* and initial value */\n  return 3;\n}\n\n\nstatic int ipairsaux (lua_State *L) {\n  int i = luaL_checkint(L, 2);\n  luaL_checktype(L, 1, LUA_TTABLE);\n  i++;  /* next value */\n  lua_pushinteger(L, i);\n  lua_rawgeti(L, 1, i);\n  return (lua_isnil(L, -1)) ? 0 : 2;\n}\n\n\nstatic int luaB_ipairs (lua_State *L) {\n  luaL_checktype(L, 1, LUA_TTABLE);\n  lua_pushvalue(L, lua_upvalueindex(1));  /* return generator, */\n  lua_pushvalue(L, 1);  /* state, */\n  lua_pushinteger(L, 0);  /* and initial value */\n  return 3;\n}\n\n\nstatic int load_aux (lua_State *L, int status) {\n  if (status == 0)  /* OK? */\n    return 1;\n  else {\n    lua_pushnil(L);\n    lua_insert(L, -2);  /* put before error message */\n    return 2;  /* return nil plus error message */\n  }\n}\n\n\nstatic int luaB_loadstring (lua_State *L) {\n  size_t l;\n  const char *s = luaL_checklstring(L, 1, &l);\n  const char *chunkname = luaL_optstring(L, 2, s);\n  return load_aux(L, luaL_loadbuffer(L, s, l, chunkname));\n}\n\n\nstatic int luaB_loadfile (lua_State *L) {\n  const char *fname = luaL_optstring(L, 1, NULL);\n  return load_aux(L, luaL_loadfile(L, fname));\n}\n\n\n/*\n** Reader for generic `load' function: `lua_load' uses the\n** stack for internal stuff, so the reader cannot change the\n** stack top. Instead, it keeps its resulting string in a\n** reserved slot inside the stack.\n*/\nstatic const char *generic_reader (lua_State *L, void *ud, size_t *size) {\n  (void)ud;  /* to avoid warnings */\n  luaL_checkstack(L, 2, \"too many nested functions\");\n  lua_pushvalue(L, 1);  /* get function */\n  lua_call(L, 0, 1);  /* call it */\n  if (lua_isnil(L, -1)) {\n    *size = 0;\n    return NULL;\n  }\n  else if (lua_isstring(L, -1)) {\n    lua_replace(L, 3);  /* save string in a reserved stack slot */\n    return lua_tolstring(L, 3, size);\n  }\n  else luaL_error(L, \"reader function must return a string\");\n  return NULL;  /* to avoid warnings */\n}\n\n\nstatic int luaB_load (lua_State *L) {\n  int status;\n  const char *cname = luaL_optstring(L, 2, \"=(load)\");\n  luaL_checktype(L, 1, LUA_TFUNCTION);\n  lua_settop(L, 3);  /* function, eventual name, plus one reserved slot */\n  status = lua_load(L, generic_reader, NULL, cname);\n  return load_aux(L, status);\n}\n\n\nstatic int luaB_dofile (lua_State *L) {\n  const char *fname = luaL_optstring(L, 1, NULL);\n  int n = lua_gettop(L);\n  if (luaL_loadfile(L, fname) != 0) lua_error(L);\n  lua_call(L, 0, LUA_MULTRET);\n  return lua_gettop(L) - n;\n}\n\n\nstatic int luaB_assert (lua_State *L) {\n  luaL_checkany(L, 1);\n  if (!lua_toboolean(L, 1))\n    return luaL_error(L, \"%s\", luaL_optstring(L, 2, \"assertion failed!\"));\n  return lua_gettop(L);\n}\n\n\nstatic int luaB_unpack (lua_State *L) {\n  int i, e, n;\n  luaL_checktype(L, 1, LUA_TTABLE);\n  i = luaL_optint(L, 2, 1);\n  e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1));\n  if (i > e) return 0;  /* empty range */\n  n = e - i + 1;  /* number of elements */\n  if (n <= 0 || !lua_checkstack(L, n))  /* n <= 0 means arith. overflow */\n    return luaL_error(L, \"too many results to unpack\");\n  lua_rawgeti(L, 1, i);  /* push arg[i] (avoiding overflow problems) */\n  while (i++ < e)  /* push arg[i + 1...e] */\n    lua_rawgeti(L, 1, i);\n  return n;\n}\n\n\nstatic int luaB_select (lua_State *L) {\n  int n = lua_gettop(L);\n  if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') {\n    lua_pushinteger(L, n-1);\n    return 1;\n  }\n  else {\n    int i = luaL_checkint(L, 1);\n    if (i < 0) i = n + i;\n    else if (i > n) i = n;\n    luaL_argcheck(L, 1 <= i, 1, \"index out of range\");\n    return n - i;\n  }\n}\n\n\nstatic int luaB_pcall (lua_State *L) {\n  int status;\n  luaL_checkany(L, 1);\n  status = lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0);\n  lua_pushboolean(L, (status == 0));\n  lua_insert(L, 1);\n  return lua_gettop(L);  /* return status + all results */\n}\n\n\nstatic int luaB_xpcall (lua_State *L) {\n  int status;\n  luaL_checkany(L, 2);\n  lua_settop(L, 2);\n  lua_insert(L, 1);  /* put error function under function to be called */\n  status = lua_pcall(L, 0, LUA_MULTRET, 1);\n  lua_pushboolean(L, (status == 0));\n  lua_replace(L, 1);\n  return lua_gettop(L);  /* return status + all results */\n}\n\n\nstatic int luaB_tostring (lua_State *L) {\n  luaL_checkany(L, 1);\n  if (luaL_callmeta(L, 1, \"__tostring\"))  /* is there a metafield? */\n    return 1;  /* use its value */\n  switch (lua_type(L, 1)) {\n    case LUA_TNUMBER:\n      lua_pushstring(L, lua_tostring(L, 1));\n      break;\n    case LUA_TSTRING:\n      lua_pushvalue(L, 1);\n      break;\n    case LUA_TBOOLEAN:\n      lua_pushstring(L, (lua_toboolean(L, 1) ? \"true\" : \"false\"));\n      break;\n    case LUA_TNIL:\n      lua_pushliteral(L, \"nil\");\n      break;\n    default:\n      lua_pushfstring(L, \"%s: %p\", luaL_typename(L, 1), lua_topointer(L, 1));\n      break;\n  }\n  return 1;\n}\n\n\nstatic int luaB_newproxy (lua_State *L) {\n  lua_settop(L, 1);\n  lua_newuserdata(L, 0);  /* create proxy */\n  if (lua_toboolean(L, 1) == 0)\n    return 1;  /* no metatable */\n  else if (lua_isboolean(L, 1)) {\n    lua_newtable(L);  /* create a new metatable `m' ... */\n    lua_pushvalue(L, -1);  /* ... and mark `m' as a valid metatable */\n    lua_pushboolean(L, 1);\n    lua_rawset(L, lua_upvalueindex(1));  /* weaktable[m] = true */\n  }\n  else {\n    int validproxy = 0;  /* to check if weaktable[metatable(u)] == true */\n    if (lua_getmetatable(L, 1)) {\n      lua_rawget(L, lua_upvalueindex(1));\n      validproxy = lua_toboolean(L, -1);\n      lua_pop(L, 1);  /* remove value */\n    }\n    luaL_argcheck(L, validproxy, 1, \"boolean or proxy expected\");\n    lua_getmetatable(L, 1);  /* metatable is valid; get it */\n  }\n  lua_setmetatable(L, 2);\n  return 1;\n}\n\n\nstatic const luaL_Reg base_funcs[] = {\n  {\"assert\", luaB_assert},\n  {\"collectgarbage\", luaB_collectgarbage},\n  {\"dofile\", luaB_dofile},\n  {\"error\", luaB_error},\n  {\"gcinfo\", luaB_gcinfo},\n  {\"getfenv\", luaB_getfenv},\n  {\"getmetatable\", luaB_getmetatable},\n  {\"loadfile\", luaB_loadfile},\n  {\"load\", luaB_load},\n  {\"loadstring\", luaB_loadstring},\n  {\"next\", luaB_next},\n  {\"pcall\", luaB_pcall},\n  {\"print\", luaB_print},\n  {\"rawequal\", luaB_rawequal},\n  {\"rawget\", luaB_rawget},\n  {\"rawset\", luaB_rawset},\n  {\"select\", luaB_select},\n  {\"setfenv\", luaB_setfenv},\n  {\"setmetatable\", luaB_setmetatable},\n  {\"tonumber\", luaB_tonumber},\n  {\"tostring\", luaB_tostring},\n  {\"type\", luaB_type},\n  {\"unpack\", luaB_unpack},\n  {\"xpcall\", luaB_xpcall},\n  {NULL, NULL}\n};\n\n\n/*\n** {======================================================\n** Coroutine library\n** =======================================================\n*/\n\n#define CO_RUN\t0\t/* running */\n#define CO_SUS\t1\t/* suspended */\n#define CO_NOR\t2\t/* 'normal' (it resumed another coroutine) */\n#define CO_DEAD\t3\n\nstatic const char *const statnames[] =\n    {\"running\", \"suspended\", \"normal\", \"dead\"};\n\nstatic int costatus (lua_State *L, lua_State *co) {\n  if (L == co) return CO_RUN;\n  switch (lua_status(co)) {\n    case LUA_YIELD:\n      return CO_SUS;\n    case 0: {\n      lua_Debug ar;\n      if (lua_getstack(co, 0, &ar) > 0)  /* does it have frames? */\n        return CO_NOR;  /* it is running */\n      else if (lua_gettop(co) == 0)\n          return CO_DEAD;\n      else\n        return CO_SUS;  /* initial state */\n    }\n    default:  /* some error occured */\n      return CO_DEAD;\n  }\n}\n\n\nstatic int luaB_costatus (lua_State *L) {\n  lua_State *co = lua_tothread(L, 1);\n  luaL_argcheck(L, co, 1, \"coroutine expected\");\n  lua_pushstring(L, statnames[costatus(L, co)]);\n  return 1;\n}\n\n\nstatic int auxresume (lua_State *L, lua_State *co, int narg) {\n  int status = costatus(L, co);\n  if (!lua_checkstack(co, narg))\n    luaL_error(L, \"too many arguments to resume\");\n  if (status != CO_SUS) {\n    lua_pushfstring(L, \"cannot resume %s coroutine\", statnames[status]);\n    return -1;  /* error flag */\n  }\n  lua_xmove(L, co, narg);\n  lua_setlevel(L, co);\n  status = lua_resume(co, narg);\n  if (status == 0 || status == LUA_YIELD) {\n    int nres = lua_gettop(co);\n    if (!lua_checkstack(L, nres + 1))\n      luaL_error(L, \"too many results to resume\");\n    lua_xmove(co, L, nres);  /* move yielded values */\n    return nres;\n  }\n  else {\n    lua_xmove(co, L, 1);  /* move error message */\n    return -1;  /* error flag */\n  }\n}\n\n\nstatic int luaB_coresume (lua_State *L) {\n  lua_State *co = lua_tothread(L, 1);\n  int r;\n  luaL_argcheck(L, co, 1, \"coroutine expected\");\n  r = auxresume(L, co, lua_gettop(L) - 1);\n  if (r < 0) {\n    lua_pushboolean(L, 0);\n    lua_insert(L, -2);\n    return 2;  /* return false + error message */\n  }\n  else {\n    lua_pushboolean(L, 1);\n    lua_insert(L, -(r + 1));\n    return r + 1;  /* return true + `resume' returns */\n  }\n}\n\n\nstatic int luaB_auxwrap (lua_State *L) {\n  lua_State *co = lua_tothread(L, lua_upvalueindex(1));\n  int r = auxresume(L, co, lua_gettop(L));\n  if (r < 0) {\n    if (lua_isstring(L, -1)) {  /* error object is a string? */\n      luaL_where(L, 1);  /* add extra info */\n      lua_insert(L, -2);\n      lua_concat(L, 2);\n    }\n    lua_error(L);  /* propagate error */\n  }\n  return r;\n}\n\n\nstatic int luaB_cocreate (lua_State *L) {\n  lua_State *NL = lua_newthread(L);\n  luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1,\n    \"Lua function expected\");\n  lua_pushvalue(L, 1);  /* move function to top */\n  lua_xmove(L, NL, 1);  /* move function from L to NL */\n  return 1;\n}\n\n\nstatic int luaB_cowrap (lua_State *L) {\n  luaB_cocreate(L);\n  lua_pushcclosure(L, luaB_auxwrap, 1);\n  return 1;\n}\n\n\nstatic int luaB_yield (lua_State *L) {\n  return lua_yield(L, lua_gettop(L));\n}\n\n\nstatic int luaB_corunning (lua_State *L) {\n  if (lua_pushthread(L))\n    lua_pushnil(L);  /* main thread is not a coroutine */\n  return 1;\n}\n\n\nstatic const luaL_Reg co_funcs[] = {\n  {\"create\", luaB_cocreate},\n  {\"resume\", luaB_coresume},\n  {\"running\", luaB_corunning},\n  {\"status\", luaB_costatus},\n  {\"wrap\", luaB_cowrap},\n  {\"yield\", luaB_yield},\n  {NULL, NULL}\n};\n\n/* }====================================================== */\n\n\nstatic void auxopen (lua_State *L, const char *name,\n                     lua_CFunction f, lua_CFunction u) {\n  lua_pushcfunction(L, u);\n  lua_pushcclosure(L, f, 1);\n  lua_setfield(L, -2, name);\n}\n\n\nstatic void base_open (lua_State *L) {\n  /* set global _G */\n  lua_pushvalue(L, LUA_GLOBALSINDEX);\n  lua_setglobal(L, \"_G\");\n  /* open lib into global table */\n  luaL_register(L, \"_G\", base_funcs);\n  lua_pushliteral(L, LUA_VERSION);\n  lua_setglobal(L, \"_VERSION\");  /* set global _VERSION */\n  /* `ipairs' and `pairs' need auxiliary functions as upvalues */\n  auxopen(L, \"ipairs\", luaB_ipairs, ipairsaux);\n  auxopen(L, \"pairs\", luaB_pairs, luaB_next);\n  /* `newproxy' needs a weaktable as upvalue */\n  lua_createtable(L, 0, 1);  /* new table `w' */\n  lua_pushvalue(L, -1);  /* `w' will be its own metatable */\n  lua_setmetatable(L, -2);\n  lua_pushliteral(L, \"kv\");\n  lua_setfield(L, -2, \"__mode\");  /* metatable(w).__mode = \"kv\" */\n  lua_pushcclosure(L, luaB_newproxy, 1);\n  lua_setglobal(L, \"newproxy\");  /* set global `newproxy' */\n}\n\n\nLUALIB_API int luaopen_base (lua_State *L) {\n  base_open(L);\n  luaL_register(L, LUA_COLIBNAME, co_funcs);\n  return 2;\n}\n\n"
  },
  {
    "path": "jni/lua/lcode.c",
    "content": "/*\n** $Id: lcode.c,v 2.25.1.5 2011/01/31 14:53:16 roberto Exp $\n** Code generator for Lua\n** See Copyright Notice in lua.h\n*/\n\n\n#include <stdlib.h>\n\n#define lcode_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"lcode.h\"\n#include \"ldebug.h\"\n#include \"ldo.h\"\n#include \"lgc.h\"\n#include \"llex.h\"\n#include \"lmem.h\"\n#include \"lobject.h\"\n#include \"lopcodes.h\"\n#include \"lparser.h\"\n#include \"ltable.h\"\n\n\n#define hasjumps(e)\t((e)->t != (e)->f)\n\n\nstatic int isnumeral(expdesc *e) {\n  return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP);\n}\n\n\nvoid luaK_nil (FuncState *fs, int from, int n) {\n  Instruction *previous;\n  if (fs->pc > fs->lasttarget) {  /* no jumps to current position? */\n    if (fs->pc == 0) {  /* function start? */\n      if (from >= fs->nactvar)\n        return;  /* positions are already clean */\n    }\n    else {\n      previous = &fs->f->code[fs->pc-1];\n      if (GET_OPCODE(*previous) == OP_LOADNIL) {\n        int pfrom = GETARG_A(*previous);\n        int pto = GETARG_B(*previous);\n        if (pfrom <= from && from <= pto+1) {  /* can connect both? */\n          if (from+n-1 > pto)\n            SETARG_B(*previous, from+n-1);\n          return;\n        }\n      }\n    }\n  }\n  luaK_codeABC(fs, OP_LOADNIL, from, from+n-1, 0);  /* else no optimization */\n}\n\n\nint luaK_jump (FuncState *fs) {\n  int jpc = fs->jpc;  /* save list of jumps to here */\n  int j;\n  fs->jpc = NO_JUMP;\n  j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP);\n  luaK_concat(fs, &j, jpc);  /* keep them on hold */\n  return j;\n}\n\n\nvoid luaK_ret (FuncState *fs, int first, int nret) {\n  luaK_codeABC(fs, OP_RETURN, first, nret+1, 0);\n}\n\n\nstatic int condjump (FuncState *fs, OpCode op, int A, int B, int C) {\n  luaK_codeABC(fs, op, A, B, C);\n  return luaK_jump(fs);\n}\n\n\nstatic void fixjump (FuncState *fs, int pc, int dest) {\n  Instruction *jmp = &fs->f->code[pc];\n  int offset = dest-(pc+1);\n  lua_assert(dest != NO_JUMP);\n  if (abs(offset) > MAXARG_sBx)\n    luaX_syntaxerror(fs->ls, \"control structure too long\");\n  SETARG_sBx(*jmp, offset);\n}\n\n\n/*\n** returns current `pc' and marks it as a jump target (to avoid wrong\n** optimizations with consecutive instructions not in the same basic block).\n*/\nint luaK_getlabel (FuncState *fs) {\n  fs->lasttarget = fs->pc;\n  return fs->pc;\n}\n\n\nstatic int getjump (FuncState *fs, int pc) {\n  int offset = GETARG_sBx(fs->f->code[pc]);\n  if (offset == NO_JUMP)  /* point to itself represents end of list */\n    return NO_JUMP;  /* end of list */\n  else\n    return (pc+1)+offset;  /* turn offset into absolute position */\n}\n\n\nstatic Instruction *getjumpcontrol (FuncState *fs, int pc) {\n  Instruction *pi = &fs->f->code[pc];\n  if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1))))\n    return pi-1;\n  else\n    return pi;\n}\n\n\n/*\n** check whether list has any jump that do not produce a value\n** (or produce an inverted value)\n*/\nstatic int need_value (FuncState *fs, int list) {\n  for (; list != NO_JUMP; list = getjump(fs, list)) {\n    Instruction i = *getjumpcontrol(fs, list);\n    if (GET_OPCODE(i) != OP_TESTSET) return 1;\n  }\n  return 0;  /* not found */\n}\n\n\nstatic int patchtestreg (FuncState *fs, int node, int reg) {\n  Instruction *i = getjumpcontrol(fs, node);\n  if (GET_OPCODE(*i) != OP_TESTSET)\n    return 0;  /* cannot patch other instructions */\n  if (reg != NO_REG && reg != GETARG_B(*i))\n    SETARG_A(*i, reg);\n  else  /* no register to put value or register already has the value */\n    *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i));\n\n  return 1;\n}\n\n\nstatic void removevalues (FuncState *fs, int list) {\n  for (; list != NO_JUMP; list = getjump(fs, list))\n      patchtestreg(fs, list, NO_REG);\n}\n\n\nstatic void patchlistaux (FuncState *fs, int list, int vtarget, int reg,\n                          int dtarget) {\n  while (list != NO_JUMP) {\n    int next = getjump(fs, list);\n    if (patchtestreg(fs, list, reg))\n      fixjump(fs, list, vtarget);\n    else\n      fixjump(fs, list, dtarget);  /* jump to default target */\n    list = next;\n  }\n}\n\n\nstatic void dischargejpc (FuncState *fs) {\n  patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc);\n  fs->jpc = NO_JUMP;\n}\n\n\nvoid luaK_patchlist (FuncState *fs, int list, int target) {\n  if (target == fs->pc)\n    luaK_patchtohere(fs, list);\n  else {\n    lua_assert(target < fs->pc);\n    patchlistaux(fs, list, target, NO_REG, target);\n  }\n}\n\n\nvoid luaK_patchtohere (FuncState *fs, int list) {\n  luaK_getlabel(fs);\n  luaK_concat(fs, &fs->jpc, list);\n}\n\n\nvoid luaK_concat (FuncState *fs, int *l1, int l2) {\n  if (l2 == NO_JUMP) return;\n  else if (*l1 == NO_JUMP)\n    *l1 = l2;\n  else {\n    int list = *l1;\n    int next;\n    while ((next = getjump(fs, list)) != NO_JUMP)  /* find last element */\n      list = next;\n    fixjump(fs, list, l2);\n  }\n}\n\n\nvoid luaK_checkstack (FuncState *fs, int n) {\n  int newstack = fs->freereg + n;\n  if (newstack > fs->f->maxstacksize) {\n    if (newstack >= MAXSTACK)\n      luaX_syntaxerror(fs->ls, \"function or expression too complex\");\n    fs->f->maxstacksize = cast_byte(newstack);\n  }\n}\n\n\nvoid luaK_reserveregs (FuncState *fs, int n) {\n  luaK_checkstack(fs, n);\n  fs->freereg += n;\n}\n\n\nstatic void freereg (FuncState *fs, int reg) {\n  if (!ISK(reg) && reg >= fs->nactvar) {\n    fs->freereg--;\n    lua_assert(reg == fs->freereg);\n  }\n}\n\n\nstatic void freeexp (FuncState *fs, expdesc *e) {\n  if (e->k == VNONRELOC)\n    freereg(fs, e->u.s.info);\n}\n\n\nstatic int addk (FuncState *fs, TValue *k, TValue *v) {\n  lua_State *L = fs->L;\n  TValue *idx = luaH_set(L, fs->h, k);\n  Proto *f = fs->f;\n  int oldsize = f->sizek;\n  if (ttisnumber(idx)) {\n    lua_assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v));\n    return cast_int(nvalue(idx));\n  }\n  else {  /* constant not found; create a new entry */\n    setnvalue(idx, cast_num(fs->nk));\n    luaM_growvector(L, f->k, fs->nk, f->sizek, TValue,\n                    MAXARG_Bx, \"constant table overflow\");\n    while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);\n    setobj(L, &f->k[fs->nk], v);\n    luaC_barrier(L, f, v);\n    return fs->nk++;\n  }\n}\n\n\nint luaK_stringK (FuncState *fs, TString *s) {\n  TValue o;\n  setsvalue(fs->L, &o, s);\n  return addk(fs, &o, &o);\n}\n\n\nint luaK_numberK (FuncState *fs, lua_Number r) {\n  TValue o;\n  setnvalue(&o, r);\n  return addk(fs, &o, &o);\n}\n\n\nstatic int boolK (FuncState *fs, int b) {\n  TValue o;\n  setbvalue(&o, b);\n  return addk(fs, &o, &o);\n}\n\n\nstatic int nilK (FuncState *fs) {\n  TValue k, v;\n  setnilvalue(&v);\n  /* cannot use nil as key; instead use table itself to represent nil */\n  sethvalue(fs->L, &k, fs->h);\n  return addk(fs, &k, &v);\n}\n\n\nvoid luaK_setreturns (FuncState *fs, expdesc *e, int nresults) {\n  if (e->k == VCALL) {  /* expression is an open function call? */\n    SETARG_C(getcode(fs, e), nresults+1);\n  }\n  else if (e->k == VVARARG) {\n    SETARG_B(getcode(fs, e), nresults+1);\n    SETARG_A(getcode(fs, e), fs->freereg);\n    luaK_reserveregs(fs, 1);\n  }\n}\n\n\nvoid luaK_setoneret (FuncState *fs, expdesc *e) {\n  if (e->k == VCALL) {  /* expression is an open function call? */\n    e->k = VNONRELOC;\n    e->u.s.info = GETARG_A(getcode(fs, e));\n  }\n  else if (e->k == VVARARG) {\n    SETARG_B(getcode(fs, e), 2);\n    e->k = VRELOCABLE;  /* can relocate its simple result */\n  }\n}\n\n\nvoid luaK_dischargevars (FuncState *fs, expdesc *e) {\n  switch (e->k) {\n    case VLOCAL: {\n      e->k = VNONRELOC;\n      break;\n    }\n    case VUPVAL: {\n      e->u.s.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.s.info, 0);\n      e->k = VRELOCABLE;\n      break;\n    }\n    case VGLOBAL: {\n      e->u.s.info = luaK_codeABx(fs, OP_GETGLOBAL, 0, e->u.s.info);\n      e->k = VRELOCABLE;\n      break;\n    }\n    case VINDEXED: {\n      freereg(fs, e->u.s.aux);\n      freereg(fs, e->u.s.info);\n      e->u.s.info = luaK_codeABC(fs, OP_GETTABLE, 0, e->u.s.info, e->u.s.aux);\n      e->k = VRELOCABLE;\n      break;\n    }\n    case VVARARG:\n    case VCALL: {\n      luaK_setoneret(fs, e);\n      break;\n    }\n    default: break;  /* there is one value available (somewhere) */\n  }\n}\n\n\nstatic int code_label (FuncState *fs, int A, int b, int jump) {\n  luaK_getlabel(fs);  /* those instructions may be jump targets */\n  return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump);\n}\n\n\nstatic void discharge2reg (FuncState *fs, expdesc *e, int reg) {\n  luaK_dischargevars(fs, e);\n  switch (e->k) {\n    case VNIL: {\n      luaK_nil(fs, reg, 1);\n      break;\n    }\n    case VFALSE:  case VTRUE: {\n      luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0);\n      break;\n    }\n    case VK: {\n      luaK_codeABx(fs, OP_LOADK, reg, e->u.s.info);\n      break;\n    }\n    case VKNUM: {\n      luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval));\n      break;\n    }\n    case VRELOCABLE: {\n      Instruction *pc = &getcode(fs, e);\n      SETARG_A(*pc, reg);\n      break;\n    }\n    case VNONRELOC: {\n      if (reg != e->u.s.info)\n        luaK_codeABC(fs, OP_MOVE, reg, e->u.s.info, 0);\n      break;\n    }\n    default: {\n      lua_assert(e->k == VVOID || e->k == VJMP);\n      return;  /* nothing to do... */\n    }\n  }\n  e->u.s.info = reg;\n  e->k = VNONRELOC;\n}\n\n\nstatic void discharge2anyreg (FuncState *fs, expdesc *e) {\n  if (e->k != VNONRELOC) {\n    luaK_reserveregs(fs, 1);\n    discharge2reg(fs, e, fs->freereg-1);\n  }\n}\n\n\nstatic void exp2reg (FuncState *fs, expdesc *e, int reg) {\n  discharge2reg(fs, e, reg);\n  if (e->k == VJMP)\n    luaK_concat(fs, &e->t, e->u.s.info);  /* put this jump in `t' list */\n  if (hasjumps(e)) {\n    int final;  /* position after whole expression */\n    int p_f = NO_JUMP;  /* position of an eventual LOAD false */\n    int p_t = NO_JUMP;  /* position of an eventual LOAD true */\n    if (need_value(fs, e->t) || need_value(fs, e->f)) {\n      int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs);\n      p_f = code_label(fs, reg, 0, 1);\n      p_t = code_label(fs, reg, 1, 0);\n      luaK_patchtohere(fs, fj);\n    }\n    final = luaK_getlabel(fs);\n    patchlistaux(fs, e->f, final, reg, p_f);\n    patchlistaux(fs, e->t, final, reg, p_t);\n  }\n  e->f = e->t = NO_JUMP;\n  e->u.s.info = reg;\n  e->k = VNONRELOC;\n}\n\n\nvoid luaK_exp2nextreg (FuncState *fs, expdesc *e) {\n  luaK_dischargevars(fs, e);\n  freeexp(fs, e);\n  luaK_reserveregs(fs, 1);\n  exp2reg(fs, e, fs->freereg - 1);\n}\n\n\nint luaK_exp2anyreg (FuncState *fs, expdesc *e) {\n  luaK_dischargevars(fs, e);\n  if (e->k == VNONRELOC) {\n    if (!hasjumps(e)) return e->u.s.info;  /* exp is already in a register */\n    if (e->u.s.info >= fs->nactvar) {  /* reg. is not a local? */\n      exp2reg(fs, e, e->u.s.info);  /* put value on it */\n      return e->u.s.info;\n    }\n  }\n  luaK_exp2nextreg(fs, e);  /* default */\n  return e->u.s.info;\n}\n\n\nvoid luaK_exp2val (FuncState *fs, expdesc *e) {\n  if (hasjumps(e))\n    luaK_exp2anyreg(fs, e);\n  else\n    luaK_dischargevars(fs, e);\n}\n\n\nint luaK_exp2RK (FuncState *fs, expdesc *e) {\n  luaK_exp2val(fs, e);\n  switch (e->k) {\n    case VKNUM:\n    case VTRUE:\n    case VFALSE:\n    case VNIL: {\n      if (fs->nk <= MAXINDEXRK) {  /* constant fit in RK operand? */\n        e->u.s.info = (e->k == VNIL)  ? nilK(fs) :\n                      (e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) :\n                                        boolK(fs, (e->k == VTRUE));\n        e->k = VK;\n        return RKASK(e->u.s.info);\n      }\n      else break;\n    }\n    case VK: {\n      if (e->u.s.info <= MAXINDEXRK)  /* constant fit in argC? */\n        return RKASK(e->u.s.info);\n      else break;\n    }\n    default: break;\n  }\n  /* not a constant in the right range: put it in a register */\n  return luaK_exp2anyreg(fs, e);\n}\n\n\nvoid luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) {\n  switch (var->k) {\n    case VLOCAL: {\n      freeexp(fs, ex);\n      exp2reg(fs, ex, var->u.s.info);\n      return;\n    }\n    case VUPVAL: {\n      int e = luaK_exp2anyreg(fs, ex);\n      luaK_codeABC(fs, OP_SETUPVAL, e, var->u.s.info, 0);\n      break;\n    }\n    case VGLOBAL: {\n      int e = luaK_exp2anyreg(fs, ex);\n      luaK_codeABx(fs, OP_SETGLOBAL, e, var->u.s.info);\n      break;\n    }\n    case VINDEXED: {\n      int e = luaK_exp2RK(fs, ex);\n      luaK_codeABC(fs, OP_SETTABLE, var->u.s.info, var->u.s.aux, e);\n      break;\n    }\n    default: {\n      lua_assert(0);  /* invalid var kind to store */\n      break;\n    }\n  }\n  freeexp(fs, ex);\n}\n\n\nvoid luaK_self (FuncState *fs, expdesc *e, expdesc *key) {\n  int func;\n  luaK_exp2anyreg(fs, e);\n  freeexp(fs, e);\n  func = fs->freereg;\n  luaK_reserveregs(fs, 2);\n  luaK_codeABC(fs, OP_SELF, func, e->u.s.info, luaK_exp2RK(fs, key));\n  freeexp(fs, key);\n  e->u.s.info = func;\n  e->k = VNONRELOC;\n}\n\n\nstatic void invertjump (FuncState *fs, expdesc *e) {\n  Instruction *pc = getjumpcontrol(fs, e->u.s.info);\n  lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET &&\n                                           GET_OPCODE(*pc) != OP_TEST);\n  SETARG_A(*pc, !(GETARG_A(*pc)));\n}\n\n\nstatic int jumponcond (FuncState *fs, expdesc *e, int cond) {\n  if (e->k == VRELOCABLE) {\n    Instruction ie = getcode(fs, e);\n    if (GET_OPCODE(ie) == OP_NOT) {\n      fs->pc--;  /* remove previous OP_NOT */\n      return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond);\n    }\n    /* else go through */\n  }\n  discharge2anyreg(fs, e);\n  freeexp(fs, e);\n  return condjump(fs, OP_TESTSET, NO_REG, e->u.s.info, cond);\n}\n\n\nvoid luaK_goiftrue (FuncState *fs, expdesc *e) {\n  int pc;  /* pc of last jump */\n  luaK_dischargevars(fs, e);\n  switch (e->k) {\n    case VK: case VKNUM: case VTRUE: {\n      pc = NO_JUMP;  /* always true; do nothing */\n      break;\n    }\n    case VJMP: {\n      invertjump(fs, e);\n      pc = e->u.s.info;\n      break;\n    }\n    default: {\n      pc = jumponcond(fs, e, 0);\n      break;\n    }\n  }\n  luaK_concat(fs, &e->f, pc);  /* insert last jump in `f' list */\n  luaK_patchtohere(fs, e->t);\n  e->t = NO_JUMP;\n}\n\n\nstatic void luaK_goiffalse (FuncState *fs, expdesc *e) {\n  int pc;  /* pc of last jump */\n  luaK_dischargevars(fs, e);\n  switch (e->k) {\n    case VNIL: case VFALSE: {\n      pc = NO_JUMP;  /* always false; do nothing */\n      break;\n    }\n    case VJMP: {\n      pc = e->u.s.info;\n      break;\n    }\n    default: {\n      pc = jumponcond(fs, e, 1);\n      break;\n    }\n  }\n  luaK_concat(fs, &e->t, pc);  /* insert last jump in `t' list */\n  luaK_patchtohere(fs, e->f);\n  e->f = NO_JUMP;\n}\n\n\nstatic void codenot (FuncState *fs, expdesc *e) {\n  luaK_dischargevars(fs, e);\n  switch (e->k) {\n    case VNIL: case VFALSE: {\n      e->k = VTRUE;\n      break;\n    }\n    case VK: case VKNUM: case VTRUE: {\n      e->k = VFALSE;\n      break;\n    }\n    case VJMP: {\n      invertjump(fs, e);\n      break;\n    }\n    case VRELOCABLE:\n    case VNONRELOC: {\n      discharge2anyreg(fs, e);\n      freeexp(fs, e);\n      e->u.s.info = luaK_codeABC(fs, OP_NOT, 0, e->u.s.info, 0);\n      e->k = VRELOCABLE;\n      break;\n    }\n    default: {\n      lua_assert(0);  /* cannot happen */\n      break;\n    }\n  }\n  /* interchange true and false lists */\n  { int temp = e->f; e->f = e->t; e->t = temp; }\n  removevalues(fs, e->f);\n  removevalues(fs, e->t);\n}\n\n\nvoid luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {\n  t->u.s.aux = luaK_exp2RK(fs, k);\n  t->k = VINDEXED;\n}\n\n\nstatic int constfolding (OpCode op, expdesc *e1, expdesc *e2) {\n  lua_Number v1, v2, r;\n  if (!isnumeral(e1) || !isnumeral(e2)) return 0;\n  v1 = e1->u.nval;\n  v2 = e2->u.nval;\n  switch (op) {\n    case OP_ADD: r = luai_numadd(v1, v2); break;\n    case OP_SUB: r = luai_numsub(v1, v2); break;\n    case OP_MUL: r = luai_nummul(v1, v2); break;\n    case OP_DIV:\n      if (v2 == 0) return 0;  /* do not attempt to divide by 0 */\n      r = luai_numdiv(v1, v2); break;\n    case OP_MOD:\n      if (v2 == 0) return 0;  /* do not attempt to divide by 0 */\n      r = luai_nummod(v1, v2); break;\n    case OP_POW: r = luai_numpow(v1, v2); break;\n    case OP_UNM: r = luai_numunm(v1); break;\n    case OP_LEN: return 0;  /* no constant folding for 'len' */\n    default: lua_assert(0); r = 0; break;\n  }\n  if (luai_numisnan(r)) return 0;  /* do not attempt to produce NaN */\n  e1->u.nval = r;\n  return 1;\n}\n\n\nstatic void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) {\n  if (constfolding(op, e1, e2))\n    return;\n  else {\n    int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0;\n    int o1 = luaK_exp2RK(fs, e1);\n    if (o1 > o2) {\n      freeexp(fs, e1);\n      freeexp(fs, e2);\n    }\n    else {\n      freeexp(fs, e2);\n      freeexp(fs, e1);\n    }\n    e1->u.s.info = luaK_codeABC(fs, op, 0, o1, o2);\n    e1->k = VRELOCABLE;\n  }\n}\n\n\nstatic void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,\n                                                          expdesc *e2) {\n  int o1 = luaK_exp2RK(fs, e1);\n  int o2 = luaK_exp2RK(fs, e2);\n  freeexp(fs, e2);\n  freeexp(fs, e1);\n  if (cond == 0 && op != OP_EQ) {\n    int temp;  /* exchange args to replace by `<' or `<=' */\n    temp = o1; o1 = o2; o2 = temp;  /* o1 <==> o2 */\n    cond = 1;\n  }\n  e1->u.s.info = condjump(fs, op, cond, o1, o2);\n  e1->k = VJMP;\n}\n\n\nvoid luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) {\n  expdesc e2;\n  e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;\n  switch (op) {\n    case OPR_MINUS: {\n      if (!isnumeral(e))\n        luaK_exp2anyreg(fs, e);  /* cannot operate on non-numeric constants */\n      codearith(fs, OP_UNM, e, &e2);\n      break;\n    }\n    case OPR_NOT: codenot(fs, e); break;\n    case OPR_LEN: {\n      luaK_exp2anyreg(fs, e);  /* cannot operate on constants */\n      codearith(fs, OP_LEN, e, &e2);\n      break;\n    }\n    default: lua_assert(0);\n  }\n}\n\n\nvoid luaK_infix (FuncState *fs, BinOpr op, expdesc *v) {\n  switch (op) {\n    case OPR_AND: {\n      luaK_goiftrue(fs, v);\n      break;\n    }\n    case OPR_OR: {\n      luaK_goiffalse(fs, v);\n      break;\n    }\n    case OPR_CONCAT: {\n      luaK_exp2nextreg(fs, v);  /* operand must be on the `stack' */\n      break;\n    }\n    case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:\n    case OPR_MOD: case OPR_POW: {\n      if (!isnumeral(v)) luaK_exp2RK(fs, v);\n      break;\n    }\n    default: {\n      luaK_exp2RK(fs, v);\n      break;\n    }\n  }\n}\n\n\nvoid luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) {\n  switch (op) {\n    case OPR_AND: {\n      lua_assert(e1->t == NO_JUMP);  /* list must be closed */\n      luaK_dischargevars(fs, e2);\n      luaK_concat(fs, &e2->f, e1->f);\n      *e1 = *e2;\n      break;\n    }\n    case OPR_OR: {\n      lua_assert(e1->f == NO_JUMP);  /* list must be closed */\n      luaK_dischargevars(fs, e2);\n      luaK_concat(fs, &e2->t, e1->t);\n      *e1 = *e2;\n      break;\n    }\n    case OPR_CONCAT: {\n      luaK_exp2val(fs, e2);\n      if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) {\n        lua_assert(e1->u.s.info == GETARG_B(getcode(fs, e2))-1);\n        freeexp(fs, e1);\n        SETARG_B(getcode(fs, e2), e1->u.s.info);\n        e1->k = VRELOCABLE; e1->u.s.info = e2->u.s.info;\n      }\n      else {\n        luaK_exp2nextreg(fs, e2);  /* operand must be on the 'stack' */\n        codearith(fs, OP_CONCAT, e1, e2);\n      }\n      break;\n    }\n    case OPR_ADD: codearith(fs, OP_ADD, e1, e2); break;\n    case OPR_SUB: codearith(fs, OP_SUB, e1, e2); break;\n    case OPR_MUL: codearith(fs, OP_MUL, e1, e2); break;\n    case OPR_DIV: codearith(fs, OP_DIV, e1, e2); break;\n    case OPR_MOD: codearith(fs, OP_MOD, e1, e2); break;\n    case OPR_POW: codearith(fs, OP_POW, e1, e2); break;\n    case OPR_EQ: codecomp(fs, OP_EQ, 1, e1, e2); break;\n    case OPR_NE: codecomp(fs, OP_EQ, 0, e1, e2); break;\n    case OPR_LT: codecomp(fs, OP_LT, 1, e1, e2); break;\n    case OPR_LE: codecomp(fs, OP_LE, 1, e1, e2); break;\n    case OPR_GT: codecomp(fs, OP_LT, 0, e1, e2); break;\n    case OPR_GE: codecomp(fs, OP_LE, 0, e1, e2); break;\n    default: lua_assert(0);\n  }\n}\n\n\nvoid luaK_fixline (FuncState *fs, int line) {\n  fs->f->lineinfo[fs->pc - 1] = line;\n}\n\n\nstatic int luaK_code (FuncState *fs, Instruction i, int line) {\n  Proto *f = fs->f;\n  dischargejpc(fs);  /* `pc' will change */\n  /* put new instruction in code array */\n  luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction,\n                  MAX_INT, \"code size overflow\");\n  f->code[fs->pc] = i;\n  /* save corresponding line information */\n  luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int,\n                  MAX_INT, \"code size overflow\");\n  f->lineinfo[fs->pc] = line;\n  return fs->pc++;\n}\n\n\nint luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) {\n  lua_assert(getOpMode(o) == iABC);\n  lua_assert(getBMode(o) != OpArgN || b == 0);\n  lua_assert(getCMode(o) != OpArgN || c == 0);\n  return luaK_code(fs, CREATE_ABC(o, a, b, c), fs->ls->lastline);\n}\n\n\nint luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {\n  lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx);\n  lua_assert(getCMode(o) == OpArgN);\n  return luaK_code(fs, CREATE_ABx(o, a, bc), fs->ls->lastline);\n}\n\n\nvoid luaK_setlist (FuncState *fs, int base, int nelems, int tostore) {\n  int c =  (nelems - 1)/LFIELDS_PER_FLUSH + 1;\n  int b = (tostore == LUA_MULTRET) ? 0 : tostore;\n  lua_assert(tostore != 0);\n  if (c <= MAXARG_C)\n    luaK_codeABC(fs, OP_SETLIST, base, b, c);\n  else {\n    luaK_codeABC(fs, OP_SETLIST, base, b, 0);\n    luaK_code(fs, cast(Instruction, c), fs->ls->lastline);\n  }\n  fs->freereg = base + 1;  /* free registers with list values */\n}\n\n"
  },
  {
    "path": "jni/lua/lcode.h",
    "content": "/*\n** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $\n** Code generator for Lua\n** See Copyright Notice in lua.h\n*/\n\n#ifndef lcode_h\n#define lcode_h\n\n#include \"llex.h\"\n#include \"lobject.h\"\n#include \"lopcodes.h\"\n#include \"lparser.h\"\n\n\n/*\n** Marks the end of a patch list. It is an invalid value both as an absolute\n** address, and as a list link (would link an element to itself).\n*/\n#define NO_JUMP (-1)\n\n\n/*\n** grep \"ORDER OPR\" if you change these enums\n*/\ntypedef enum BinOpr {\n  OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW,\n  OPR_CONCAT,\n  OPR_NE, OPR_EQ,\n  OPR_LT, OPR_LE, OPR_GT, OPR_GE,\n  OPR_AND, OPR_OR,\n  OPR_NOBINOPR\n} BinOpr;\n\n\ntypedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;\n\n\n#define getcode(fs,e)\t((fs)->f->code[(e)->u.s.info])\n\n#define luaK_codeAsBx(fs,o,A,sBx)\tluaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)\n\n#define luaK_setmultret(fs,e)\tluaK_setreturns(fs, e, LUA_MULTRET)\n\nLUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);\nLUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C);\nLUAI_FUNC void luaK_fixline (FuncState *fs, int line);\nLUAI_FUNC void luaK_nil (FuncState *fs, int from, int n);\nLUAI_FUNC void luaK_reserveregs (FuncState *fs, int n);\nLUAI_FUNC void luaK_checkstack (FuncState *fs, int n);\nLUAI_FUNC int luaK_stringK (FuncState *fs, TString *s);\nLUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r);\nLUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e);\nLUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e);\nLUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e);\nLUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e);\nLUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e);\nLUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key);\nLUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k);\nLUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e);\nLUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e);\nLUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults);\nLUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e);\nLUAI_FUNC int luaK_jump (FuncState *fs);\nLUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret);\nLUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target);\nLUAI_FUNC void luaK_patchtohere (FuncState *fs, int list);\nLUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2);\nLUAI_FUNC int luaK_getlabel (FuncState *fs);\nLUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v);\nLUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v);\nLUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2);\nLUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore);\n\n\n#endif\n"
  },
  {
    "path": "jni/lua/ldblib.c",
    "content": "/*\n** $Id: ldblib.c,v 1.104.1.4 2009/08/04 18:50:18 roberto Exp $\n** Interface from Lua to its debug API\n** See Copyright Notice in lua.h\n*/\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define ldblib_c\n#define LUA_LIB\n\n#include \"lua.h\"\n\n#include \"lauxlib.h\"\n#include \"lualib.h\"\n\n\n\nstatic int db_getregistry (lua_State *L) {\n  lua_pushvalue(L, LUA_REGISTRYINDEX);\n  return 1;\n}\n\n\nstatic int db_getmetatable (lua_State *L) {\n  luaL_checkany(L, 1);\n  if (!lua_getmetatable(L, 1)) {\n    lua_pushnil(L);  /* no metatable */\n  }\n  return 1;\n}\n\n\nstatic int db_setmetatable (lua_State *L) {\n  int t = lua_type(L, 2);\n  luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,\n                    \"nil or table expected\");\n  lua_settop(L, 2);\n  lua_pushboolean(L, lua_setmetatable(L, 1));\n  return 1;\n}\n\n\nstatic int db_getfenv (lua_State *L) {\n  luaL_checkany(L, 1);\n  lua_getfenv(L, 1);\n  return 1;\n}\n\n\nstatic int db_setfenv (lua_State *L) {\n  luaL_checktype(L, 2, LUA_TTABLE);\n  lua_settop(L, 2);\n  if (lua_setfenv(L, 1) == 0)\n    luaL_error(L, LUA_QL(\"setfenv\")\n                  \" cannot change environment of given object\");\n  return 1;\n}\n\n\nstatic void settabss (lua_State *L, const char *i, const char *v) {\n  lua_pushstring(L, v);\n  lua_setfield(L, -2, i);\n}\n\n\nstatic void settabsi (lua_State *L, const char *i, int v) {\n  lua_pushinteger(L, v);\n  lua_setfield(L, -2, i);\n}\n\n\nstatic lua_State *getthread (lua_State *L, int *arg) {\n  if (lua_isthread(L, 1)) {\n    *arg = 1;\n    return lua_tothread(L, 1);\n  }\n  else {\n    *arg = 0;\n    return L;\n  }\n}\n\n\nstatic void treatstackoption (lua_State *L, lua_State *L1, const char *fname) {\n  if (L == L1) {\n    lua_pushvalue(L, -2);\n    lua_remove(L, -3);\n  }\n  else\n    lua_xmove(L1, L, 1);\n  lua_setfield(L, -2, fname);\n}\n\n\nstatic int db_getinfo (lua_State *L) {\n  lua_Debug ar;\n  int arg;\n  lua_State *L1 = getthread(L, &arg);\n  const char *options = luaL_optstring(L, arg+2, \"flnSu\");\n  if (lua_isnumber(L, arg+1)) {\n    if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) {\n      lua_pushnil(L);  /* level out of range */\n      return 1;\n    }\n  }\n  else if (lua_isfunction(L, arg+1)) {\n    lua_pushfstring(L, \">%s\", options);\n    options = lua_tostring(L, -1);\n    lua_pushvalue(L, arg+1);\n    lua_xmove(L, L1, 1);\n  }\n  else\n    return luaL_argerror(L, arg+1, \"function or level expected\");\n  if (!lua_getinfo(L1, options, &ar))\n    return luaL_argerror(L, arg+2, \"invalid option\");\n  lua_createtable(L, 0, 2);\n  if (strchr(options, 'S')) {\n    settabss(L, \"source\", ar.source);\n    settabss(L, \"short_src\", ar.short_src);\n    settabsi(L, \"linedefined\", ar.linedefined);\n    settabsi(L, \"lastlinedefined\", ar.lastlinedefined);\n    settabss(L, \"what\", ar.what);\n  }\n  if (strchr(options, 'l'))\n    settabsi(L, \"currentline\", ar.currentline);\n  if (strchr(options, 'u'))\n    settabsi(L, \"nups\", ar.nups);\n  if (strchr(options, 'n')) {\n    settabss(L, \"name\", ar.name);\n    settabss(L, \"namewhat\", ar.namewhat);\n  }\n  if (strchr(options, 'L'))\n    treatstackoption(L, L1, \"activelines\");\n  if (strchr(options, 'f'))\n    treatstackoption(L, L1, \"func\");\n  return 1;  /* return table */\n}\n    \n\nstatic int db_getlocal (lua_State *L) {\n  int arg;\n  lua_State *L1 = getthread(L, &arg);\n  lua_Debug ar;\n  const char *name;\n  if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar))  /* out of range? */\n    return luaL_argerror(L, arg+1, \"level out of range\");\n  name = lua_getlocal(L1, &ar, luaL_checkint(L, arg+2));\n  if (name) {\n    lua_xmove(L1, L, 1);\n    lua_pushstring(L, name);\n    lua_pushvalue(L, -2);\n    return 2;\n  }\n  else {\n    lua_pushnil(L);\n    return 1;\n  }\n}\n\n\nstatic int db_setlocal (lua_State *L) {\n  int arg;\n  lua_State *L1 = getthread(L, &arg);\n  lua_Debug ar;\n  if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar))  /* out of range? */\n    return luaL_argerror(L, arg+1, \"level out of range\");\n  luaL_checkany(L, arg+3);\n  lua_settop(L, arg+3);\n  lua_xmove(L, L1, 1);\n  lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2)));\n  return 1;\n}\n\n\nstatic int auxupvalue (lua_State *L, int get) {\n  const char *name;\n  int n = luaL_checkint(L, 2);\n  luaL_checktype(L, 1, LUA_TFUNCTION);\n  if (lua_iscfunction(L, 1)) return 0;  /* cannot touch C upvalues from Lua */\n  name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n);\n  if (name == NULL) return 0;\n  lua_pushstring(L, name);\n  lua_insert(L, -(get+1));\n  return get + 1;\n}\n\n\nstatic int db_getupvalue (lua_State *L) {\n  return auxupvalue(L, 1);\n}\n\n\nstatic int db_setupvalue (lua_State *L) {\n  luaL_checkany(L, 3);\n  return auxupvalue(L, 0);\n}\n\n\n\nstatic const char KEY_HOOK = 'h';\n\n\nstatic void hookf (lua_State *L, lua_Debug *ar) {\n  static const char *const hooknames[] =\n    {\"call\", \"return\", \"line\", \"count\", \"tail return\"};\n  lua_pushlightuserdata(L, (void *)&KEY_HOOK);\n  lua_rawget(L, LUA_REGISTRYINDEX);\n  lua_pushlightuserdata(L, L);\n  lua_rawget(L, -2);\n  if (lua_isfunction(L, -1)) {\n    lua_pushstring(L, hooknames[(int)ar->event]);\n    if (ar->currentline >= 0)\n      lua_pushinteger(L, ar->currentline);\n    else lua_pushnil(L);\n    lua_assert(lua_getinfo(L, \"lS\", ar));\n    lua_call(L, 2, 0);\n  }\n}\n\n\nstatic int makemask (const char *smask, int count) {\n  int mask = 0;\n  if (strchr(smask, 'c')) mask |= LUA_MASKCALL;\n  if (strchr(smask, 'r')) mask |= LUA_MASKRET;\n  if (strchr(smask, 'l')) mask |= LUA_MASKLINE;\n  if (count > 0) mask |= LUA_MASKCOUNT;\n  return mask;\n}\n\n\nstatic char *unmakemask (int mask, char *smask) {\n  int i = 0;\n  if (mask & LUA_MASKCALL) smask[i++] = 'c';\n  if (mask & LUA_MASKRET) smask[i++] = 'r';\n  if (mask & LUA_MASKLINE) smask[i++] = 'l';\n  smask[i] = '\\0';\n  return smask;\n}\n\n\nstatic void gethooktable (lua_State *L) {\n  lua_pushlightuserdata(L, (void *)&KEY_HOOK);\n  lua_rawget(L, LUA_REGISTRYINDEX);\n  if (!lua_istable(L, -1)) {\n    lua_pop(L, 1);\n    lua_createtable(L, 0, 1);\n    lua_pushlightuserdata(L, (void *)&KEY_HOOK);\n    lua_pushvalue(L, -2);\n    lua_rawset(L, LUA_REGISTRYINDEX);\n  }\n}\n\n\nstatic int db_sethook (lua_State *L) {\n  int arg, mask, count;\n  lua_Hook func;\n  lua_State *L1 = getthread(L, &arg);\n  if (lua_isnoneornil(L, arg+1)) {\n    lua_settop(L, arg+1);\n    func = NULL; mask = 0; count = 0;  /* turn off hooks */\n  }\n  else {\n    const char *smask = luaL_checkstring(L, arg+2);\n    luaL_checktype(L, arg+1, LUA_TFUNCTION);\n    count = luaL_optint(L, arg+3, 0);\n    func = hookf; mask = makemask(smask, count);\n  }\n  gethooktable(L);\n  lua_pushlightuserdata(L, L1);\n  lua_pushvalue(L, arg+1);\n  lua_rawset(L, -3);  /* set new hook */\n  lua_pop(L, 1);  /* remove hook table */\n  lua_sethook(L1, func, mask, count);  /* set hooks */\n  return 0;\n}\n\n\nstatic int db_gethook (lua_State *L) {\n  int arg;\n  lua_State *L1 = getthread(L, &arg);\n  char buff[5];\n  int mask = lua_gethookmask(L1);\n  lua_Hook hook = lua_gethook(L1);\n  if (hook != NULL && hook != hookf)  /* external hook? */\n    lua_pushliteral(L, \"external hook\");\n  else {\n    gethooktable(L);\n    lua_pushlightuserdata(L, L1);\n    lua_rawget(L, -2);   /* get hook */\n    lua_remove(L, -2);  /* remove hook table */\n  }\n  lua_pushstring(L, unmakemask(mask, buff));\n  lua_pushinteger(L, lua_gethookcount(L1));\n  return 3;\n}\n\n\nstatic int db_debug (lua_State *L) {\n  for (;;) {\n    char buffer[250];\n    fputs(\"lua_debug> \", stderr);\n    if (fgets(buffer, sizeof(buffer), stdin) == 0 ||\n        strcmp(buffer, \"cont\\n\") == 0)\n      return 0;\n    if (luaL_loadbuffer(L, buffer, strlen(buffer), \"=(debug command)\") ||\n        lua_pcall(L, 0, 0, 0)) {\n      fputs(lua_tostring(L, -1), stderr);\n      fputs(\"\\n\", stderr);\n    }\n    lua_settop(L, 0);  /* remove eventual returns */\n  }\n}\n\n\n#define LEVELS1\t12\t/* size of the first part of the stack */\n#define LEVELS2\t10\t/* size of the second part of the stack */\n\nstatic int db_errorfb (lua_State *L) {\n  int level;\n  int firstpart = 1;  /* still before eventual `...' */\n  int arg;\n  lua_State *L1 = getthread(L, &arg);\n  lua_Debug ar;\n  if (lua_isnumber(L, arg+2)) {\n    level = (int)lua_tointeger(L, arg+2);\n    lua_pop(L, 1);\n  }\n  else\n    level = (L == L1) ? 1 : 0;  /* level 0 may be this own function */\n  if (lua_gettop(L) == arg)\n    lua_pushliteral(L, \"\");\n  else if (!lua_isstring(L, arg+1)) return 1;  /* message is not a string */\n  else lua_pushliteral(L, \"\\n\");\n  lua_pushliteral(L, \"stack traceback:\");\n  while (lua_getstack(L1, level++, &ar)) {\n    if (level > LEVELS1 && firstpart) {\n      /* no more than `LEVELS2' more levels? */\n      if (!lua_getstack(L1, level+LEVELS2, &ar))\n        level--;  /* keep going */\n      else {\n        lua_pushliteral(L, \"\\n\\t...\");  /* too many levels */\n        while (lua_getstack(L1, level+LEVELS2, &ar))  /* find last levels */\n          level++;\n      }\n      firstpart = 0;\n      continue;\n    }\n    lua_pushliteral(L, \"\\n\\t\");\n    lua_getinfo(L1, \"Snl\", &ar);\n    lua_pushfstring(L, \"%s:\", ar.short_src);\n    if (ar.currentline > 0)\n      lua_pushfstring(L, \"%d:\", ar.currentline);\n    if (*ar.namewhat != '\\0')  /* is there a name? */\n        lua_pushfstring(L, \" in function \" LUA_QS, ar.name);\n    else {\n      if (*ar.what == 'm')  /* main? */\n        lua_pushfstring(L, \" in main chunk\");\n      else if (*ar.what == 'C' || *ar.what == 't')\n        lua_pushliteral(L, \" ?\");  /* C function or tail call */\n      else\n        lua_pushfstring(L, \" in function <%s:%d>\",\n                           ar.short_src, ar.linedefined);\n    }\n    lua_concat(L, lua_gettop(L) - arg);\n  }\n  lua_concat(L, lua_gettop(L) - arg);\n  return 1;\n}\n\n\nstatic const luaL_Reg dblib[] = {\n  {\"debug\", db_debug},\n  {\"getfenv\", db_getfenv},\n  {\"gethook\", db_gethook},\n  {\"getinfo\", db_getinfo},\n  {\"getlocal\", db_getlocal},\n  {\"getregistry\", db_getregistry},\n  {\"getmetatable\", db_getmetatable},\n  {\"getupvalue\", db_getupvalue},\n  {\"setfenv\", db_setfenv},\n  {\"sethook\", db_sethook},\n  {\"setlocal\", db_setlocal},\n  {\"setmetatable\", db_setmetatable},\n  {\"setupvalue\", db_setupvalue},\n  {\"traceback\", db_errorfb},\n  {NULL, NULL}\n};\n\n\nLUALIB_API int luaopen_debug (lua_State *L) {\n  luaL_register(L, LUA_DBLIBNAME, dblib);\n  return 1;\n}\n\n"
  },
  {
    "path": "jni/lua/ldebug.c",
    "content": "/*\n** $Id: ldebug.c,v 2.29.1.6 2008/05/08 16:56:26 roberto Exp $\n** Debug Interface\n** See Copyright Notice in lua.h\n*/\n\n\n#include <stdarg.h>\n#include <stddef.h>\n#include <string.h>\n\n\n#define ldebug_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"lapi.h\"\n#include \"lcode.h\"\n#include \"ldebug.h\"\n#include \"ldo.h\"\n#include \"lfunc.h\"\n#include \"lobject.h\"\n#include \"lopcodes.h\"\n#include \"lstate.h\"\n#include \"lstring.h\"\n#include \"ltable.h\"\n#include \"ltm.h\"\n#include \"lvm.h\"\n\n\n\nstatic const char *getfuncname (lua_State *L, CallInfo *ci, const char **name);\n\n\nstatic int currentpc (lua_State *L, CallInfo *ci) {\n  if (!isLua(ci)) return -1;  /* function is not a Lua function? */\n  if (ci == L->ci)\n    ci->savedpc = L->savedpc;\n  return pcRel(ci->savedpc, ci_func(ci)->l.p);\n}\n\n\nstatic int currentline (lua_State *L, CallInfo *ci) {\n  int pc = currentpc(L, ci);\n  if (pc < 0)\n    return -1;  /* only active lua functions have current-line information */\n  else\n    return getline(ci_func(ci)->l.p, pc);\n}\n\n\n/*\n** this function can be called asynchronous (e.g. during a signal)\n*/\nLUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) {\n  if (func == NULL || mask == 0) {  /* turn off hooks? */\n    mask = 0;\n    func = NULL;\n  }\n  L->hook = func;\n  L->basehookcount = count;\n  resethookcount(L);\n  L->hookmask = cast_byte(mask);\n  return 1;\n}\n\n\nLUA_API lua_Hook lua_gethook (lua_State *L) {\n  return L->hook;\n}\n\n\nLUA_API int lua_gethookmask (lua_State *L) {\n  return L->hookmask;\n}\n\n\nLUA_API int lua_gethookcount (lua_State *L) {\n  return L->basehookcount;\n}\n\n\nLUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {\n  int status;\n  CallInfo *ci;\n  lua_lock(L);\n  for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) {\n    level--;\n    if (f_isLua(ci))  /* Lua function? */\n      level -= ci->tailcalls;  /* skip lost tail calls */\n  }\n  if (level == 0 && ci > L->base_ci) {  /* level found? */\n    status = 1;\n    ar->i_ci = cast_int(ci - L->base_ci);\n  }\n  else if (level < 0) {  /* level is of a lost tail call? */\n    status = 1;\n    ar->i_ci = 0;\n  }\n  else status = 0;  /* no such level */\n  lua_unlock(L);\n  return status;\n}\n\n\nstatic Proto *getluaproto (CallInfo *ci) {\n  return (isLua(ci) ? ci_func(ci)->l.p : NULL);\n}\n\n\nstatic const char *findlocal (lua_State *L, CallInfo *ci, int n) {\n  const char *name;\n  Proto *fp = getluaproto(ci);\n  if (fp && (name = luaF_getlocalname(fp, n, currentpc(L, ci))) != NULL)\n    return name;  /* is a local variable in a Lua function */\n  else {\n    StkId limit = (ci == L->ci) ? L->top : (ci+1)->func;\n    if (limit - ci->base >= n && n > 0)  /* is 'n' inside 'ci' stack? */\n      return \"(*temporary)\";\n    else\n      return NULL;\n  }\n}\n\n\nLUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {\n  CallInfo *ci = L->base_ci + ar->i_ci;\n  const char *name = findlocal(L, ci, n);\n  lua_lock(L);\n  if (name)\n      luaA_pushobject(L, ci->base + (n - 1));\n  lua_unlock(L);\n  return name;\n}\n\n\nLUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {\n  CallInfo *ci = L->base_ci + ar->i_ci;\n  const char *name = findlocal(L, ci, n);\n  lua_lock(L);\n  if (name)\n      setobjs2s(L, ci->base + (n - 1), L->top - 1);\n  L->top--;  /* pop value */\n  lua_unlock(L);\n  return name;\n}\n\n\nstatic void funcinfo (lua_Debug *ar, Closure *cl) {\n  if (cl->c.isC) {\n    ar->source = \"=[C]\";\n    ar->linedefined = -1;\n    ar->lastlinedefined = -1;\n    ar->what = \"C\";\n  }\n  else {\n    ar->source = getstr(cl->l.p->source);\n    ar->linedefined = cl->l.p->linedefined;\n    ar->lastlinedefined = cl->l.p->lastlinedefined;\n    ar->what = (ar->linedefined == 0) ? \"main\" : \"Lua\";\n  }\n  luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE);\n}\n\n\nstatic void info_tailcall (lua_Debug *ar) {\n  ar->name = ar->namewhat = \"\";\n  ar->what = \"tail\";\n  ar->lastlinedefined = ar->linedefined = ar->currentline = -1;\n  ar->source = \"=(tail call)\";\n  luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE);\n  ar->nups = 0;\n}\n\n\nstatic void collectvalidlines (lua_State *L, Closure *f) {\n  if (f == NULL || f->c.isC) {\n    setnilvalue(L->top);\n  }\n  else {\n    Table *t = luaH_new(L, 0, 0);\n    int *lineinfo = f->l.p->lineinfo;\n    int i;\n    for (i=0; i<f->l.p->sizelineinfo; i++)\n      setbvalue(luaH_setnum(L, t, lineinfo[i]), 1);\n    sethvalue(L, L->top, t); \n  }\n  incr_top(L);\n}\n\n\nstatic int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar,\n                    Closure *f, CallInfo *ci) {\n  int status = 1;\n  if (f == NULL) {\n    info_tailcall(ar);\n    return status;\n  }\n  for (; *what; what++) {\n    switch (*what) {\n      case 'S': {\n        funcinfo(ar, f);\n        break;\n      }\n      case 'l': {\n        ar->currentline = (ci) ? currentline(L, ci) : -1;\n        break;\n      }\n      case 'u': {\n        ar->nups = f->c.nupvalues;\n        break;\n      }\n      case 'n': {\n        ar->namewhat = (ci) ? getfuncname(L, ci, &ar->name) : NULL;\n        if (ar->namewhat == NULL) {\n          ar->namewhat = \"\";  /* not found */\n          ar->name = NULL;\n        }\n        break;\n      }\n      case 'L':\n      case 'f':  /* handled by lua_getinfo */\n        break;\n      default: status = 0;  /* invalid option */\n    }\n  }\n  return status;\n}\n\n\nLUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {\n  int status;\n  Closure *f = NULL;\n  CallInfo *ci = NULL;\n  lua_lock(L);\n  if (*what == '>') {\n    StkId func = L->top - 1;\n    luai_apicheck(L, ttisfunction(func));\n    what++;  /* skip the '>' */\n    f = clvalue(func);\n    L->top--;  /* pop function */\n  }\n  else if (ar->i_ci != 0) {  /* no tail call? */\n    ci = L->base_ci + ar->i_ci;\n    lua_assert(ttisfunction(ci->func));\n    f = clvalue(ci->func);\n  }\n  status = auxgetinfo(L, what, ar, f, ci);\n  if (strchr(what, 'f')) {\n    if (f == NULL) setnilvalue(L->top);\n    else setclvalue(L, L->top, f);\n    incr_top(L);\n  }\n  if (strchr(what, 'L'))\n    collectvalidlines(L, f);\n  lua_unlock(L);\n  return status;\n}\n\n\n/*\n** {======================================================\n** Symbolic Execution and code checker\n** =======================================================\n*/\n\n#define check(x)\t\tif (!(x)) return 0;\n\n#define checkjump(pt,pc)\tcheck(0 <= pc && pc < pt->sizecode)\n\n#define checkreg(pt,reg)\tcheck((reg) < (pt)->maxstacksize)\n\n\n\nstatic int precheck (const Proto *pt) {\n  check(pt->maxstacksize <= MAXSTACK);\n  check(pt->numparams+(pt->is_vararg & VARARG_HASARG) <= pt->maxstacksize);\n  check(!(pt->is_vararg & VARARG_NEEDSARG) ||\n              (pt->is_vararg & VARARG_HASARG));\n  check(pt->sizeupvalues <= pt->nups);\n  check(pt->sizelineinfo == pt->sizecode || pt->sizelineinfo == 0);\n  check(pt->sizecode > 0 && GET_OPCODE(pt->code[pt->sizecode-1]) == OP_RETURN);\n  return 1;\n}\n\n\n#define checkopenop(pt,pc)\tluaG_checkopenop((pt)->code[(pc)+1])\n\nint luaG_checkopenop (Instruction i) {\n  switch (GET_OPCODE(i)) {\n    case OP_CALL:\n    case OP_TAILCALL:\n    case OP_RETURN:\n    case OP_SETLIST: {\n      check(GETARG_B(i) == 0);\n      return 1;\n    }\n    default: return 0;  /* invalid instruction after an open call */\n  }\n}\n\n\nstatic int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) {\n  switch (mode) {\n    case OpArgN: check(r == 0); break;\n    case OpArgU: break;\n    case OpArgR: checkreg(pt, r); break;\n    case OpArgK:\n      check(ISK(r) ? INDEXK(r) < pt->sizek : r < pt->maxstacksize);\n      break;\n  }\n  return 1;\n}\n\n\nstatic Instruction symbexec (const Proto *pt, int lastpc, int reg) {\n  int pc;\n  int last;  /* stores position of last instruction that changed `reg' */\n  last = pt->sizecode-1;  /* points to final return (a `neutral' instruction) */\n  check(precheck(pt));\n  for (pc = 0; pc < lastpc; pc++) {\n    Instruction i = pt->code[pc];\n    OpCode op = GET_OPCODE(i);\n    int a = GETARG_A(i);\n    int b = 0;\n    int c = 0;\n    check(op < NUM_OPCODES);\n    checkreg(pt, a);\n    switch (getOpMode(op)) {\n      case iABC: {\n        b = GETARG_B(i);\n        c = GETARG_C(i);\n        check(checkArgMode(pt, b, getBMode(op)));\n        check(checkArgMode(pt, c, getCMode(op)));\n        break;\n      }\n      case iABx: {\n        b = GETARG_Bx(i);\n        if (getBMode(op) == OpArgK) check(b < pt->sizek);\n        break;\n      }\n      case iAsBx: {\n        b = GETARG_sBx(i);\n        if (getBMode(op) == OpArgR) {\n          int dest = pc+1+b;\n          check(0 <= dest && dest < pt->sizecode);\n          if (dest > 0) {\n            int j;\n            /* check that it does not jump to a setlist count; this\n               is tricky, because the count from a previous setlist may\n               have the same value of an invalid setlist; so, we must\n               go all the way back to the first of them (if any) */\n            for (j = 0; j < dest; j++) {\n              Instruction d = pt->code[dest-1-j];\n              if (!(GET_OPCODE(d) == OP_SETLIST && GETARG_C(d) == 0)) break;\n            }\n            /* if 'j' is even, previous value is not a setlist (even if\n               it looks like one) */\n            check((j&1) == 0);\n          }\n        }\n        break;\n      }\n    }\n    if (testAMode(op)) {\n      if (a == reg) last = pc;  /* change register `a' */\n    }\n    if (testTMode(op)) {\n      check(pc+2 < pt->sizecode);  /* check skip */\n      check(GET_OPCODE(pt->code[pc+1]) == OP_JMP);\n    }\n    switch (op) {\n      case OP_LOADBOOL: {\n        if (c == 1) {  /* does it jump? */\n          check(pc+2 < pt->sizecode);  /* check its jump */\n          check(GET_OPCODE(pt->code[pc+1]) != OP_SETLIST ||\n                GETARG_C(pt->code[pc+1]) != 0);\n        }\n        break;\n      }\n      case OP_LOADNIL: {\n        if (a <= reg && reg <= b)\n          last = pc;  /* set registers from `a' to `b' */\n        break;\n      }\n      case OP_GETUPVAL:\n      case OP_SETUPVAL: {\n        check(b < pt->nups);\n        break;\n      }\n      case OP_GETGLOBAL:\n      case OP_SETGLOBAL: {\n        check(ttisstring(&pt->k[b]));\n        break;\n      }\n      case OP_SELF: {\n        checkreg(pt, a+1);\n        if (reg == a+1) last = pc;\n        break;\n      }\n      case OP_CONCAT: {\n        check(b < c);  /* at least two operands */\n        break;\n      }\n      case OP_TFORLOOP: {\n        check(c >= 1);  /* at least one result (control variable) */\n        checkreg(pt, a+2+c);  /* space for results */\n        if (reg >= a+2) last = pc;  /* affect all regs above its base */\n        break;\n      }\n      case OP_FORLOOP:\n      case OP_FORPREP:\n        checkreg(pt, a+3);\n        /* go through */\n      case OP_JMP: {\n        int dest = pc+1+b;\n        /* not full check and jump is forward and do not skip `lastpc'? */\n        if (reg != NO_REG && pc < dest && dest <= lastpc)\n          pc += b;  /* do the jump */\n        break;\n      }\n      case OP_CALL:\n      case OP_TAILCALL: {\n        if (b != 0) {\n          checkreg(pt, a+b-1);\n        }\n        c--;  /* c = num. returns */\n        if (c == LUA_MULTRET) {\n          check(checkopenop(pt, pc));\n        }\n        else if (c != 0)\n          checkreg(pt, a+c-1);\n        if (reg >= a) last = pc;  /* affect all registers above base */\n        break;\n      }\n      case OP_RETURN: {\n        b--;  /* b = num. returns */\n        if (b > 0) checkreg(pt, a+b-1);\n        break;\n      }\n      case OP_SETLIST: {\n        if (b > 0) checkreg(pt, a + b);\n        if (c == 0) {\n          pc++;\n          check(pc < pt->sizecode - 1);\n        }\n        break;\n      }\n      case OP_CLOSURE: {\n        int nup, j;\n        check(b < pt->sizep);\n        nup = pt->p[b]->nups;\n        check(pc + nup < pt->sizecode);\n        for (j = 1; j <= nup; j++) {\n          OpCode op1 = GET_OPCODE(pt->code[pc + j]);\n          check(op1 == OP_GETUPVAL || op1 == OP_MOVE);\n        }\n        if (reg != NO_REG)  /* tracing? */\n          pc += nup;  /* do not 'execute' these pseudo-instructions */\n        break;\n      }\n      case OP_VARARG: {\n        check((pt->is_vararg & VARARG_ISVARARG) &&\n             !(pt->is_vararg & VARARG_NEEDSARG));\n        b--;\n        if (b == LUA_MULTRET) check(checkopenop(pt, pc));\n        checkreg(pt, a+b-1);\n        break;\n      }\n      default: break;\n    }\n  }\n  return pt->code[last];\n}\n\n#undef check\n#undef checkjump\n#undef checkreg\n\n/* }====================================================== */\n\n\nint luaG_checkcode (const Proto *pt) {\n  return (symbexec(pt, pt->sizecode, NO_REG) != 0);\n}\n\n\nstatic const char *kname (Proto *p, int c) {\n  if (ISK(c) && ttisstring(&p->k[INDEXK(c)]))\n    return svalue(&p->k[INDEXK(c)]);\n  else\n    return \"?\";\n}\n\n\nstatic const char *getobjname (lua_State *L, CallInfo *ci, int stackpos,\n                               const char **name) {\n  if (isLua(ci)) {  /* a Lua function? */\n    Proto *p = ci_func(ci)->l.p;\n    int pc = currentpc(L, ci);\n    Instruction i;\n    *name = luaF_getlocalname(p, stackpos+1, pc);\n    if (*name)  /* is a local? */\n      return \"local\";\n    i = symbexec(p, pc, stackpos);  /* try symbolic execution */\n    lua_assert(pc != -1);\n    switch (GET_OPCODE(i)) {\n      case OP_GETGLOBAL: {\n        int g = GETARG_Bx(i);  /* global index */\n        lua_assert(ttisstring(&p->k[g]));\n        *name = svalue(&p->k[g]);\n        return \"global\";\n      }\n      case OP_MOVE: {\n        int a = GETARG_A(i);\n        int b = GETARG_B(i);  /* move from `b' to `a' */\n        if (b < a)\n          return getobjname(L, ci, b, name);  /* get name for `b' */\n        break;\n      }\n      case OP_GETTABLE: {\n        int k = GETARG_C(i);  /* key index */\n        *name = kname(p, k);\n        return \"field\";\n      }\n      case OP_GETUPVAL: {\n        int u = GETARG_B(i);  /* upvalue index */\n        *name = p->upvalues ? getstr(p->upvalues[u]) : \"?\";\n        return \"upvalue\";\n      }\n      case OP_SELF: {\n        int k = GETARG_C(i);  /* key index */\n        *name = kname(p, k);\n        return \"method\";\n      }\n      default: break;\n    }\n  }\n  return NULL;  /* no useful name found */\n}\n\n\nstatic const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) {\n  Instruction i;\n  if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1))\n    return NULL;  /* calling function is not Lua (or is unknown) */\n  ci--;  /* calling function */\n  i = ci_func(ci)->l.p->code[currentpc(L, ci)];\n  if (GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL ||\n      GET_OPCODE(i) == OP_TFORLOOP)\n    return getobjname(L, ci, GETARG_A(i), name);\n  else\n    return NULL;  /* no useful name can be found */\n}\n\n\n/* only ANSI way to check whether a pointer points to an array */\nstatic int isinstack (CallInfo *ci, const TValue *o) {\n  StkId p;\n  for (p = ci->base; p < ci->top; p++)\n    if (o == p) return 1;\n  return 0;\n}\n\n\nvoid luaG_typeerror (lua_State *L, const TValue *o, const char *op) {\n  const char *name = NULL;\n  const char *t = luaT_typenames[ttype(o)];\n  const char *kind = (isinstack(L->ci, o)) ?\n                         getobjname(L, L->ci, cast_int(o - L->base), &name) :\n                         NULL;\n  if (kind)\n    luaG_runerror(L, \"attempt to %s %s \" LUA_QS \" (a %s value)\",\n                op, kind, name, t);\n  else\n    luaG_runerror(L, \"attempt to %s a %s value\", op, t);\n}\n\n\nvoid luaG_concaterror (lua_State *L, StkId p1, StkId p2) {\n  if (ttisstring(p1) || ttisnumber(p1)) p1 = p2;\n  lua_assert(!ttisstring(p1) && !ttisnumber(p1));\n  luaG_typeerror(L, p1, \"concatenate\");\n}\n\n\nvoid luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) {\n  TValue temp;\n  if (luaV_tonumber(p1, &temp) == NULL)\n    p2 = p1;  /* first operand is wrong */\n  luaG_typeerror(L, p2, \"perform arithmetic on\");\n}\n\n\nint luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) {\n  const char *t1 = luaT_typenames[ttype(p1)];\n  const char *t2 = luaT_typenames[ttype(p2)];\n  if (t1[2] == t2[2])\n    luaG_runerror(L, \"attempt to compare two %s values\", t1);\n  else\n    luaG_runerror(L, \"attempt to compare %s with %s\", t1, t2);\n  return 0;\n}\n\n\nstatic void addinfo (lua_State *L, const char *msg) {\n  CallInfo *ci = L->ci;\n  if (isLua(ci)) {  /* is Lua code? */\n    char buff[LUA_IDSIZE];  /* add file:line information */\n    int line = currentline(L, ci);\n    luaO_chunkid(buff, getstr(getluaproto(ci)->source), LUA_IDSIZE);\n    luaO_pushfstring(L, \"%s:%d: %s\", buff, line, msg);\n  }\n}\n\n\nvoid luaG_errormsg (lua_State *L) {\n  if (L->errfunc != 0) {  /* is there an error handling function? */\n    StkId errfunc = restorestack(L, L->errfunc);\n    if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR);\n    setobjs2s(L, L->top, L->top - 1);  /* move argument */\n    setobjs2s(L, L->top - 1, errfunc);  /* push function */\n    incr_top(L);\n    luaD_call(L, L->top - 2, 1);  /* call it */\n  }\n  luaD_throw(L, LUA_ERRRUN);\n}\n\n\nvoid luaG_runerror (lua_State *L, const char *fmt, ...) {\n  va_list argp;\n  va_start(argp, fmt);\n  addinfo(L, luaO_pushvfstring(L, fmt, argp));\n  va_end(argp);\n  luaG_errormsg(L);\n}\n\n"
  },
  {
    "path": "jni/lua/ldebug.h",
    "content": "/*\n** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $\n** Auxiliary functions from Debug Interface module\n** See Copyright Notice in lua.h\n*/\n\n#ifndef ldebug_h\n#define ldebug_h\n\n\n#include \"lstate.h\"\n\n\n#define pcRel(pc, p)\t(cast(int, (pc) - (p)->code) - 1)\n\n#define getline(f,pc)\t(((f)->lineinfo) ? (f)->lineinfo[pc] : 0)\n\n#define resethookcount(L)\t(L->hookcount = L->basehookcount)\n\n\nLUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o,\n                                             const char *opname);\nLUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2);\nLUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1,\n                                              const TValue *p2);\nLUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1,\n                                             const TValue *p2);\nLUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...);\nLUAI_FUNC void luaG_errormsg (lua_State *L);\nLUAI_FUNC int luaG_checkcode (const Proto *pt);\nLUAI_FUNC int luaG_checkopenop (Instruction i);\n\n#endif\n"
  },
  {
    "path": "jni/lua/ldo.c",
    "content": "/*\n** $Id: ldo.c,v 2.38.1.4 2012/01/18 02:27:10 roberto Exp $\n** Stack and Call structure of Lua\n** See Copyright Notice in lua.h\n*/\n\n\n#include <setjmp.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define ldo_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"ldebug.h\"\n#include \"ldo.h\"\n#include \"lfunc.h\"\n#include \"lgc.h\"\n#include \"lmem.h\"\n#include \"lobject.h\"\n#include \"lopcodes.h\"\n#include \"lparser.h\"\n#include \"lstate.h\"\n#include \"lstring.h\"\n#include \"ltable.h\"\n#include \"ltm.h\"\n#include \"lundump.h\"\n#include \"lvm.h\"\n#include \"lzio.h\"\n\n\n\n\n/*\n** {======================================================\n** Error-recovery functions\n** =======================================================\n*/\n\n\n/* chain list of long jump buffers */\nstruct lua_longjmp {\n  struct lua_longjmp *previous;\n  luai_jmpbuf b;\n  volatile int status;  /* error code */\n};\n\n\nvoid luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) {\n  switch (errcode) {\n    case LUA_ERRMEM: {\n      setsvalue2s(L, oldtop, luaS_newliteral(L, MEMERRMSG));\n      break;\n    }\n    case LUA_ERRERR: {\n      setsvalue2s(L, oldtop, luaS_newliteral(L, \"error in error handling\"));\n      break;\n    }\n    case LUA_ERRSYNTAX:\n    case LUA_ERRRUN: {\n      setobjs2s(L, oldtop, L->top - 1);  /* error message on current top */\n      break;\n    }\n  }\n  L->top = oldtop + 1;\n}\n\n\nstatic void restore_stack_limit (lua_State *L) {\n  lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1);\n  if (L->size_ci > LUAI_MAXCALLS) {  /* there was an overflow? */\n    int inuse = cast_int(L->ci - L->base_ci);\n    if (inuse + 1 < LUAI_MAXCALLS)  /* can `undo' overflow? */\n      luaD_reallocCI(L, LUAI_MAXCALLS);\n  }\n}\n\n\nstatic void resetstack (lua_State *L, int status) {\n  L->ci = L->base_ci;\n  L->base = L->ci->base;\n  luaF_close(L, L->base);  /* close eventual pending closures */\n  luaD_seterrorobj(L, status, L->base);\n  L->nCcalls = L->baseCcalls;\n  L->allowhook = 1;\n  restore_stack_limit(L);\n  L->errfunc = 0;\n  L->errorJmp = NULL;\n}\n\n\nvoid luaD_throw (lua_State *L, int errcode) {\n  if (L->errorJmp) {\n    L->errorJmp->status = errcode;\n    LUAI_THROW(L, L->errorJmp);\n  }\n  else {\n    L->status = cast_byte(errcode);\n    if (G(L)->panic) {\n      resetstack(L, errcode);\n      lua_unlock(L);\n      G(L)->panic(L);\n    }\n    exit(EXIT_FAILURE);\n  }\n}\n\n\nint luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {\n  struct lua_longjmp lj;\n  lj.status = 0;\n  lj.previous = L->errorJmp;  /* chain new error handler */\n  L->errorJmp = &lj;\n  LUAI_TRY(L, &lj,\n    (*f)(L, ud);\n  );\n  L->errorJmp = lj.previous;  /* restore old error handler */\n  return lj.status;\n}\n\n/* }====================================================== */\n\n\nstatic void correctstack (lua_State *L, TValue *oldstack) {\n  CallInfo *ci;\n  GCObject *up;\n  L->top = (L->top - oldstack) + L->stack;\n  for (up = L->openupval; up != NULL; up = up->gch.next)\n    gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack;\n  for (ci = L->base_ci; ci <= L->ci; ci++) {\n    ci->top = (ci->top - oldstack) + L->stack;\n    ci->base = (ci->base - oldstack) + L->stack;\n    ci->func = (ci->func - oldstack) + L->stack;\n  }\n  L->base = (L->base - oldstack) + L->stack;\n}\n\n\nvoid luaD_reallocstack (lua_State *L, int newsize) {\n  TValue *oldstack = L->stack;\n  int realsize = newsize + 1 + EXTRA_STACK;\n  lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1);\n  luaM_reallocvector(L, L->stack, L->stacksize, realsize, TValue);\n  L->stacksize = realsize;\n  L->stack_last = L->stack+newsize;\n  correctstack(L, oldstack);\n}\n\n\nvoid luaD_reallocCI (lua_State *L, int newsize) {\n  CallInfo *oldci = L->base_ci;\n  luaM_reallocvector(L, L->base_ci, L->size_ci, newsize, CallInfo);\n  L->size_ci = newsize;\n  L->ci = (L->ci - oldci) + L->base_ci;\n  L->end_ci = L->base_ci + L->size_ci - 1;\n}\n\n\nvoid luaD_growstack (lua_State *L, int n) {\n  if (n <= L->stacksize)  /* double size is enough? */\n    luaD_reallocstack(L, 2*L->stacksize);\n  else\n    luaD_reallocstack(L, L->stacksize + n);\n}\n\n\nstatic CallInfo *growCI (lua_State *L) {\n  if (L->size_ci > LUAI_MAXCALLS)  /* overflow while handling overflow? */\n    luaD_throw(L, LUA_ERRERR);\n  else {\n    luaD_reallocCI(L, 2*L->size_ci);\n    if (L->size_ci > LUAI_MAXCALLS)\n      luaG_runerror(L, \"stack overflow\");\n  }\n  return ++L->ci;\n}\n\n\nvoid luaD_callhook (lua_State *L, int event, int line) {\n  lua_Hook hook = L->hook;\n  if (hook && L->allowhook) {\n    ptrdiff_t top = savestack(L, L->top);\n    ptrdiff_t ci_top = savestack(L, L->ci->top);\n    lua_Debug ar;\n    ar.event = event;\n    ar.currentline = line;\n    if (event == LUA_HOOKTAILRET)\n      ar.i_ci = 0;  /* tail call; no debug information about it */\n    else\n      ar.i_ci = cast_int(L->ci - L->base_ci);\n    luaD_checkstack(L, LUA_MINSTACK);  /* ensure minimum stack size */\n    L->ci->top = L->top + LUA_MINSTACK;\n    lua_assert(L->ci->top <= L->stack_last);\n    L->allowhook = 0;  /* cannot call hooks inside a hook */\n    lua_unlock(L);\n    (*hook)(L, &ar);\n    lua_lock(L);\n    lua_assert(!L->allowhook);\n    L->allowhook = 1;\n    L->ci->top = restorestack(L, ci_top);\n    L->top = restorestack(L, top);\n  }\n}\n\n\nstatic StkId adjust_varargs (lua_State *L, Proto *p, int actual) {\n  int i;\n  int nfixargs = p->numparams;\n  Table *htab = NULL;\n  StkId base, fixed;\n  for (; actual < nfixargs; ++actual)\n    setnilvalue(L->top++);\n#if defined(LUA_COMPAT_VARARG)\n  if (p->is_vararg & VARARG_NEEDSARG) { /* compat. with old-style vararg? */\n    int nvar = actual - nfixargs;  /* number of extra arguments */\n    lua_assert(p->is_vararg & VARARG_HASARG);\n    luaC_checkGC(L);\n    luaD_checkstack(L, p->maxstacksize);\n    htab = luaH_new(L, nvar, 1);  /* create `arg' table */\n    for (i=0; i<nvar; i++)  /* put extra arguments into `arg' table */\n      setobj2n(L, luaH_setnum(L, htab, i+1), L->top - nvar + i);\n    /* store counter in field `n' */\n    setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, \"n\")), cast_num(nvar));\n  }\n#endif\n  /* move fixed parameters to final position */\n  fixed = L->top - actual;  /* first fixed argument */\n  base = L->top;  /* final position of first argument */\n  for (i=0; i<nfixargs; i++) {\n    setobjs2s(L, L->top++, fixed+i);\n    setnilvalue(fixed+i);\n  }\n  /* add `arg' parameter */\n  if (htab) {\n    sethvalue(L, L->top++, htab);\n    lua_assert(iswhite(obj2gco(htab)));\n  }\n  return base;\n}\n\n\nstatic StkId tryfuncTM (lua_State *L, StkId func) {\n  const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL);\n  StkId p;\n  ptrdiff_t funcr = savestack(L, func);\n  if (!ttisfunction(tm))\n    luaG_typeerror(L, func, \"call\");\n  /* Open a hole inside the stack at `func' */\n  for (p = L->top; p > func; p--) setobjs2s(L, p, p-1);\n  incr_top(L);\n  func = restorestack(L, funcr);  /* previous call may change stack */\n  setobj2s(L, func, tm);  /* tag method is the new function to be called */\n  return func;\n}\n\n\n\n#define inc_ci(L) \\\n  ((L->ci == L->end_ci) ? growCI(L) : \\\n   (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci))\n\n\nint luaD_precall (lua_State *L, StkId func, int nresults) {\n  LClosure *cl;\n  ptrdiff_t funcr;\n  if (!ttisfunction(func)) /* `func' is not a function? */\n    func = tryfuncTM(L, func);  /* check the `function' tag method */\n  funcr = savestack(L, func);\n  cl = &clvalue(func)->l;\n  L->ci->savedpc = L->savedpc;\n  if (!cl->isC) {  /* Lua function? prepare its call */\n    CallInfo *ci;\n    StkId st, base;\n    Proto *p = cl->p;\n    luaD_checkstack(L, p->maxstacksize);\n    func = restorestack(L, funcr);\n    if (!p->is_vararg) {  /* no varargs? */\n      base = func + 1;\n      if (L->top > base + p->numparams)\n        L->top = base + p->numparams;\n    }\n    else {  /* vararg function */\n      int nargs = cast_int(L->top - func) - 1;\n      base = adjust_varargs(L, p, nargs);\n      func = restorestack(L, funcr);  /* previous call may change the stack */\n    }\n    ci = inc_ci(L);  /* now `enter' new function */\n    ci->func = func;\n    L->base = ci->base = base;\n    ci->top = L->base + p->maxstacksize;\n    lua_assert(ci->top <= L->stack_last);\n    L->savedpc = p->code;  /* starting point */\n    ci->tailcalls = 0;\n    ci->nresults = nresults;\n    for (st = L->top; st < ci->top; st++)\n      setnilvalue(st);\n    L->top = ci->top;\n    if (L->hookmask & LUA_MASKCALL) {\n      L->savedpc++;  /* hooks assume 'pc' is already incremented */\n      luaD_callhook(L, LUA_HOOKCALL, -1);\n      L->savedpc--;  /* correct 'pc' */\n    }\n    return PCRLUA;\n  }\n  else {  /* if is a C function, call it */\n    CallInfo *ci;\n    int n;\n    luaD_checkstack(L, LUA_MINSTACK);  /* ensure minimum stack size */\n    ci = inc_ci(L);  /* now `enter' new function */\n    ci->func = restorestack(L, funcr);\n    L->base = ci->base = ci->func + 1;\n    ci->top = L->top + LUA_MINSTACK;\n    lua_assert(ci->top <= L->stack_last);\n    ci->nresults = nresults;\n    if (L->hookmask & LUA_MASKCALL)\n      luaD_callhook(L, LUA_HOOKCALL, -1);\n    lua_unlock(L);\n    n = (*curr_func(L)->c.f)(L);  /* do the actual call */\n    lua_lock(L);\n    if (n < 0)  /* yielding? */\n      return PCRYIELD;\n    else {\n      luaD_poscall(L, L->top - n);\n      return PCRC;\n    }\n  }\n}\n\n\nstatic StkId callrethooks (lua_State *L, StkId firstResult) {\n  ptrdiff_t fr = savestack(L, firstResult);  /* next call may change stack */\n  luaD_callhook(L, LUA_HOOKRET, -1);\n  if (f_isLua(L->ci)) {  /* Lua function? */\n    while ((L->hookmask & LUA_MASKRET) && L->ci->tailcalls--) /* tail calls */\n      luaD_callhook(L, LUA_HOOKTAILRET, -1);\n  }\n  return restorestack(L, fr);\n}\n\n\nint luaD_poscall (lua_State *L, StkId firstResult) {\n  StkId res;\n  int wanted, i;\n  CallInfo *ci;\n  if (L->hookmask & LUA_MASKRET)\n    firstResult = callrethooks(L, firstResult);\n  ci = L->ci--;\n  res = ci->func;  /* res == final position of 1st result */\n  wanted = ci->nresults;\n  L->base = (ci - 1)->base;  /* restore base */\n  L->savedpc = (ci - 1)->savedpc;  /* restore savedpc */\n  /* move results to correct place */\n  for (i = wanted; i != 0 && firstResult < L->top; i--)\n    setobjs2s(L, res++, firstResult++);\n  while (i-- > 0)\n    setnilvalue(res++);\n  L->top = res;\n  return (wanted - LUA_MULTRET);  /* 0 iff wanted == LUA_MULTRET */\n}\n\n\n/*\n** Call a function (C or Lua). The function to be called is at *func.\n** The arguments are on the stack, right after the function.\n** When returns, all the results are on the stack, starting at the original\n** function position.\n*/ \nvoid luaD_call (lua_State *L, StkId func, int nResults) {\n  if (++L->nCcalls >= LUAI_MAXCCALLS) {\n    if (L->nCcalls == LUAI_MAXCCALLS)\n      luaG_runerror(L, \"C stack overflow\");\n    else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3)))\n      luaD_throw(L, LUA_ERRERR);  /* error while handing stack error */\n  }\n  if (luaD_precall(L, func, nResults) == PCRLUA)  /* is a Lua function? */\n    luaV_execute(L, 1);  /* call it */\n  L->nCcalls--;\n  luaC_checkGC(L);\n}\n\n\nstatic void resume (lua_State *L, void *ud) {\n  StkId firstArg = cast(StkId, ud);\n  CallInfo *ci = L->ci;\n  if (L->status == 0) {  /* start coroutine? */\n    lua_assert(ci == L->base_ci && firstArg > L->base);\n    if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA)\n      return;\n  }\n  else {  /* resuming from previous yield */\n    lua_assert(L->status == LUA_YIELD);\n    L->status = 0;\n    if (!f_isLua(ci)) {  /* `common' yield? */\n      /* finish interrupted execution of `OP_CALL' */\n      lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL ||\n                 GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_TAILCALL);\n      if (luaD_poscall(L, firstArg))  /* complete it... */\n        L->top = L->ci->top;  /* and correct top if not multiple results */\n    }\n    else  /* yielded inside a hook: just continue its execution */\n      L->base = L->ci->base;\n  }\n  luaV_execute(L, cast_int(L->ci - L->base_ci));\n}\n\n\nstatic int resume_error (lua_State *L, const char *msg) {\n  L->top = L->ci->base;\n  setsvalue2s(L, L->top, luaS_new(L, msg));\n  incr_top(L);\n  lua_unlock(L);\n  return LUA_ERRRUN;\n}\n\n\nLUA_API int lua_resume (lua_State *L, int nargs) {\n  int status;\n  lua_lock(L);\n  if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci))\n      return resume_error(L, \"cannot resume non-suspended coroutine\");\n  if (L->nCcalls >= LUAI_MAXCCALLS)\n    return resume_error(L, \"C stack overflow\");\n  luai_userstateresume(L, nargs);\n  lua_assert(L->errfunc == 0);\n  L->baseCcalls = ++L->nCcalls;\n  status = luaD_rawrunprotected(L, resume, L->top - nargs);\n  if (status != 0) {  /* error? */\n    L->status = cast_byte(status);  /* mark thread as `dead' */\n    luaD_seterrorobj(L, status, L->top);\n    L->ci->top = L->top;\n  }\n  else {\n    lua_assert(L->nCcalls == L->baseCcalls);\n    status = L->status;\n  }\n  --L->nCcalls;\n  lua_unlock(L);\n  return status;\n}\n\n\nLUA_API int lua_yield (lua_State *L, int nresults) {\n  luai_userstateyield(L, nresults);\n  lua_lock(L);\n  if (L->nCcalls > L->baseCcalls)\n    luaG_runerror(L, \"attempt to yield across metamethod/C-call boundary\");\n  L->base = L->top - nresults;  /* protect stack slots below */\n  L->status = LUA_YIELD;\n  lua_unlock(L);\n  return -1;\n}\n\n\nint luaD_pcall (lua_State *L, Pfunc func, void *u,\n                ptrdiff_t old_top, ptrdiff_t ef) {\n  int status;\n  unsigned short oldnCcalls = L->nCcalls;\n  ptrdiff_t old_ci = saveci(L, L->ci);\n  lu_byte old_allowhooks = L->allowhook;\n  ptrdiff_t old_errfunc = L->errfunc;\n  L->errfunc = ef;\n  status = luaD_rawrunprotected(L, func, u);\n  if (status != 0) {  /* an error occurred? */\n    StkId oldtop = restorestack(L, old_top);\n    luaF_close(L, oldtop);  /* close eventual pending closures */\n    luaD_seterrorobj(L, status, oldtop);\n    L->nCcalls = oldnCcalls;\n    L->ci = restoreci(L, old_ci);\n    L->base = L->ci->base;\n    L->savedpc = L->ci->savedpc;\n    L->allowhook = old_allowhooks;\n    restore_stack_limit(L);\n  }\n  L->errfunc = old_errfunc;\n  return status;\n}\n\n\n\n/*\n** Execute a protected parser.\n*/\nstruct SParser {  /* data to `f_parser' */\n  ZIO *z;\n  Mbuffer buff;  /* buffer to be used by the scanner */\n  const char *name;\n};\n\nstatic void f_parser (lua_State *L, void *ud) {\n  int i;\n  Proto *tf;\n  Closure *cl;\n  struct SParser *p = cast(struct SParser *, ud);\n  int c = luaZ_lookahead(p->z);\n  luaC_checkGC(L);\n  tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z,\n                                                             &p->buff, p->name);\n  cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L)));\n  cl->l.p = tf;\n  for (i = 0; i < tf->nups; i++)  /* initialize eventual upvalues */\n    cl->l.upvals[i] = luaF_newupval(L);\n  setclvalue(L, L->top, cl);\n  incr_top(L);\n}\n\n\nint luaD_protectedparser (lua_State *L, ZIO *z, const char *name) {\n  struct SParser p;\n  int status;\n  p.z = z; p.name = name;\n  luaZ_initbuffer(L, &p.buff);\n  status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc);\n  luaZ_freebuffer(L, &p.buff);\n  return status;\n}\n\n\n"
  },
  {
    "path": "jni/lua/ldo.h",
    "content": "/*\n** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $\n** Stack and Call structure of Lua\n** See Copyright Notice in lua.h\n*/\n\n#ifndef ldo_h\n#define ldo_h\n\n\n#include \"lobject.h\"\n#include \"lstate.h\"\n#include \"lzio.h\"\n\n\n#define luaD_checkstack(L,n)\t\\\n  if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \\\n    luaD_growstack(L, n); \\\n  else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));\n\n\n#define incr_top(L) {luaD_checkstack(L,1); L->top++;}\n\n#define savestack(L,p)\t\t((char *)(p) - (char *)L->stack)\n#define restorestack(L,n)\t((TValue *)((char *)L->stack + (n)))\n\n#define saveci(L,p)\t\t((char *)(p) - (char *)L->base_ci)\n#define restoreci(L,n)\t\t((CallInfo *)((char *)L->base_ci + (n)))\n\n\n/* results from luaD_precall */\n#define PCRLUA\t\t0\t/* initiated a call to a Lua function */\n#define PCRC\t\t1\t/* did a call to a C function */\n#define PCRYIELD\t2\t/* C funtion yielded */\n\n\n/* type of protected functions, to be ran by `runprotected' */\ntypedef void (*Pfunc) (lua_State *L, void *ud);\n\nLUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name);\nLUAI_FUNC void luaD_callhook (lua_State *L, int event, int line);\nLUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);\nLUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);\nLUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,\n                                        ptrdiff_t oldtop, ptrdiff_t ef);\nLUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);\nLUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);\nLUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);\nLUAI_FUNC void luaD_growstack (lua_State *L, int n);\n\nLUAI_FUNC void luaD_throw (lua_State *L, int errcode);\nLUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);\n\nLUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);\n\n#endif\n\n"
  },
  {
    "path": "jni/lua/ldump.c",
    "content": "/*\n** $Id: ldump.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $\n** save precompiled Lua chunks\n** See Copyright Notice in lua.h\n*/\n\n#include <stddef.h>\n\n#define ldump_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"lobject.h\"\n#include \"lstate.h\"\n#include \"lundump.h\"\n\ntypedef struct {\n lua_State* L;\n lua_Writer writer;\n void* data;\n int strip;\n int status;\n} DumpState;\n\n#define DumpMem(b,n,size,D)\tDumpBlock(b,(n)*(size),D)\n#define DumpVar(x,D)\t \tDumpMem(&x,1,sizeof(x),D)\n\nstatic void DumpBlock(const void* b, size_t size, DumpState* D)\n{\n if (D->status==0)\n {\n  lua_unlock(D->L);\n  D->status=(*D->writer)(D->L,b,size,D->data);\n  lua_lock(D->L);\n }\n}\n\nstatic void DumpChar(int y, DumpState* D)\n{\n char x=(char)y;\n DumpVar(x,D);\n}\n\nstatic void DumpInt(int x, DumpState* D)\n{\n DumpVar(x,D);\n}\n\nstatic void DumpNumber(lua_Number x, DumpState* D)\n{\n DumpVar(x,D);\n}\n\nstatic void DumpVector(const void* b, int n, size_t size, DumpState* D)\n{\n DumpInt(n,D);\n DumpMem(b,n,size,D);\n}\n\nstatic void DumpString(const TString* s, DumpState* D)\n{\n if (s==NULL || getstr(s)==NULL)\n {\n  size_t size=0;\n  DumpVar(size,D);\n }\n else\n {\n  size_t size=s->tsv.len+1;\t\t/* include trailing '\\0' */\n  DumpVar(size,D);\n  DumpBlock(getstr(s),size,D);\n }\n}\n\n#define DumpCode(f,D)\t DumpVector(f->code,f->sizecode,sizeof(Instruction),D)\n\nstatic void DumpFunction(const Proto* f, const TString* p, DumpState* D);\n\nstatic void DumpConstants(const Proto* f, DumpState* D)\n{\n int i,n=f->sizek;\n DumpInt(n,D);\n for (i=0; i<n; i++)\n {\n  const TValue* o=&f->k[i];\n  DumpChar(ttype(o),D);\n  switch (ttype(o))\n  {\n   case LUA_TNIL:\n\tbreak;\n   case LUA_TBOOLEAN:\n\tDumpChar(bvalue(o),D);\n\tbreak;\n   case LUA_TNUMBER:\n\tDumpNumber(nvalue(o),D);\n\tbreak;\n   case LUA_TSTRING:\n\tDumpString(rawtsvalue(o),D);\n\tbreak;\n   default:\n\tlua_assert(0);\t\t\t/* cannot happen */\n\tbreak;\n  }\n }\n n=f->sizep;\n DumpInt(n,D);\n for (i=0; i<n; i++) DumpFunction(f->p[i],f->source,D);\n}\n\nstatic void DumpDebug(const Proto* f, DumpState* D)\n{\n int i,n;\n n= (D->strip) ? 0 : f->sizelineinfo;\n DumpVector(f->lineinfo,n,sizeof(int),D);\n n= (D->strip) ? 0 : f->sizelocvars;\n DumpInt(n,D);\n for (i=0; i<n; i++)\n {\n  DumpString(f->locvars[i].varname,D);\n  DumpInt(f->locvars[i].startpc,D);\n  DumpInt(f->locvars[i].endpc,D);\n }\n n= (D->strip) ? 0 : f->sizeupvalues;\n DumpInt(n,D);\n for (i=0; i<n; i++) DumpString(f->upvalues[i],D);\n}\n\nstatic void DumpFunction(const Proto* f, const TString* p, DumpState* D)\n{\n DumpString((f->source==p || D->strip) ? NULL : f->source,D);\n DumpInt(f->linedefined,D);\n DumpInt(f->lastlinedefined,D);\n DumpChar(f->nups,D);\n DumpChar(f->numparams,D);\n DumpChar(f->is_vararg,D);\n DumpChar(f->maxstacksize,D);\n DumpCode(f,D);\n DumpConstants(f,D);\n DumpDebug(f,D);\n}\n\nstatic void DumpHeader(DumpState* D)\n{\n char h[LUAC_HEADERSIZE];\n luaU_header(h);\n DumpBlock(h,LUAC_HEADERSIZE,D);\n}\n\n/*\n** dump Lua function as precompiled chunk\n*/\nint luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip)\n{\n DumpState D;\n D.L=L;\n D.writer=w;\n D.data=data;\n D.strip=strip;\n D.status=0;\n DumpHeader(&D);\n DumpFunction(f,NULL,&D);\n return D.status;\n}\n"
  },
  {
    "path": "jni/lua/lfunc.c",
    "content": "/*\n** $Id: lfunc.c,v 2.12.1.2 2007/12/28 14:58:43 roberto Exp $\n** Auxiliary functions to manipulate prototypes and closures\n** See Copyright Notice in lua.h\n*/\n\n\n#include <stddef.h>\n\n#define lfunc_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"lfunc.h\"\n#include \"lgc.h\"\n#include \"lmem.h\"\n#include \"lobject.h\"\n#include \"lstate.h\"\n\n\n\nClosure *luaF_newCclosure (lua_State *L, int nelems, Table *e) {\n  Closure *c = cast(Closure *, luaM_malloc(L, sizeCclosure(nelems)));\n  luaC_link(L, obj2gco(c), LUA_TFUNCTION);\n  c->c.isC = 1;\n  c->c.env = e;\n  c->c.nupvalues = cast_byte(nelems);\n  return c;\n}\n\n\nClosure *luaF_newLclosure (lua_State *L, int nelems, Table *e) {\n  Closure *c = cast(Closure *, luaM_malloc(L, sizeLclosure(nelems)));\n  luaC_link(L, obj2gco(c), LUA_TFUNCTION);\n  c->l.isC = 0;\n  c->l.env = e;\n  c->l.nupvalues = cast_byte(nelems);\n  while (nelems--) c->l.upvals[nelems] = NULL;\n  return c;\n}\n\n\nUpVal *luaF_newupval (lua_State *L) {\n  UpVal *uv = luaM_new(L, UpVal);\n  luaC_link(L, obj2gco(uv), LUA_TUPVAL);\n  uv->v = &uv->u.value;\n  setnilvalue(uv->v);\n  return uv;\n}\n\n\nUpVal *luaF_findupval (lua_State *L, StkId level) {\n  global_State *g = G(L);\n  GCObject **pp = &L->openupval;\n  UpVal *p;\n  UpVal *uv;\n  while (*pp != NULL && (p = ngcotouv(*pp))->v >= level) {\n    lua_assert(p->v != &p->u.value);\n    if (p->v == level) {  /* found a corresponding upvalue? */\n      if (isdead(g, obj2gco(p)))  /* is it dead? */\n        changewhite(obj2gco(p));  /* ressurect it */\n      return p;\n    }\n    pp = &p->next;\n  }\n  uv = luaM_new(L, UpVal);  /* not found: create a new one */\n  uv->tt = LUA_TUPVAL;\n  uv->marked = luaC_white(g);\n  uv->v = level;  /* current value lives in the stack */\n  uv->next = *pp;  /* chain it in the proper position */\n  *pp = obj2gco(uv);\n  uv->u.l.prev = &g->uvhead;  /* double link it in `uvhead' list */\n  uv->u.l.next = g->uvhead.u.l.next;\n  uv->u.l.next->u.l.prev = uv;\n  g->uvhead.u.l.next = uv;\n  lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);\n  return uv;\n}\n\n\nstatic void unlinkupval (UpVal *uv) {\n  lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);\n  uv->u.l.next->u.l.prev = uv->u.l.prev;  /* remove from `uvhead' list */\n  uv->u.l.prev->u.l.next = uv->u.l.next;\n}\n\n\nvoid luaF_freeupval (lua_State *L, UpVal *uv) {\n  if (uv->v != &uv->u.value)  /* is it open? */\n    unlinkupval(uv);  /* remove from open list */\n  luaM_free(L, uv);  /* free upvalue */\n}\n\n\nvoid luaF_close (lua_State *L, StkId level) {\n  UpVal *uv;\n  global_State *g = G(L);\n  while (L->openupval != NULL && (uv = ngcotouv(L->openupval))->v >= level) {\n    GCObject *o = obj2gco(uv);\n    lua_assert(!isblack(o) && uv->v != &uv->u.value);\n    L->openupval = uv->next;  /* remove from `open' list */\n    if (isdead(g, o))\n      luaF_freeupval(L, uv);  /* free upvalue */\n    else {\n      unlinkupval(uv);\n      setobj(L, &uv->u.value, uv->v);\n      uv->v = &uv->u.value;  /* now current value lives here */\n      luaC_linkupval(L, uv);  /* link upvalue into `gcroot' list */\n    }\n  }\n}\n\n\nProto *luaF_newproto (lua_State *L) {\n  Proto *f = luaM_new(L, Proto);\n  luaC_link(L, obj2gco(f), LUA_TPROTO);\n  f->k = NULL;\n  f->sizek = 0;\n  f->p = NULL;\n  f->sizep = 0;\n  f->code = NULL;\n  f->sizecode = 0;\n  f->sizelineinfo = 0;\n  f->sizeupvalues = 0;\n  f->nups = 0;\n  f->upvalues = NULL;\n  f->numparams = 0;\n  f->is_vararg = 0;\n  f->maxstacksize = 0;\n  f->lineinfo = NULL;\n  f->sizelocvars = 0;\n  f->locvars = NULL;\n  f->linedefined = 0;\n  f->lastlinedefined = 0;\n  f->source = NULL;\n  return f;\n}\n\n\nvoid luaF_freeproto (lua_State *L, Proto *f) {\n  luaM_freearray(L, f->code, f->sizecode, Instruction);\n  luaM_freearray(L, f->p, f->sizep, Proto *);\n  luaM_freearray(L, f->k, f->sizek, TValue);\n  luaM_freearray(L, f->lineinfo, f->sizelineinfo, int);\n  luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar);\n  luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *);\n  luaM_free(L, f);\n}\n\n\nvoid luaF_freeclosure (lua_State *L, Closure *c) {\n  int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) :\n                          sizeLclosure(c->l.nupvalues);\n  luaM_freemem(L, c, size);\n}\n\n\n/*\n** Look for n-th local variable at line `line' in function `func'.\n** Returns NULL if not found.\n*/\nconst char *luaF_getlocalname (const Proto *f, int local_number, int pc) {\n  int i;\n  for (i = 0; i<f->sizelocvars && f->locvars[i].startpc <= pc; i++) {\n    if (pc < f->locvars[i].endpc) {  /* is variable active? */\n      local_number--;\n      if (local_number == 0)\n        return getstr(f->locvars[i].varname);\n    }\n  }\n  return NULL;  /* not found */\n}\n\n"
  },
  {
    "path": "jni/lua/lfunc.h",
    "content": "/*\n** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $\n** Auxiliary functions to manipulate prototypes and closures\n** See Copyright Notice in lua.h\n*/\n\n#ifndef lfunc_h\n#define lfunc_h\n\n\n#include \"lobject.h\"\n\n\n#define sizeCclosure(n)\t(cast(int, sizeof(CClosure)) + \\\n                         cast(int, sizeof(TValue)*((n)-1)))\n\n#define sizeLclosure(n)\t(cast(int, sizeof(LClosure)) + \\\n                         cast(int, sizeof(TValue *)*((n)-1)))\n\n\nLUAI_FUNC Proto *luaF_newproto (lua_State *L);\nLUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e);\nLUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e);\nLUAI_FUNC UpVal *luaF_newupval (lua_State *L);\nLUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);\nLUAI_FUNC void luaF_close (lua_State *L, StkId level);\nLUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f);\nLUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c);\nLUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv);\nLUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number,\n                                         int pc);\n\n\n#endif\n"
  },
  {
    "path": "jni/lua/lgc.c",
    "content": "/*\n** $Id: lgc.c,v 2.38.1.2 2011/03/18 18:05:38 roberto Exp $\n** Garbage Collector\n** See Copyright Notice in lua.h\n*/\n\n#include <string.h>\n\n#define lgc_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"ldebug.h\"\n#include \"ldo.h\"\n#include \"lfunc.h\"\n#include \"lgc.h\"\n#include \"lmem.h\"\n#include \"lobject.h\"\n#include \"lstate.h\"\n#include \"lstring.h\"\n#include \"ltable.h\"\n#include \"ltm.h\"\n\n\n#define GCSTEPSIZE\t1024u\n#define GCSWEEPMAX\t40\n#define GCSWEEPCOST\t10\n#define GCFINALIZECOST\t100\n\n\n#define maskmarks\tcast_byte(~(bitmask(BLACKBIT)|WHITEBITS))\n\n#define makewhite(g,x)\t\\\n   ((x)->gch.marked = cast_byte(((x)->gch.marked & maskmarks) | luaC_white(g)))\n\n#define white2gray(x)\treset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT)\n#define black2gray(x)\tresetbit((x)->gch.marked, BLACKBIT)\n\n#define stringmark(s)\treset2bits((s)->tsv.marked, WHITE0BIT, WHITE1BIT)\n\n\n#define isfinalized(u)\t\ttestbit((u)->marked, FINALIZEDBIT)\n#define markfinalized(u)\tl_setbit((u)->marked, FINALIZEDBIT)\n\n\n#define KEYWEAK         bitmask(KEYWEAKBIT)\n#define VALUEWEAK       bitmask(VALUEWEAKBIT)\n\n\n\n#define markvalue(g,o) { checkconsistency(o); \\\n  if (iscollectable(o) && iswhite(gcvalue(o))) reallymarkobject(g,gcvalue(o)); }\n\n#define markobject(g,t) { if (iswhite(obj2gco(t))) \\\n\t\treallymarkobject(g, obj2gco(t)); }\n\n\n#define setthreshold(g)  (g->GCthreshold = (g->estimate/100) * g->gcpause)\n\n\nstatic void removeentry (Node *n) {\n  lua_assert(ttisnil(gval(n)));\n  if (iscollectable(gkey(n)))\n    setttype(gkey(n), LUA_TDEADKEY);  /* dead key; remove it */\n}\n\n\nstatic void reallymarkobject (global_State *g, GCObject *o) {\n  lua_assert(iswhite(o) && !isdead(g, o));\n  white2gray(o);\n  switch (o->gch.tt) {\n    case LUA_TSTRING: {\n      return;\n    }\n    case LUA_TUSERDATA: {\n      Table *mt = gco2u(o)->metatable;\n      gray2black(o);  /* udata are never gray */\n      if (mt) markobject(g, mt);\n      markobject(g, gco2u(o)->env);\n      return;\n    }\n    case LUA_TUPVAL: {\n      UpVal *uv = gco2uv(o);\n      markvalue(g, uv->v);\n      if (uv->v == &uv->u.value)  /* closed? */\n        gray2black(o);  /* open upvalues are never black */\n      return;\n    }\n    case LUA_TFUNCTION: {\n      gco2cl(o)->c.gclist = g->gray;\n      g->gray = o;\n      break;\n    }\n    case LUA_TTABLE: {\n      gco2h(o)->gclist = g->gray;\n      g->gray = o;\n      break;\n    }\n    case LUA_TTHREAD: {\n      gco2th(o)->gclist = g->gray;\n      g->gray = o;\n      break;\n    }\n    case LUA_TPROTO: {\n      gco2p(o)->gclist = g->gray;\n      g->gray = o;\n      break;\n    }\n    default: lua_assert(0);\n  }\n}\n\n\nstatic void marktmu (global_State *g) {\n  GCObject *u = g->tmudata;\n  if (u) {\n    do {\n      u = u->gch.next;\n      makewhite(g, u);  /* may be marked, if left from previous GC */\n      reallymarkobject(g, u);\n    } while (u != g->tmudata);\n  }\n}\n\n\n/* move `dead' udata that need finalization to list `tmudata' */\nsize_t luaC_separateudata (lua_State *L, int all) {\n  global_State *g = G(L);\n  size_t deadmem = 0;\n  GCObject **p = &g->mainthread->next;\n  GCObject *curr;\n  while ((curr = *p) != NULL) {\n    if (!(iswhite(curr) || all) || isfinalized(gco2u(curr)))\n      p = &curr->gch.next;  /* don't bother with them */\n    else if (fasttm(L, gco2u(curr)->metatable, TM_GC) == NULL) {\n      markfinalized(gco2u(curr));  /* don't need finalization */\n      p = &curr->gch.next;\n    }\n    else {  /* must call its gc method */\n      deadmem += sizeudata(gco2u(curr));\n      markfinalized(gco2u(curr));\n      *p = curr->gch.next;\n      /* link `curr' at the end of `tmudata' list */\n      if (g->tmudata == NULL)  /* list is empty? */\n        g->tmudata = curr->gch.next = curr;  /* creates a circular list */\n      else {\n        curr->gch.next = g->tmudata->gch.next;\n        g->tmudata->gch.next = curr;\n        g->tmudata = curr;\n      }\n    }\n  }\n  return deadmem;\n}\n\n\nstatic int traversetable (global_State *g, Table *h) {\n  int i;\n  int weakkey = 0;\n  int weakvalue = 0;\n  const TValue *mode;\n  if (h->metatable)\n    markobject(g, h->metatable);\n  mode = gfasttm(g, h->metatable, TM_MODE);\n  if (mode && ttisstring(mode)) {  /* is there a weak mode? */\n    weakkey = (strchr(svalue(mode), 'k') != NULL);\n    weakvalue = (strchr(svalue(mode), 'v') != NULL);\n    if (weakkey || weakvalue) {  /* is really weak? */\n      h->marked &= ~(KEYWEAK | VALUEWEAK);  /* clear bits */\n      h->marked |= cast_byte((weakkey << KEYWEAKBIT) |\n                             (weakvalue << VALUEWEAKBIT));\n      h->gclist = g->weak;  /* must be cleared after GC, ... */\n      g->weak = obj2gco(h);  /* ... so put in the appropriate list */\n    }\n  }\n  if (weakkey && weakvalue) return 1;\n  if (!weakvalue) {\n    i = h->sizearray;\n    while (i--)\n      markvalue(g, &h->array[i]);\n  }\n  i = sizenode(h);\n  while (i--) {\n    Node *n = gnode(h, i);\n    lua_assert(ttype(gkey(n)) != LUA_TDEADKEY || ttisnil(gval(n)));\n    if (ttisnil(gval(n)))\n      removeentry(n);  /* remove empty entries */\n    else {\n      lua_assert(!ttisnil(gkey(n)));\n      if (!weakkey) markvalue(g, gkey(n));\n      if (!weakvalue) markvalue(g, gval(n));\n    }\n  }\n  return weakkey || weakvalue;\n}\n\n\n/*\n** All marks are conditional because a GC may happen while the\n** prototype is still being created\n*/\nstatic void traverseproto (global_State *g, Proto *f) {\n  int i;\n  if (f->source) stringmark(f->source);\n  for (i=0; i<f->sizek; i++)  /* mark literals */\n    markvalue(g, &f->k[i]);\n  for (i=0; i<f->sizeupvalues; i++) {  /* mark upvalue names */\n    if (f->upvalues[i])\n      stringmark(f->upvalues[i]);\n  }\n  for (i=0; i<f->sizep; i++) {  /* mark nested protos */\n    if (f->p[i])\n      markobject(g, f->p[i]);\n  }\n  for (i=0; i<f->sizelocvars; i++) {  /* mark local-variable names */\n    if (f->locvars[i].varname)\n      stringmark(f->locvars[i].varname);\n  }\n}\n\n\n\nstatic void traverseclosure (global_State *g, Closure *cl) {\n  markobject(g, cl->c.env);\n  if (cl->c.isC) {\n    int i;\n    for (i=0; i<cl->c.nupvalues; i++)  /* mark its upvalues */\n      markvalue(g, &cl->c.upvalue[i]);\n  }\n  else {\n    int i;\n    lua_assert(cl->l.nupvalues == cl->l.p->nups);\n    markobject(g, cl->l.p);\n    for (i=0; i<cl->l.nupvalues; i++)  /* mark its upvalues */\n      markobject(g, cl->l.upvals[i]);\n  }\n}\n\n\nstatic void checkstacksizes (lua_State *L, StkId max) {\n  int ci_used = cast_int(L->ci - L->base_ci);  /* number of `ci' in use */\n  int s_used = cast_int(max - L->stack);  /* part of stack in use */\n  if (L->size_ci > LUAI_MAXCALLS)  /* handling overflow? */\n    return;  /* do not touch the stacks */\n  if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci)\n    luaD_reallocCI(L, L->size_ci/2);  /* still big enough... */\n  condhardstacktests(luaD_reallocCI(L, ci_used + 1));\n  if (4*s_used < L->stacksize &&\n      2*(BASIC_STACK_SIZE+EXTRA_STACK) < L->stacksize)\n    luaD_reallocstack(L, L->stacksize/2);  /* still big enough... */\n  condhardstacktests(luaD_reallocstack(L, s_used));\n}\n\n\nstatic void traversestack (global_State *g, lua_State *l) {\n  StkId o, lim;\n  CallInfo *ci;\n  markvalue(g, gt(l));\n  lim = l->top;\n  for (ci = l->base_ci; ci <= l->ci; ci++) {\n    lua_assert(ci->top <= l->stack_last);\n    if (lim < ci->top) lim = ci->top;\n  }\n  for (o = l->stack; o < l->top; o++)\n    markvalue(g, o);\n  for (; o <= lim; o++)\n    setnilvalue(o);\n  checkstacksizes(l, lim);\n}\n\n\n/*\n** traverse one gray object, turning it to black.\n** Returns `quantity' traversed.\n*/\nstatic l_mem propagatemark (global_State *g) {\n  GCObject *o = g->gray;\n  lua_assert(isgray(o));\n  gray2black(o);\n  switch (o->gch.tt) {\n    case LUA_TTABLE: {\n      Table *h = gco2h(o);\n      g->gray = h->gclist;\n      if (traversetable(g, h))  /* table is weak? */\n        black2gray(o);  /* keep it gray */\n      return sizeof(Table) + sizeof(TValue) * h->sizearray +\n                             sizeof(Node) * sizenode(h);\n    }\n    case LUA_TFUNCTION: {\n      Closure *cl = gco2cl(o);\n      g->gray = cl->c.gclist;\n      traverseclosure(g, cl);\n      return (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) :\n                           sizeLclosure(cl->l.nupvalues);\n    }\n    case LUA_TTHREAD: {\n      lua_State *th = gco2th(o);\n      g->gray = th->gclist;\n      th->gclist = g->grayagain;\n      g->grayagain = o;\n      black2gray(o);\n      traversestack(g, th);\n      return sizeof(lua_State) + sizeof(TValue) * th->stacksize +\n                                 sizeof(CallInfo) * th->size_ci;\n    }\n    case LUA_TPROTO: {\n      Proto *p = gco2p(o);\n      g->gray = p->gclist;\n      traverseproto(g, p);\n      return sizeof(Proto) + sizeof(Instruction) * p->sizecode +\n                             sizeof(Proto *) * p->sizep +\n                             sizeof(TValue) * p->sizek + \n                             sizeof(int) * p->sizelineinfo +\n                             sizeof(LocVar) * p->sizelocvars +\n                             sizeof(TString *) * p->sizeupvalues;\n    }\n    default: lua_assert(0); return 0;\n  }\n}\n\n\nstatic size_t propagateall (global_State *g) {\n  size_t m = 0;\n  while (g->gray) m += propagatemark(g);\n  return m;\n}\n\n\n/*\n** The next function tells whether a key or value can be cleared from\n** a weak table. Non-collectable objects are never removed from weak\n** tables. Strings behave as `values', so are never removed too. for\n** other objects: if really collected, cannot keep them; for userdata\n** being finalized, keep them in keys, but not in values\n*/\nstatic int iscleared (const TValue *o, int iskey) {\n  if (!iscollectable(o)) return 0;\n  if (ttisstring(o)) {\n    stringmark(rawtsvalue(o));  /* strings are `values', so are never weak */\n    return 0;\n  }\n  return iswhite(gcvalue(o)) ||\n    (ttisuserdata(o) && (!iskey && isfinalized(uvalue(o))));\n}\n\n\n/*\n** clear collected entries from weaktables\n*/\nstatic void cleartable (GCObject *l) {\n  while (l) {\n    Table *h = gco2h(l);\n    int i = h->sizearray;\n    lua_assert(testbit(h->marked, VALUEWEAKBIT) ||\n               testbit(h->marked, KEYWEAKBIT));\n    if (testbit(h->marked, VALUEWEAKBIT)) {\n      while (i--) {\n        TValue *o = &h->array[i];\n        if (iscleared(o, 0))  /* value was collected? */\n          setnilvalue(o);  /* remove value */\n      }\n    }\n    i = sizenode(h);\n    while (i--) {\n      Node *n = gnode(h, i);\n      if (!ttisnil(gval(n)) &&  /* non-empty entry? */\n          (iscleared(key2tval(n), 1) || iscleared(gval(n), 0))) {\n        setnilvalue(gval(n));  /* remove value ... */\n        removeentry(n);  /* remove entry from table */\n      }\n    }\n    l = h->gclist;\n  }\n}\n\n\nstatic void freeobj (lua_State *L, GCObject *o) {\n  switch (o->gch.tt) {\n    case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break;\n    case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break;\n    case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break;\n    case LUA_TTABLE: luaH_free(L, gco2h(o)); break;\n    case LUA_TTHREAD: {\n      lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread);\n      luaE_freethread(L, gco2th(o));\n      break;\n    }\n    case LUA_TSTRING: {\n      G(L)->strt.nuse--;\n      luaM_freemem(L, o, sizestring(gco2ts(o)));\n      break;\n    }\n    case LUA_TUSERDATA: {\n      luaM_freemem(L, o, sizeudata(gco2u(o)));\n      break;\n    }\n    default: lua_assert(0);\n  }\n}\n\n\n\n#define sweepwholelist(L,p)\tsweeplist(L,p,MAX_LUMEM)\n\n\nstatic GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) {\n  GCObject *curr;\n  global_State *g = G(L);\n  int deadmask = otherwhite(g);\n  while ((curr = *p) != NULL && count-- > 0) {\n    if (curr->gch.tt == LUA_TTHREAD)  /* sweep open upvalues of each thread */\n      sweepwholelist(L, &gco2th(curr)->openupval);\n    if ((curr->gch.marked ^ WHITEBITS) & deadmask) {  /* not dead? */\n      lua_assert(!isdead(g, curr) || testbit(curr->gch.marked, FIXEDBIT));\n      makewhite(g, curr);  /* make it white (for next cycle) */\n      p = &curr->gch.next;\n    }\n    else {  /* must erase `curr' */\n      lua_assert(isdead(g, curr) || deadmask == bitmask(SFIXEDBIT));\n      *p = curr->gch.next;\n      if (curr == g->rootgc)  /* is the first element of the list? */\n        g->rootgc = curr->gch.next;  /* adjust first */\n      freeobj(L, curr);\n    }\n  }\n  return p;\n}\n\n\nstatic void checkSizes (lua_State *L) {\n  global_State *g = G(L);\n  /* check size of string hash */\n  if (g->strt.nuse < cast(lu_int32, g->strt.size/4) &&\n      g->strt.size > MINSTRTABSIZE*2)\n    luaS_resize(L, g->strt.size/2);  /* table is too big */\n  /* check size of buffer */\n  if (luaZ_sizebuffer(&g->buff) > LUA_MINBUFFER*2) {  /* buffer too big? */\n    size_t newsize = luaZ_sizebuffer(&g->buff) / 2;\n    luaZ_resizebuffer(L, &g->buff, newsize);\n  }\n}\n\n\nstatic void GCTM (lua_State *L) {\n  global_State *g = G(L);\n  GCObject *o = g->tmudata->gch.next;  /* get first element */\n  Udata *udata = rawgco2u(o);\n  const TValue *tm;\n  /* remove udata from `tmudata' */\n  if (o == g->tmudata)  /* last element? */\n    g->tmudata = NULL;\n  else\n    g->tmudata->gch.next = udata->uv.next;\n  udata->uv.next = g->mainthread->next;  /* return it to `root' list */\n  g->mainthread->next = o;\n  makewhite(g, o);\n  tm = fasttm(L, udata->uv.metatable, TM_GC);\n  if (tm != NULL) {\n    lu_byte oldah = L->allowhook;\n    lu_mem oldt = g->GCthreshold;\n    L->allowhook = 0;  /* stop debug hooks during GC tag method */\n    g->GCthreshold = 2*g->totalbytes;  /* avoid GC steps */\n    setobj2s(L, L->top, tm);\n    setuvalue(L, L->top+1, udata);\n    L->top += 2;\n    luaD_call(L, L->top - 2, 0);\n    L->allowhook = oldah;  /* restore hooks */\n    g->GCthreshold = oldt;  /* restore threshold */\n  }\n}\n\n\n/*\n** Call all GC tag methods\n*/\nvoid luaC_callGCTM (lua_State *L) {\n  while (G(L)->tmudata)\n    GCTM(L);\n}\n\n\nvoid luaC_freeall (lua_State *L) {\n  global_State *g = G(L);\n  int i;\n  g->currentwhite = WHITEBITS | bitmask(SFIXEDBIT);  /* mask to collect all elements */\n  sweepwholelist(L, &g->rootgc);\n  for (i = 0; i < g->strt.size; i++)  /* free all string lists */\n    sweepwholelist(L, &g->strt.hash[i]);\n}\n\n\nstatic void markmt (global_State *g) {\n  int i;\n  for (i=0; i<NUM_TAGS; i++)\n    if (g->mt[i]) markobject(g, g->mt[i]);\n}\n\n\n/* mark root set */\nstatic void markroot (lua_State *L) {\n  global_State *g = G(L);\n  g->gray = NULL;\n  g->grayagain = NULL;\n  g->weak = NULL;\n  markobject(g, g->mainthread);\n  /* make global table be traversed before main stack */\n  markvalue(g, gt(g->mainthread));\n  markvalue(g, registry(L));\n  markmt(g);\n  g->gcstate = GCSpropagate;\n}\n\n\nstatic void remarkupvals (global_State *g) {\n  UpVal *uv;\n  for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) {\n    lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);\n    if (isgray(obj2gco(uv)))\n      markvalue(g, uv->v);\n  }\n}\n\n\nstatic void atomic (lua_State *L) {\n  global_State *g = G(L);\n  size_t udsize;  /* total size of userdata to be finalized */\n  /* remark occasional upvalues of (maybe) dead threads */\n  remarkupvals(g);\n  /* traverse objects cautch by write barrier and by 'remarkupvals' */\n  propagateall(g);\n  /* remark weak tables */\n  g->gray = g->weak;\n  g->weak = NULL;\n  lua_assert(!iswhite(obj2gco(g->mainthread)));\n  markobject(g, L);  /* mark running thread */\n  markmt(g);  /* mark basic metatables (again) */\n  propagateall(g);\n  /* remark gray again */\n  g->gray = g->grayagain;\n  g->grayagain = NULL;\n  propagateall(g);\n  udsize = luaC_separateudata(L, 0);  /* separate userdata to be finalized */\n  marktmu(g);  /* mark `preserved' userdata */\n  udsize += propagateall(g);  /* remark, to propagate `preserveness' */\n  cleartable(g->weak);  /* remove collected objects from weak tables */\n  /* flip current white */\n  g->currentwhite = cast_byte(otherwhite(g));\n  g->sweepstrgc = 0;\n  g->sweepgc = &g->rootgc;\n  g->gcstate = GCSsweepstring;\n  g->estimate = g->totalbytes - udsize;  /* first estimate */\n}\n\n\nstatic l_mem singlestep (lua_State *L) {\n  global_State *g = G(L);\n  /*lua_checkmemory(L);*/\n  switch (g->gcstate) {\n    case GCSpause: {\n      markroot(L);  /* start a new collection */\n      return 0;\n    }\n    case GCSpropagate: {\n      if (g->gray)\n        return propagatemark(g);\n      else {  /* no more `gray' objects */\n        atomic(L);  /* finish mark phase */\n        return 0;\n      }\n    }\n    case GCSsweepstring: {\n      lu_mem old = g->totalbytes;\n      sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]);\n      if (g->sweepstrgc >= g->strt.size)  /* nothing more to sweep? */\n        g->gcstate = GCSsweep;  /* end sweep-string phase */\n      lua_assert(old >= g->totalbytes);\n      g->estimate -= old - g->totalbytes;\n      return GCSWEEPCOST;\n    }\n    case GCSsweep: {\n      lu_mem old = g->totalbytes;\n      g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX);\n      if (*g->sweepgc == NULL) {  /* nothing more to sweep? */\n        checkSizes(L);\n        g->gcstate = GCSfinalize;  /* end sweep phase */\n      }\n      lua_assert(old >= g->totalbytes);\n      g->estimate -= old - g->totalbytes;\n      return GCSWEEPMAX*GCSWEEPCOST;\n    }\n    case GCSfinalize: {\n      if (g->tmudata) {\n        GCTM(L);\n        if (g->estimate > GCFINALIZECOST)\n          g->estimate -= GCFINALIZECOST;\n        return GCFINALIZECOST;\n      }\n      else {\n        g->gcstate = GCSpause;  /* end collection */\n        g->gcdept = 0;\n        return 0;\n      }\n    }\n    default: lua_assert(0); return 0;\n  }\n}\n\n\nvoid luaC_step (lua_State *L) {\n  global_State *g = G(L);\n  l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul;\n  if (lim == 0)\n    lim = (MAX_LUMEM-1)/2;  /* no limit */\n  g->gcdept += g->totalbytes - g->GCthreshold;\n  do {\n    lim -= singlestep(L);\n    if (g->gcstate == GCSpause)\n      break;\n  } while (lim > 0);\n  if (g->gcstate != GCSpause) {\n    if (g->gcdept < GCSTEPSIZE)\n      g->GCthreshold = g->totalbytes + GCSTEPSIZE;  /* - lim/g->gcstepmul;*/\n    else {\n      g->gcdept -= GCSTEPSIZE;\n      g->GCthreshold = g->totalbytes;\n    }\n  }\n  else {\n    setthreshold(g);\n  }\n}\n\n\nvoid luaC_fullgc (lua_State *L) {\n  global_State *g = G(L);\n  if (g->gcstate <= GCSpropagate) {\n    /* reset sweep marks to sweep all elements (returning them to white) */\n    g->sweepstrgc = 0;\n    g->sweepgc = &g->rootgc;\n    /* reset other collector lists */\n    g->gray = NULL;\n    g->grayagain = NULL;\n    g->weak = NULL;\n    g->gcstate = GCSsweepstring;\n  }\n  lua_assert(g->gcstate != GCSpause && g->gcstate != GCSpropagate);\n  /* finish any pending sweep phase */\n  while (g->gcstate != GCSfinalize) {\n    lua_assert(g->gcstate == GCSsweepstring || g->gcstate == GCSsweep);\n    singlestep(L);\n  }\n  markroot(L);\n  while (g->gcstate != GCSpause) {\n    singlestep(L);\n  }\n  setthreshold(g);\n}\n\n\nvoid luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) {\n  global_State *g = G(L);\n  lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o));\n  lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause);\n  lua_assert(ttype(&o->gch) != LUA_TTABLE);\n  /* must keep invariant? */\n  if (g->gcstate == GCSpropagate)\n    reallymarkobject(g, v);  /* restore invariant */\n  else  /* don't mind */\n    makewhite(g, o);  /* mark as white just to avoid other barriers */\n}\n\n\nvoid luaC_barrierback (lua_State *L, Table *t) {\n  global_State *g = G(L);\n  GCObject *o = obj2gco(t);\n  lua_assert(isblack(o) && !isdead(g, o));\n  lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause);\n  black2gray(o);  /* make table gray (again) */\n  t->gclist = g->grayagain;\n  g->grayagain = o;\n}\n\n\nvoid luaC_link (lua_State *L, GCObject *o, lu_byte tt) {\n  global_State *g = G(L);\n  o->gch.next = g->rootgc;\n  g->rootgc = o;\n  o->gch.marked = luaC_white(g);\n  o->gch.tt = tt;\n}\n\n\nvoid luaC_linkupval (lua_State *L, UpVal *uv) {\n  global_State *g = G(L);\n  GCObject *o = obj2gco(uv);\n  o->gch.next = g->rootgc;  /* link upvalue into `rootgc' list */\n  g->rootgc = o;\n  if (isgray(o)) { \n    if (g->gcstate == GCSpropagate) {\n      gray2black(o);  /* closed upvalues need barrier */\n      luaC_barrier(L, uv, uv->v);\n    }\n    else {  /* sweep phase: sweep it (turning it into white) */\n      makewhite(g, o);\n      lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause);\n    }\n  }\n}\n\n"
  },
  {
    "path": "jni/lua/lgc.h",
    "content": "/*\n** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $\n** Garbage Collector\n** See Copyright Notice in lua.h\n*/\n\n#ifndef lgc_h\n#define lgc_h\n\n\n#include \"lobject.h\"\n\n\n/*\n** Possible states of the Garbage Collector\n*/\n#define GCSpause\t0\n#define GCSpropagate\t1\n#define GCSsweepstring\t2\n#define GCSsweep\t3\n#define GCSfinalize\t4\n\n\n/*\n** some userful bit tricks\n*/\n#define resetbits(x,m)\t((x) &= cast(lu_byte, ~(m)))\n#define setbits(x,m)\t((x) |= (m))\n#define testbits(x,m)\t((x) & (m))\n#define bitmask(b)\t(1<<(b))\n#define bit2mask(b1,b2)\t(bitmask(b1) | bitmask(b2))\n#define l_setbit(x,b)\tsetbits(x, bitmask(b))\n#define resetbit(x,b)\tresetbits(x, bitmask(b))\n#define testbit(x,b)\ttestbits(x, bitmask(b))\n#define set2bits(x,b1,b2)\tsetbits(x, (bit2mask(b1, b2)))\n#define reset2bits(x,b1,b2)\tresetbits(x, (bit2mask(b1, b2)))\n#define test2bits(x,b1,b2)\ttestbits(x, (bit2mask(b1, b2)))\n\n\n\n/*\n** Layout for bit use in `marked' field:\n** bit 0 - object is white (type 0)\n** bit 1 - object is white (type 1)\n** bit 2 - object is black\n** bit 3 - for userdata: has been finalized\n** bit 3 - for tables: has weak keys\n** bit 4 - for tables: has weak values\n** bit 5 - object is fixed (should not be collected)\n** bit 6 - object is \"super\" fixed (only the main thread)\n*/\n\n\n#define WHITE0BIT\t0\n#define WHITE1BIT\t1\n#define BLACKBIT\t2\n#define FINALIZEDBIT\t3\n#define KEYWEAKBIT\t3\n#define VALUEWEAKBIT\t4\n#define FIXEDBIT\t5\n#define SFIXEDBIT\t6\n#define WHITEBITS\tbit2mask(WHITE0BIT, WHITE1BIT)\n\n\n#define iswhite(x)      test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT)\n#define isblack(x)      testbit((x)->gch.marked, BLACKBIT)\n#define isgray(x)\t(!isblack(x) && !iswhite(x))\n\n#define otherwhite(g)\t(g->currentwhite ^ WHITEBITS)\n#define isdead(g,v)\t((v)->gch.marked & otherwhite(g) & WHITEBITS)\n\n#define changewhite(x)\t((x)->gch.marked ^= WHITEBITS)\n#define gray2black(x)\tl_setbit((x)->gch.marked, BLACKBIT)\n\n#define valiswhite(x)\t(iscollectable(x) && iswhite(gcvalue(x)))\n\n#define luaC_white(g)\tcast(lu_byte, (g)->currentwhite & WHITEBITS)\n\n\n#define luaC_checkGC(L) { \\\n  condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \\\n  if (G(L)->totalbytes >= G(L)->GCthreshold) \\\n\tluaC_step(L); }\n\n\n#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p)))  \\\n\tluaC_barrierf(L,obj2gco(p),gcvalue(v)); }\n\n#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t)))  \\\n\tluaC_barrierback(L,t); }\n\n#define luaC_objbarrier(L,p,o)  \\\n\t{ if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \\\n\t\tluaC_barrierf(L,obj2gco(p),obj2gco(o)); }\n\n#define luaC_objbarriert(L,t,o)  \\\n   { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); }\n\nLUAI_FUNC size_t luaC_separateudata (lua_State *L, int all);\nLUAI_FUNC void luaC_callGCTM (lua_State *L);\nLUAI_FUNC void luaC_freeall (lua_State *L);\nLUAI_FUNC void luaC_step (lua_State *L);\nLUAI_FUNC void luaC_fullgc (lua_State *L);\nLUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt);\nLUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv);\nLUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v);\nLUAI_FUNC void luaC_barrierback (lua_State *L, Table *t);\n\n\n#endif\n"
  },
  {
    "path": "jni/lua/linit.c",
    "content": "/*\n** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $\n** Initialization of libraries for lua.c\n** See Copyright Notice in lua.h\n*/\n\n\n#define linit_c\n#define LUA_LIB\n\n#include \"lua.h\"\n\n#include \"lualib.h\"\n#include \"lauxlib.h\"\n\n\nstatic const luaL_Reg lualibs[] = {\n  {\"\", luaopen_base},\n  {LUA_LOADLIBNAME, luaopen_package},\n  {LUA_TABLIBNAME, luaopen_table},\n  {LUA_IOLIBNAME, luaopen_io},\n  {LUA_OSLIBNAME, luaopen_os},\n  {LUA_STRLIBNAME, luaopen_string},\n  {LUA_MATHLIBNAME, luaopen_math},\n  {LUA_DBLIBNAME, luaopen_debug},\n  {NULL, NULL}\n};\n\n\nLUALIB_API void luaL_openlibs (lua_State *L) {\n  const luaL_Reg *lib = lualibs;\n  for (; lib->func; lib++) {\n    lua_pushcfunction(L, lib->func);\n    lua_pushstring(L, lib->name);\n    lua_call(L, 1, 0);\n  }\n}\n\n"
  },
  {
    "path": "jni/lua/liolib.c",
    "content": "/*\n** $Id: liolib.c,v 2.73.1.4 2010/05/14 15:33:51 roberto Exp $\n** Standard I/O (and system) library\n** See Copyright Notice in lua.h\n*/\n\n\n#include <errno.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define liolib_c\n#define LUA_LIB\n\n#include \"lua.h\"\n\n#include \"lauxlib.h\"\n#include \"lualib.h\"\n\n\n\n#define IO_INPUT\t1\n#define IO_OUTPUT\t2\n\n\nstatic const char *const fnames[] = {\"input\", \"output\"};\n\n\nstatic int pushresult (lua_State *L, int i, const char *filename) {\n  int en = errno;  /* calls to Lua API may change this value */\n  if (i) {\n    lua_pushboolean(L, 1);\n    return 1;\n  }\n  else {\n    lua_pushnil(L);\n    if (filename)\n      lua_pushfstring(L, \"%s: %s\", filename, strerror(en));\n    else\n      lua_pushfstring(L, \"%s\", strerror(en));\n    lua_pushinteger(L, en);\n    return 3;\n  }\n}\n\n\nstatic void fileerror (lua_State *L, int arg, const char *filename) {\n  lua_pushfstring(L, \"%s: %s\", filename, strerror(errno));\n  luaL_argerror(L, arg, lua_tostring(L, -1));\n}\n\n\n#define tofilep(L)\t((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE))\n\n\nstatic int io_type (lua_State *L) {\n  void *ud;\n  luaL_checkany(L, 1);\n  ud = lua_touserdata(L, 1);\n  lua_getfield(L, LUA_REGISTRYINDEX, LUA_FILEHANDLE);\n  if (ud == NULL || !lua_getmetatable(L, 1) || !lua_rawequal(L, -2, -1))\n    lua_pushnil(L);  /* not a file */\n  else if (*((FILE **)ud) == NULL)\n    lua_pushliteral(L, \"closed file\");\n  else\n    lua_pushliteral(L, \"file\");\n  return 1;\n}\n\n\nstatic FILE *tofile (lua_State *L) {\n  FILE **f = tofilep(L);\n  if (*f == NULL)\n    luaL_error(L, \"attempt to use a closed file\");\n  return *f;\n}\n\n\n\n/*\n** When creating file handles, always creates a `closed' file handle\n** before opening the actual file; so, if there is a memory error, the\n** file is not left opened.\n*/\nstatic FILE **newfile (lua_State *L) {\n  FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *));\n  *pf = NULL;  /* file handle is currently `closed' */\n  luaL_getmetatable(L, LUA_FILEHANDLE);\n  lua_setmetatable(L, -2);\n  return pf;\n}\n\n\n/*\n** function to (not) close the standard files stdin, stdout, and stderr\n*/\nstatic int io_noclose (lua_State *L) {\n  lua_pushnil(L);\n  lua_pushliteral(L, \"cannot close standard file\");\n  return 2;\n}\n\n\n/*\n** function to close 'popen' files\n*/\nstatic int io_pclose (lua_State *L) {\n  FILE **p = tofilep(L);\n  int ok = lua_pclose(L, *p);\n  *p = NULL;\n  return pushresult(L, ok, NULL);\n}\n\n\n/*\n** function to close regular files\n*/\nstatic int io_fclose (lua_State *L) {\n  FILE **p = tofilep(L);\n  int ok = (fclose(*p) == 0);\n  *p = NULL;\n  return pushresult(L, ok, NULL);\n}\n\n\nstatic int aux_close (lua_State *L) {\n  lua_getfenv(L, 1);\n  lua_getfield(L, -1, \"__close\");\n  return (lua_tocfunction(L, -1))(L);\n}\n\n\nstatic int io_close (lua_State *L) {\n  if (lua_isnone(L, 1))\n    lua_rawgeti(L, LUA_ENVIRONINDEX, IO_OUTPUT);\n  tofile(L);  /* make sure argument is a file */\n  return aux_close(L);\n}\n\n\nstatic int io_gc (lua_State *L) {\n  FILE *f = *tofilep(L);\n  /* ignore closed files */\n  if (f != NULL)\n    aux_close(L);\n  return 0;\n}\n\n\nstatic int io_tostring (lua_State *L) {\n  FILE *f = *tofilep(L);\n  if (f == NULL)\n    lua_pushliteral(L, \"file (closed)\");\n  else\n    lua_pushfstring(L, \"file (%p)\", f);\n  return 1;\n}\n\n\nstatic int io_open (lua_State *L) {\n  const char *filename = luaL_checkstring(L, 1);\n  const char *mode = luaL_optstring(L, 2, \"r\");\n  FILE **pf = newfile(L);\n  *pf = fopen(filename, mode);\n  return (*pf == NULL) ? pushresult(L, 0, filename) : 1;\n}\n\n\n/*\n** this function has a separated environment, which defines the\n** correct __close for 'popen' files\n*/\nstatic int io_popen (lua_State *L) {\n  const char *filename = luaL_checkstring(L, 1);\n  const char *mode = luaL_optstring(L, 2, \"r\");\n  FILE **pf = newfile(L);\n  *pf = lua_popen(L, filename, mode);\n  return (*pf == NULL) ? pushresult(L, 0, filename) : 1;\n}\n\n\nstatic int io_tmpfile (lua_State *L) {\n  FILE **pf = newfile(L);\n  *pf = tmpfile();\n  return (*pf == NULL) ? pushresult(L, 0, NULL) : 1;\n}\n\n\nstatic FILE *getiofile (lua_State *L, int findex) {\n  FILE *f;\n  lua_rawgeti(L, LUA_ENVIRONINDEX, findex);\n  f = *(FILE **)lua_touserdata(L, -1);\n  if (f == NULL)\n    luaL_error(L, \"standard %s file is closed\", fnames[findex - 1]);\n  return f;\n}\n\n\nstatic int g_iofile (lua_State *L, int f, const char *mode) {\n  if (!lua_isnoneornil(L, 1)) {\n    const char *filename = lua_tostring(L, 1);\n    if (filename) {\n      FILE **pf = newfile(L);\n      *pf = fopen(filename, mode);\n      if (*pf == NULL)\n        fileerror(L, 1, filename);\n    }\n    else {\n      tofile(L);  /* check that it's a valid file handle */\n      lua_pushvalue(L, 1);\n    }\n    lua_rawseti(L, LUA_ENVIRONINDEX, f);\n  }\n  /* return current value */\n  lua_rawgeti(L, LUA_ENVIRONINDEX, f);\n  return 1;\n}\n\n\nstatic int io_input (lua_State *L) {\n  return g_iofile(L, IO_INPUT, \"r\");\n}\n\n\nstatic int io_output (lua_State *L) {\n  return g_iofile(L, IO_OUTPUT, \"w\");\n}\n\n\nstatic int io_readline (lua_State *L);\n\n\nstatic void aux_lines (lua_State *L, int idx, int toclose) {\n  lua_pushvalue(L, idx);\n  lua_pushboolean(L, toclose);  /* close/not close file when finished */\n  lua_pushcclosure(L, io_readline, 2);\n}\n\n\nstatic int f_lines (lua_State *L) {\n  tofile(L);  /* check that it's a valid file handle */\n  aux_lines(L, 1, 0);\n  return 1;\n}\n\n\nstatic int io_lines (lua_State *L) {\n  if (lua_isnoneornil(L, 1)) {  /* no arguments? */\n    /* will iterate over default input */\n    lua_rawgeti(L, LUA_ENVIRONINDEX, IO_INPUT);\n    return f_lines(L);\n  }\n  else {\n    const char *filename = luaL_checkstring(L, 1);\n    FILE **pf = newfile(L);\n    *pf = fopen(filename, \"r\");\n    if (*pf == NULL)\n      fileerror(L, 1, filename);\n    aux_lines(L, lua_gettop(L), 1);\n    return 1;\n  }\n}\n\n\n/*\n** {======================================================\n** READ\n** =======================================================\n*/\n\n\nstatic int read_number (lua_State *L, FILE *f) {\n  lua_Number d;\n  if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {\n    lua_pushnumber(L, d);\n    return 1;\n  }\n  else {\n    lua_pushnil(L);  /* \"result\" to be removed */\n    return 0;  /* read fails */\n  }\n}\n\n\nstatic int test_eof (lua_State *L, FILE *f) {\n  int c = getc(f);\n  ungetc(c, f);\n  lua_pushlstring(L, NULL, 0);\n  return (c != EOF);\n}\n\n\nstatic int read_line (lua_State *L, FILE *f) {\n  luaL_Buffer b;\n  luaL_buffinit(L, &b);\n  for (;;) {\n    size_t l;\n    char *p = luaL_prepbuffer(&b);\n    if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) {  /* eof? */\n      luaL_pushresult(&b);  /* close buffer */\n      return (lua_objlen(L, -1) > 0);  /* check whether read something */\n    }\n    l = strlen(p);\n    if (l == 0 || p[l-1] != '\\n')\n      luaL_addsize(&b, l);\n    else {\n      luaL_addsize(&b, l - 1);  /* do not include `eol' */\n      luaL_pushresult(&b);  /* close buffer */\n      return 1;  /* read at least an `eol' */\n    }\n  }\n}\n\n\nstatic int read_chars (lua_State *L, FILE *f, size_t n) {\n  size_t rlen;  /* how much to read */\n  size_t nr;  /* number of chars actually read */\n  luaL_Buffer b;\n  luaL_buffinit(L, &b);\n  rlen = LUAL_BUFFERSIZE;  /* try to read that much each time */\n  do {\n    char *p = luaL_prepbuffer(&b);\n    if (rlen > n) rlen = n;  /* cannot read more than asked */\n    nr = fread(p, sizeof(char), rlen, f);\n    luaL_addsize(&b, nr);\n    n -= nr;  /* still have to read `n' chars */\n  } while (n > 0 && nr == rlen);  /* until end of count or eof */\n  luaL_pushresult(&b);  /* close buffer */\n  return (n == 0 || lua_objlen(L, -1) > 0);\n}\n\n\nstatic int g_read (lua_State *L, FILE *f, int first) {\n  int nargs = lua_gettop(L) - 1;\n  int success;\n  int n;\n  clearerr(f);\n  if (nargs == 0) {  /* no arguments? */\n    success = read_line(L, f);\n    n = first+1;  /* to return 1 result */\n  }\n  else {  /* ensure stack space for all results and for auxlib's buffer */\n    luaL_checkstack(L, nargs+LUA_MINSTACK, \"too many arguments\");\n    success = 1;\n    for (n = first; nargs-- && success; n++) {\n      if (lua_type(L, n) == LUA_TNUMBER) {\n        size_t l = (size_t)lua_tointeger(L, n);\n        success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l);\n      }\n      else {\n        const char *p = lua_tostring(L, n);\n        luaL_argcheck(L, p && p[0] == '*', n, \"invalid option\");\n        switch (p[1]) {\n          case 'n':  /* number */\n            success = read_number(L, f);\n            break;\n          case 'l':  /* line */\n            success = read_line(L, f);\n            break;\n          case 'a':  /* file */\n            read_chars(L, f, ~((size_t)0));  /* read MAX_SIZE_T chars */\n            success = 1; /* always success */\n            break;\n          default:\n            return luaL_argerror(L, n, \"invalid format\");\n        }\n      }\n    }\n  }\n  if (ferror(f))\n    return pushresult(L, 0, NULL);\n  if (!success) {\n    lua_pop(L, 1);  /* remove last result */\n    lua_pushnil(L);  /* push nil instead */\n  }\n  return n - first;\n}\n\n\nstatic int io_read (lua_State *L) {\n  return g_read(L, getiofile(L, IO_INPUT), 1);\n}\n\n\nstatic int f_read (lua_State *L) {\n  return g_read(L, tofile(L), 2);\n}\n\n\nstatic int io_readline (lua_State *L) {\n  FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1));\n  int sucess;\n  if (f == NULL)  /* file is already closed? */\n    luaL_error(L, \"file is already closed\");\n  sucess = read_line(L, f);\n  if (ferror(f))\n    return luaL_error(L, \"%s\", strerror(errno));\n  if (sucess) return 1;\n  else {  /* EOF */\n    if (lua_toboolean(L, lua_upvalueindex(2))) {  /* generator created file? */\n      lua_settop(L, 0);\n      lua_pushvalue(L, lua_upvalueindex(1));\n      aux_close(L);  /* close it */\n    }\n    return 0;\n  }\n}\n\n/* }====================================================== */\n\n\nstatic int g_write (lua_State *L, FILE *f, int arg) {\n  int nargs = lua_gettop(L) - 1;\n  int status = 1;\n  for (; nargs--; arg++) {\n    if (lua_type(L, arg) == LUA_TNUMBER) {\n      /* optimization: could be done exactly as for strings */\n      status = status &&\n          fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0;\n    }\n    else {\n      size_t l;\n      const char *s = luaL_checklstring(L, arg, &l);\n      status = status && (fwrite(s, sizeof(char), l, f) == l);\n    }\n  }\n  return pushresult(L, status, NULL);\n}\n\n\nstatic int io_write (lua_State *L) {\n  return g_write(L, getiofile(L, IO_OUTPUT), 1);\n}\n\n\nstatic int f_write (lua_State *L) {\n  return g_write(L, tofile(L), 2);\n}\n\n\nstatic int f_seek (lua_State *L) {\n  static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END};\n  static const char *const modenames[] = {\"set\", \"cur\", \"end\", NULL};\n  FILE *f = tofile(L);\n  int op = luaL_checkoption(L, 2, \"cur\", modenames);\n  long offset = luaL_optlong(L, 3, 0);\n  op = fseek(f, offset, mode[op]);\n  if (op)\n    return pushresult(L, 0, NULL);  /* error */\n  else {\n    lua_pushinteger(L, ftell(f));\n    return 1;\n  }\n}\n\n\nstatic int f_setvbuf (lua_State *L) {\n  static const int mode[] = {_IONBF, _IOFBF, _IOLBF};\n  static const char *const modenames[] = {\"no\", \"full\", \"line\", NULL};\n  FILE *f = tofile(L);\n  int op = luaL_checkoption(L, 2, NULL, modenames);\n  lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE);\n  int res = setvbuf(f, NULL, mode[op], sz);\n  return pushresult(L, res == 0, NULL);\n}\n\n\n\nstatic int io_flush (lua_State *L) {\n  return pushresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL);\n}\n\n\nstatic int f_flush (lua_State *L) {\n  return pushresult(L, fflush(tofile(L)) == 0, NULL);\n}\n\n\nstatic const luaL_Reg iolib[] = {\n  {\"close\", io_close},\n  {\"flush\", io_flush},\n  {\"input\", io_input},\n  {\"lines\", io_lines},\n  {\"open\", io_open},\n  {\"output\", io_output},\n  {\"popen\", io_popen},\n  {\"read\", io_read},\n  {\"tmpfile\", io_tmpfile},\n  {\"type\", io_type},\n  {\"write\", io_write},\n  {NULL, NULL}\n};\n\n\nstatic const luaL_Reg flib[] = {\n  {\"close\", io_close},\n  {\"flush\", f_flush},\n  {\"lines\", f_lines},\n  {\"read\", f_read},\n  {\"seek\", f_seek},\n  {\"setvbuf\", f_setvbuf},\n  {\"write\", f_write},\n  {\"__gc\", io_gc},\n  {\"__tostring\", io_tostring},\n  {NULL, NULL}\n};\n\n\nstatic void createmeta (lua_State *L) {\n  luaL_newmetatable(L, LUA_FILEHANDLE);  /* create metatable for file handles */\n  lua_pushvalue(L, -1);  /* push metatable */\n  lua_setfield(L, -2, \"__index\");  /* metatable.__index = metatable */\n  luaL_register(L, NULL, flib);  /* file methods */\n}\n\n\nstatic void createstdfile (lua_State *L, FILE *f, int k, const char *fname) {\n  *newfile(L) = f;\n  if (k > 0) {\n    lua_pushvalue(L, -1);\n    lua_rawseti(L, LUA_ENVIRONINDEX, k);\n  }\n  lua_pushvalue(L, -2);  /* copy environment */\n  lua_setfenv(L, -2);  /* set it */\n  lua_setfield(L, -3, fname);\n}\n\n\nstatic void newfenv (lua_State *L, lua_CFunction cls) {\n  lua_createtable(L, 0, 1);\n  lua_pushcfunction(L, cls);\n  lua_setfield(L, -2, \"__close\");\n}\n\n\nLUALIB_API int luaopen_io (lua_State *L) {\n  createmeta(L);\n  /* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */\n  newfenv(L, io_fclose);\n  lua_replace(L, LUA_ENVIRONINDEX);\n  /* open library */\n  luaL_register(L, LUA_IOLIBNAME, iolib);\n  /* create (and set) default files */\n  newfenv(L, io_noclose);  /* close function for default files */\n  createstdfile(L, stdin, IO_INPUT, \"stdin\");\n  createstdfile(L, stdout, IO_OUTPUT, \"stdout\");\n  createstdfile(L, stderr, 0, \"stderr\");\n  lua_pop(L, 1);  /* pop environment for default files */\n  lua_getfield(L, -1, \"popen\");\n  newfenv(L, io_pclose);  /* create environment for 'popen' */\n  lua_setfenv(L, -2);  /* set fenv for 'popen' */\n  lua_pop(L, 1);  /* pop 'popen' */\n  return 1;\n}\n\n"
  },
  {
    "path": "jni/lua/llex.c",
    "content": "/*\n** $Id: llex.c,v 2.20.1.2 2009/11/23 14:58:22 roberto Exp $\n** Lexical Analyzer\n** See Copyright Notice in lua.h\n*/\n\n\n#include <ctype.h>\n#include <locale.h>\n#include <string.h>\n\n#define llex_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"ldo.h\"\n#include \"llex.h\"\n#include \"lobject.h\"\n#include \"lparser.h\"\n#include \"lstate.h\"\n#include \"lstring.h\"\n#include \"ltable.h\"\n#include \"lzio.h\"\n\n\n\n#define next(ls) (ls->current = zgetc(ls->z))\n\n\n\n\n#define currIsNewline(ls)\t(ls->current == '\\n' || ls->current == '\\r')\n\n\n/* ORDER RESERVED */\nconst char *const luaX_tokens [] = {\n    \"and\", \"break\", \"do\", \"else\", \"elseif\",\n    \"end\", \"false\", \"for\", \"function\", \"if\",\n    \"in\", \"local\", \"nil\", \"not\", \"or\", \"repeat\",\n    \"return\", \"then\", \"true\", \"until\", \"while\",\n    \"..\", \"...\", \"==\", \">=\", \"<=\", \"~=\",\n    \"<number>\", \"<name>\", \"<string>\", \"<eof>\",\n    NULL\n};\n\n\n#define save_and_next(ls) (save(ls, ls->current), next(ls))\n\n\nstatic void save (LexState *ls, int c) {\n  Mbuffer *b = ls->buff;\n  if (b->n + 1 > b->buffsize) {\n    size_t newsize;\n    if (b->buffsize >= MAX_SIZET/2)\n      luaX_lexerror(ls, \"lexical element too long\", 0);\n    newsize = b->buffsize * 2;\n    luaZ_resizebuffer(ls->L, b, newsize);\n  }\n  b->buffer[b->n++] = cast(char, c);\n}\n\n\nvoid luaX_init (lua_State *L) {\n  int i;\n  for (i=0; i<NUM_RESERVED; i++) {\n    TString *ts = luaS_new(L, luaX_tokens[i]);\n    luaS_fix(ts);  /* reserved words are never collected */\n    lua_assert(strlen(luaX_tokens[i])+1 <= TOKEN_LEN);\n    ts->tsv.reserved = cast_byte(i+1);  /* reserved word */\n  }\n}\n\n\n#define MAXSRC          80\n\n\nconst char *luaX_token2str (LexState *ls, int token) {\n  if (token < FIRST_RESERVED) {\n    lua_assert(token == cast(unsigned char, token));\n    return (iscntrl(token)) ? luaO_pushfstring(ls->L, \"char(%d)\", token) :\n                              luaO_pushfstring(ls->L, \"%c\", token);\n  }\n  else\n    return luaX_tokens[token-FIRST_RESERVED];\n}\n\n\nstatic const char *txtToken (LexState *ls, int token) {\n  switch (token) {\n    case TK_NAME:\n    case TK_STRING:\n    case TK_NUMBER:\n      save(ls, '\\0');\n      return luaZ_buffer(ls->buff);\n    default:\n      return luaX_token2str(ls, token);\n  }\n}\n\n\nvoid luaX_lexerror (LexState *ls, const char *msg, int token) {\n  char buff[MAXSRC];\n  luaO_chunkid(buff, getstr(ls->source), MAXSRC);\n  msg = luaO_pushfstring(ls->L, \"%s:%d: %s\", buff, ls->linenumber, msg);\n  if (token)\n    luaO_pushfstring(ls->L, \"%s near \" LUA_QS, msg, txtToken(ls, token));\n  luaD_throw(ls->L, LUA_ERRSYNTAX);\n}\n\n\nvoid luaX_syntaxerror (LexState *ls, const char *msg) {\n  luaX_lexerror(ls, msg, ls->t.token);\n}\n\n\nTString *luaX_newstring (LexState *ls, const char *str, size_t l) {\n  lua_State *L = ls->L;\n  TString *ts = luaS_newlstr(L, str, l);\n  TValue *o = luaH_setstr(L, ls->fs->h, ts);  /* entry for `str' */\n  if (ttisnil(o)) {\n    setbvalue(o, 1);  /* make sure `str' will not be collected */\n    luaC_checkGC(L);\n  }\n  return ts;\n}\n\n\nstatic void inclinenumber (LexState *ls) {\n  int old = ls->current;\n  lua_assert(currIsNewline(ls));\n  next(ls);  /* skip `\\n' or `\\r' */\n  if (currIsNewline(ls) && ls->current != old)\n    next(ls);  /* skip `\\n\\r' or `\\r\\n' */\n  if (++ls->linenumber >= MAX_INT)\n    luaX_syntaxerror(ls, \"chunk has too many lines\");\n}\n\n\nvoid luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source) {\n  ls->decpoint = '.';\n  ls->L = L;\n  ls->lookahead.token = TK_EOS;  /* no look-ahead token */\n  ls->z = z;\n  ls->fs = NULL;\n  ls->linenumber = 1;\n  ls->lastline = 1;\n  ls->source = source;\n  luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER);  /* initialize buffer */\n  next(ls);  /* read first char */\n}\n\n\n\n/*\n** =======================================================\n** LEXICAL ANALYZER\n** =======================================================\n*/\n\n\n\nstatic int check_next (LexState *ls, const char *set) {\n  if (!strchr(set, ls->current))\n    return 0;\n  save_and_next(ls);\n  return 1;\n}\n\n\nstatic void buffreplace (LexState *ls, char from, char to) {\n  size_t n = luaZ_bufflen(ls->buff);\n  char *p = luaZ_buffer(ls->buff);\n  while (n--)\n    if (p[n] == from) p[n] = to;\n}\n\n\nstatic void trydecpoint (LexState *ls, SemInfo *seminfo) {\n  luaX_lexerror(ls, \"malformed number\", TK_NUMBER);\n}\n\n\n/* LUA_NUMBER */\nstatic void read_numeral (LexState *ls, SemInfo *seminfo) {\n  lua_assert(isdigit(ls->current));\n  do {\n    save_and_next(ls);\n  } while (isdigit(ls->current) || ls->current == '.');\n  if (check_next(ls, \"Ee\"))  /* `E'? */\n    check_next(ls, \"+-\");  /* optional exponent sign */\n  while (isalnum(ls->current) || ls->current == '_')\n    save_and_next(ls);\n  save(ls, '\\0');\n  buffreplace(ls, '.', ls->decpoint);  /* follow locale for decimal point */\n  if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r))  /* format error? */\n    trydecpoint(ls, seminfo); /* try to update decimal point separator */\n}\n\n\nstatic int skip_sep (LexState *ls) {\n  int count = 0;\n  int s = ls->current;\n  lua_assert(s == '[' || s == ']');\n  save_and_next(ls);\n  while (ls->current == '=') {\n    save_and_next(ls);\n    count++;\n  }\n  return (ls->current == s) ? count : (-count) - 1;\n}\n\n\nstatic void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {\n  int cont = 0;\n  (void)(cont);  /* avoid warnings when `cont' is not used */\n  save_and_next(ls);  /* skip 2nd `[' */\n  if (currIsNewline(ls))  /* string starts with a newline? */\n    inclinenumber(ls);  /* skip it */\n  for (;;) {\n    switch (ls->current) {\n      case EOZ:\n        luaX_lexerror(ls, (seminfo) ? \"unfinished long string\" :\n                                   \"unfinished long comment\", TK_EOS);\n        break;  /* to avoid warnings */\n#if defined(LUA_COMPAT_LSTR)\n      case '[': {\n        if (skip_sep(ls) == sep) {\n          save_and_next(ls);  /* skip 2nd `[' */\n          cont++;\n#if LUA_COMPAT_LSTR == 1\n          if (sep == 0)\n            luaX_lexerror(ls, \"nesting of [[...]] is deprecated\", '[');\n#endif\n        }\n        break;\n      }\n#endif\n      case ']': {\n        if (skip_sep(ls) == sep) {\n          save_and_next(ls);  /* skip 2nd `]' */\n#if defined(LUA_COMPAT_LSTR) && LUA_COMPAT_LSTR == 2\n          cont--;\n          if (sep == 0 && cont >= 0) break;\n#endif\n          goto endloop;\n        }\n        break;\n      }\n      case '\\n':\n      case '\\r': {\n        save(ls, '\\n');\n        inclinenumber(ls);\n        if (!seminfo) luaZ_resetbuffer(ls->buff);  /* avoid wasting space */\n        break;\n      }\n      default: {\n        if (seminfo) save_and_next(ls);\n        else next(ls);\n      }\n    }\n  } endloop:\n  if (seminfo)\n    seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep),\n                                     luaZ_bufflen(ls->buff) - 2*(2 + sep));\n}\n\n\nstatic void read_string (LexState *ls, int del, SemInfo *seminfo) {\n  save_and_next(ls);\n  while (ls->current != del) {\n    switch (ls->current) {\n      case EOZ:\n        luaX_lexerror(ls, \"unfinished string\", TK_EOS);\n        continue;  /* to avoid warnings */\n      case '\\n':\n      case '\\r':\n        luaX_lexerror(ls, \"unfinished string\", TK_STRING);\n        continue;  /* to avoid warnings */\n      case '\\\\': {\n        int c;\n        next(ls);  /* do not save the `\\' */\n        switch (ls->current) {\n          case 'a': c = '\\a'; break;\n          case 'b': c = '\\b'; break;\n          case 'f': c = '\\f'; break;\n          case 'n': c = '\\n'; break;\n          case 'r': c = '\\r'; break;\n          case 't': c = '\\t'; break;\n          case 'v': c = '\\v'; break;\n          case '\\n':  /* go through */\n          case '\\r': save(ls, '\\n'); inclinenumber(ls); continue;\n          case EOZ: continue;  /* will raise an error next loop */\n          default: {\n            if (!isdigit(ls->current))\n              save_and_next(ls);  /* handles \\\\, \\\", \\', and \\? */\n            else {  /* \\xxx */\n              int i = 0;\n              c = 0;\n              do {\n                c = 10*c + (ls->current-'0');\n                next(ls);\n              } while (++i<3 && isdigit(ls->current));\n              if (c > UCHAR_MAX)\n                luaX_lexerror(ls, \"escape sequence too large\", TK_STRING);\n              save(ls, c);\n            }\n            continue;\n          }\n        }\n        save(ls, c);\n        next(ls);\n        continue;\n      }\n      default:\n        save_and_next(ls);\n    }\n  }\n  save_and_next(ls);  /* skip delimiter */\n  seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1,\n                                   luaZ_bufflen(ls->buff) - 2);\n}\n\n\nstatic int llex (LexState *ls, SemInfo *seminfo) {\n  luaZ_resetbuffer(ls->buff);\n  for (;;) {\n    switch (ls->current) {\n      case '\\n':\n      case '\\r': {\n        inclinenumber(ls);\n        continue;\n      }\n      case '-': {\n        next(ls);\n        if (ls->current != '-') return '-';\n        /* else is a comment */\n        next(ls);\n        if (ls->current == '[') {\n          int sep = skip_sep(ls);\n          luaZ_resetbuffer(ls->buff);  /* `skip_sep' may dirty the buffer */\n          if (sep >= 0) {\n            read_long_string(ls, NULL, sep);  /* long comment */\n            luaZ_resetbuffer(ls->buff);\n            continue;\n          }\n        }\n        /* else short comment */\n        while (!currIsNewline(ls) && ls->current != EOZ)\n          next(ls);\n        continue;\n      }\n      case '[': {\n        int sep = skip_sep(ls);\n        if (sep >= 0) {\n          read_long_string(ls, seminfo, sep);\n          return TK_STRING;\n        }\n        else if (sep == -1) return '[';\n        else luaX_lexerror(ls, \"invalid long string delimiter\", TK_STRING);\n      }\n      case '=': {\n        next(ls);\n        if (ls->current != '=') return '=';\n        else { next(ls); return TK_EQ; }\n      }\n      case '<': {\n        next(ls);\n        if (ls->current != '=') return '<';\n        else { next(ls); return TK_LE; }\n      }\n      case '>': {\n        next(ls);\n        if (ls->current != '=') return '>';\n        else { next(ls); return TK_GE; }\n      }\n      case '~': {\n        next(ls);\n        if (ls->current != '=') return '~';\n        else { next(ls); return TK_NE; }\n      }\n      case '\"':\n      case '\\'': {\n        read_string(ls, ls->current, seminfo);\n        return TK_STRING;\n      }\n      case '.': {\n        save_and_next(ls);\n        if (check_next(ls, \".\")) {\n          if (check_next(ls, \".\"))\n            return TK_DOTS;   /* ... */\n          else return TK_CONCAT;   /* .. */\n        }\n        else if (!isdigit(ls->current)) return '.';\n        else {\n          read_numeral(ls, seminfo);\n          return TK_NUMBER;\n        }\n      }\n      case EOZ: {\n        return TK_EOS;\n      }\n      default: {\n        if (isspace(ls->current)) {\n          lua_assert(!currIsNewline(ls));\n          next(ls);\n          continue;\n        }\n        else if (isdigit(ls->current)) {\n          read_numeral(ls, seminfo);\n          return TK_NUMBER;\n        }\n        else if (isalpha(ls->current) || ls->current == '_') {\n          /* identifier or reserved word */\n          TString *ts;\n          do {\n            save_and_next(ls);\n          } while (isalnum(ls->current) || ls->current == '_');\n          ts = luaX_newstring(ls, luaZ_buffer(ls->buff),\n                                  luaZ_bufflen(ls->buff));\n          if (ts->tsv.reserved > 0)  /* reserved word? */\n            return ts->tsv.reserved - 1 + FIRST_RESERVED;\n          else {\n            seminfo->ts = ts;\n            return TK_NAME;\n          }\n        }\n        else {\n          int c = ls->current;\n          next(ls);\n          return c;  /* single-char tokens (+ - / ...) */\n        }\n      }\n    }\n  }\n}\n\n\nvoid luaX_next (LexState *ls) {\n  ls->lastline = ls->linenumber;\n  if (ls->lookahead.token != TK_EOS) {  /* is there a look-ahead token? */\n    ls->t = ls->lookahead;  /* use this one */\n    ls->lookahead.token = TK_EOS;  /* and discharge it */\n  }\n  else\n    ls->t.token = llex(ls, &ls->t.seminfo);  /* read next token */\n}\n\n\nvoid luaX_lookahead (LexState *ls) {\n  lua_assert(ls->lookahead.token == TK_EOS);\n  ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);\n}\n\n"
  },
  {
    "path": "jni/lua/llex.h",
    "content": "/*\n** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $\n** Lexical Analyzer\n** See Copyright Notice in lua.h\n*/\n\n#ifndef llex_h\n#define llex_h\n\n#include \"lobject.h\"\n#include \"lzio.h\"\n\n\n#define FIRST_RESERVED\t257\n\n/* maximum length of a reserved word */\n#define TOKEN_LEN\t(sizeof(\"function\")/sizeof(char))\n\n\n/*\n* WARNING: if you change the order of this enumeration,\n* grep \"ORDER RESERVED\"\n*/\nenum RESERVED {\n  /* terminal symbols denoted by reserved words */\n  TK_AND = FIRST_RESERVED, TK_BREAK,\n  TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,\n  TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,\n  TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,\n  /* other terminal symbols */\n  TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,\n  TK_NAME, TK_STRING, TK_EOS\n};\n\n/* number of reserved words */\n#define NUM_RESERVED\t(cast(int, TK_WHILE-FIRST_RESERVED+1))\n\n\n/* array with token `names' */\nLUAI_DATA const char *const luaX_tokens [];\n\n\ntypedef union {\n  lua_Number r;\n  TString *ts;\n} SemInfo;  /* semantics information */\n\n\ntypedef struct Token {\n  int token;\n  SemInfo seminfo;\n} Token;\n\n\ntypedef struct LexState {\n  int current;  /* current character (charint) */\n  int linenumber;  /* input line counter */\n  int lastline;  /* line of last token `consumed' */\n  Token t;  /* current token */\n  Token lookahead;  /* look ahead token */\n  struct FuncState *fs;  /* `FuncState' is private to the parser */\n  struct lua_State *L;\n  ZIO *z;  /* input stream */\n  Mbuffer *buff;  /* buffer for tokens */\n  TString *source;  /* current source name */\n  char decpoint;  /* locale decimal point */\n} LexState;\n\n\nLUAI_FUNC void luaX_init (lua_State *L);\nLUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z,\n                              TString *source);\nLUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l);\nLUAI_FUNC void luaX_next (LexState *ls);\nLUAI_FUNC void luaX_lookahead (LexState *ls);\nLUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token);\nLUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s);\nLUAI_FUNC const char *luaX_token2str (LexState *ls, int token);\n\n\n#endif\n"
  },
  {
    "path": "jni/lua/llimits.h",
    "content": "/*\n** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $\n** Limits, basic types, and some other `installation-dependent' definitions\n** See Copyright Notice in lua.h\n*/\n\n#ifndef llimits_h\n#define llimits_h\n\n\n#include <limits.h>\n#include <stddef.h>\n\n\n#include \"lua.h\"\n\n\ntypedef LUAI_UINT32 lu_int32;\n\ntypedef LUAI_UMEM lu_mem;\n\ntypedef LUAI_MEM l_mem;\n\n\n\n/* chars used as small naturals (so that `char' is reserved for characters) */\ntypedef unsigned char lu_byte;\n\n\n#define MAX_SIZET\t((size_t)(~(size_t)0)-2)\n\n#define MAX_LUMEM\t((lu_mem)(~(lu_mem)0)-2)\n\n\n#define MAX_INT (INT_MAX-2)  /* maximum value of an int (-2 for safety) */\n\n/*\n** conversion of pointer to integer\n** this is for hashing only; there is no problem if the integer\n** cannot hold the whole pointer value\n*/\n#define IntPoint(p)  ((unsigned int)(lu_mem)(p))\n\n\n\n/* type to ensure maximum alignment */\ntypedef LUAI_USER_ALIGNMENT_T L_Umaxalign;\n\n\n/* result of a `usual argument conversion' over lua_Number */\ntypedef LUAI_UACNUMBER l_uacNumber;\n\n\n/* internal assertions for in-house debugging */\n#ifdef lua_assert\n\n#define check_exp(c,e)\t\t(lua_assert(c), (e))\n#define api_check(l,e)\t\tlua_assert(e)\n\n#else\n\n#define lua_assert(c)\t\t((void)0)\n#define check_exp(c,e)\t\t(e)\n#define api_check\t\tluai_apicheck\n\n#endif\n\n\n#ifndef UNUSED\n#define UNUSED(x)\t((void)(x))\t/* to avoid warnings */\n#endif\n\n\n#ifndef cast\n#define cast(t, exp)\t((t)(exp))\n#endif\n\n#define cast_byte(i)\tcast(lu_byte, (i))\n#define cast_num(i)\tcast(lua_Number, (i))\n#define cast_int(i)\tcast(int, (i))\n\n\n\n/*\n** type for virtual-machine instructions\n** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)\n*/\ntypedef lu_int32 Instruction;\n\n\n\n/* maximum stack for a Lua function */\n#define MAXSTACK\t250\n\n\n\n/* minimum size for the string table (must be power of 2) */\n#ifndef MINSTRTABSIZE\n#define MINSTRTABSIZE\t32\n#endif\n\n\n/* minimum size for string buffer */\n#ifndef LUA_MINBUFFER\n#define LUA_MINBUFFER\t32\n#endif\n\n\n#ifndef lua_lock\n#define lua_lock(L)     ((void) 0) \n#define lua_unlock(L)   ((void) 0)\n#endif\n\n#ifndef luai_threadyield\n#define luai_threadyield(L)     {lua_unlock(L); lua_lock(L);}\n#endif\n\n\n/*\n** macro to control inclusion of some hard tests on stack reallocation\n*/ \n#ifndef HARDSTACKTESTS\n#define condhardstacktests(x)\t((void)0)\n#else\n#define condhardstacktests(x)\tx\n#endif\n\n#endif\n"
  },
  {
    "path": "jni/lua/lmathlib.c",
    "content": "/*\n** $Id: lmathlib.c,v 1.67.1.1 2007/12/27 13:02:25 roberto Exp $\n** Standard mathematical library\n** See Copyright Notice in lua.h\n*/\n\n\n#include <stdlib.h>\n#include <math.h>\n\n#define lmathlib_c\n#define LUA_LIB\n\n#include \"lua.h\"\n\n#include \"lauxlib.h\"\n#include \"lualib.h\"\n\n\n#undef PI\n#define PI (3.14159265358979323846)\n#define RADIANS_PER_DEGREE (PI/180.0)\n\n\n\nstatic int math_abs (lua_State *L) {\n  lua_pushnumber(L, fabs(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_sin (lua_State *L) {\n  lua_pushnumber(L, sin(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_sinh (lua_State *L) {\n  lua_pushnumber(L, sinh(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_cos (lua_State *L) {\n  lua_pushnumber(L, cos(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_cosh (lua_State *L) {\n  lua_pushnumber(L, cosh(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_tan (lua_State *L) {\n  lua_pushnumber(L, tan(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_tanh (lua_State *L) {\n  lua_pushnumber(L, tanh(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_asin (lua_State *L) {\n  lua_pushnumber(L, asin(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_acos (lua_State *L) {\n  lua_pushnumber(L, acos(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_atan (lua_State *L) {\n  lua_pushnumber(L, atan(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_atan2 (lua_State *L) {\n  lua_pushnumber(L, atan2(luaL_checknumber(L, 1), luaL_checknumber(L, 2)));\n  return 1;\n}\n\nstatic int math_ceil (lua_State *L) {\n  lua_pushnumber(L, ceil(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_floor (lua_State *L) {\n  lua_pushnumber(L, floor(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_fmod (lua_State *L) {\n  lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2)));\n  return 1;\n}\n\nstatic int math_modf (lua_State *L) {\n  double ip;\n  double fp = modf(luaL_checknumber(L, 1), &ip);\n  lua_pushnumber(L, ip);\n  lua_pushnumber(L, fp);\n  return 2;\n}\n\nstatic int math_sqrt (lua_State *L) {\n  lua_pushnumber(L, sqrt(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_pow (lua_State *L) {\n  lua_pushnumber(L, pow(luaL_checknumber(L, 1), luaL_checknumber(L, 2)));\n  return 1;\n}\n\nstatic int math_log (lua_State *L) {\n  lua_pushnumber(L, log(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_log10 (lua_State *L) {\n  lua_pushnumber(L, log10(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_exp (lua_State *L) {\n  lua_pushnumber(L, exp(luaL_checknumber(L, 1)));\n  return 1;\n}\n\nstatic int math_deg (lua_State *L) {\n  lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE);\n  return 1;\n}\n\nstatic int math_rad (lua_State *L) {\n  lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE);\n  return 1;\n}\n\nstatic int math_frexp (lua_State *L) {\n  int e;\n  lua_pushnumber(L, frexp(luaL_checknumber(L, 1), &e));\n  lua_pushinteger(L, e);\n  return 2;\n}\n\nstatic int math_ldexp (lua_State *L) {\n  lua_pushnumber(L, ldexp(luaL_checknumber(L, 1), luaL_checkint(L, 2)));\n  return 1;\n}\n\n\n\nstatic int math_min (lua_State *L) {\n  int n = lua_gettop(L);  /* number of arguments */\n  lua_Number dmin = luaL_checknumber(L, 1);\n  int i;\n  for (i=2; i<=n; i++) {\n    lua_Number d = luaL_checknumber(L, i);\n    if (d < dmin)\n      dmin = d;\n  }\n  lua_pushnumber(L, dmin);\n  return 1;\n}\n\n\nstatic int math_max (lua_State *L) {\n  int n = lua_gettop(L);  /* number of arguments */\n  lua_Number dmax = luaL_checknumber(L, 1);\n  int i;\n  for (i=2; i<=n; i++) {\n    lua_Number d = luaL_checknumber(L, i);\n    if (d > dmax)\n      dmax = d;\n  }\n  lua_pushnumber(L, dmax);\n  return 1;\n}\n\n\nstatic int math_random (lua_State *L) {\n  /* the `%' avoids the (rare) case of r==1, and is needed also because on\n     some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */\n  lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX;\n  switch (lua_gettop(L)) {  /* check number of arguments */\n    case 0: {  /* no arguments */\n      lua_pushnumber(L, r);  /* Number between 0 and 1 */\n      break;\n    }\n    case 1: {  /* only upper limit */\n      int u = luaL_checkint(L, 1);\n      luaL_argcheck(L, 1<=u, 1, \"interval is empty\");\n      lua_pushnumber(L, floor(r*u)+1);  /* int between 1 and `u' */\n      break;\n    }\n    case 2: {  /* lower and upper limits */\n      int l = luaL_checkint(L, 1);\n      int u = luaL_checkint(L, 2);\n      luaL_argcheck(L, l<=u, 2, \"interval is empty\");\n      lua_pushnumber(L, floor(r*(u-l+1))+l);  /* int between `l' and `u' */\n      break;\n    }\n    default: return luaL_error(L, \"wrong number of arguments\");\n  }\n  return 1;\n}\n\n\nstatic int math_randomseed (lua_State *L) {\n  srand(luaL_checkint(L, 1));\n  return 0;\n}\n\n\nstatic const luaL_Reg mathlib[] = {\n  {\"abs\",   math_abs},\n  {\"acos\",  math_acos},\n  {\"asin\",  math_asin},\n  {\"atan2\", math_atan2},\n  {\"atan\",  math_atan},\n  {\"ceil\",  math_ceil},\n  {\"cosh\",   math_cosh},\n  {\"cos\",   math_cos},\n  {\"deg\",   math_deg},\n  {\"exp\",   math_exp},\n  {\"floor\", math_floor},\n  {\"fmod\",   math_fmod},\n  {\"frexp\", math_frexp},\n  {\"ldexp\", math_ldexp},\n  {\"log10\", math_log10},\n  {\"log\",   math_log},\n  {\"max\",   math_max},\n  {\"min\",   math_min},\n  {\"modf\",   math_modf},\n  {\"pow\",   math_pow},\n  {\"rad\",   math_rad},\n  {\"random\",     math_random},\n  {\"randomseed\", math_randomseed},\n  {\"sinh\",   math_sinh},\n  {\"sin\",   math_sin},\n  {\"sqrt\",  math_sqrt},\n  {\"tanh\",   math_tanh},\n  {\"tan\",   math_tan},\n  {NULL, NULL}\n};\n\n\n/*\n** Open math library\n*/\nLUALIB_API int luaopen_math (lua_State *L) {\n  luaL_register(L, LUA_MATHLIBNAME, mathlib);\n  lua_pushnumber(L, PI);\n  lua_setfield(L, -2, \"pi\");\n  lua_pushnumber(L, HUGE_VAL);\n  lua_setfield(L, -2, \"huge\");\n#if defined(LUA_COMPAT_MOD)\n  lua_getfield(L, -1, \"fmod\");\n  lua_setfield(L, -2, \"mod\");\n#endif\n  return 1;\n}\n\n"
  },
  {
    "path": "jni/lua/lmem.c",
    "content": "/*\n** $Id: lmem.c,v 1.70.1.1 2007/12/27 13:02:25 roberto Exp $\n** Interface to Memory Manager\n** See Copyright Notice in lua.h\n*/\n\n\n#include <stddef.h>\n\n#define lmem_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"ldebug.h\"\n#include \"ldo.h\"\n#include \"lmem.h\"\n#include \"lobject.h\"\n#include \"lstate.h\"\n\n\n\n/*\n** About the realloc function:\n** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize);\n** (`osize' is the old size, `nsize' is the new size)\n**\n** Lua ensures that (ptr == NULL) iff (osize == 0).\n**\n** * frealloc(ud, NULL, 0, x) creates a new block of size `x'\n**\n** * frealloc(ud, p, x, 0) frees the block `p'\n** (in this specific case, frealloc must return NULL).\n** particularly, frealloc(ud, NULL, 0, 0) does nothing\n** (which is equivalent to free(NULL) in ANSI C)\n**\n** frealloc returns NULL if it cannot create or reallocate the area\n** (any reallocation to an equal or smaller size cannot fail!)\n*/\n\n\n\n#define MINSIZEARRAY\t4\n\n\nvoid *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems,\n                     int limit, const char *errormsg) {\n  void *newblock;\n  int newsize;\n  if (*size >= limit/2) {  /* cannot double it? */\n    if (*size >= limit)  /* cannot grow even a little? */\n      luaG_runerror(L, errormsg);\n    newsize = limit;  /* still have at least one free place */\n  }\n  else {\n    newsize = (*size)*2;\n    if (newsize < MINSIZEARRAY)\n      newsize = MINSIZEARRAY;  /* minimum size */\n  }\n  newblock = luaM_reallocv(L, block, *size, newsize, size_elems);\n  *size = newsize;  /* update only when everything else is OK */\n  return newblock;\n}\n\n\nvoid *luaM_toobig (lua_State *L) {\n  luaG_runerror(L, \"memory allocation error: block too big\");\n  return NULL;  /* to avoid warnings */\n}\n\n\n\n/*\n** generic allocation routine.\n*/\nvoid *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {\n  global_State *g = G(L);\n  lua_assert((osize == 0) == (block == NULL));\n  block = (*g->frealloc)(g->ud, block, osize, nsize);\n  if (block == NULL && nsize > 0)\n    luaD_throw(L, LUA_ERRMEM);\n  lua_assert((nsize == 0) == (block == NULL));\n  g->totalbytes = (g->totalbytes - osize) + nsize;\n  return block;\n}\n\n"
  },
  {
    "path": "jni/lua/lmem.h",
    "content": "/*\n** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $\n** Interface to Memory Manager\n** See Copyright Notice in lua.h\n*/\n\n#ifndef lmem_h\n#define lmem_h\n\n\n#include <stddef.h>\n\n#include \"llimits.h\"\n#include \"lua.h\"\n\n#define MEMERRMSG\t\"not enough memory\"\n\n\n#define luaM_reallocv(L,b,on,n,e) \\\n\t((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ?  /* +1 to avoid warnings */ \\\n\t\tluaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \\\n\t\tluaM_toobig(L))\n\n#define luaM_freemem(L, b, s)\tluaM_realloc_(L, (b), (s), 0)\n#define luaM_free(L, b)\t\tluaM_realloc_(L, (b), sizeof(*(b)), 0)\n#define luaM_freearray(L, b, n, t)   luaM_reallocv(L, (b), n, 0, sizeof(t))\n\n#define luaM_malloc(L,t)\tluaM_realloc_(L, NULL, 0, (t))\n#define luaM_new(L,t)\t\tcast(t *, luaM_malloc(L, sizeof(t)))\n#define luaM_newvector(L,n,t) \\\n\t\tcast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t)))\n\n#define luaM_growvector(L,v,nelems,size,t,limit,e) \\\n          if ((nelems)+1 > (size)) \\\n            ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e)))\n\n#define luaM_reallocvector(L, v,oldn,n,t) \\\n   ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))\n\n\nLUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,\n                                                          size_t size);\nLUAI_FUNC void *luaM_toobig (lua_State *L);\nLUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,\n                               size_t size_elem, int limit,\n                               const char *errormsg);\n\n#endif\n\n"
  },
  {
    "path": "jni/lua/loadlib.c",
    "content": "/*\n** $Id: loadlib.c,v 1.52.1.4 2009/09/09 13:17:16 roberto Exp $\n** Dynamic library loader for Lua\n** See Copyright Notice in lua.h\n**\n** This module contains an implementation of loadlib for Unix systems\n** that have dlfcn, an implementation for Darwin (Mac OS X), an\n** implementation for Windows, and a stub for other systems.\n*/\n\n\n#include <stdlib.h>\n#include <string.h>\n\n\n#define loadlib_c\n#define LUA_LIB\n\n#include \"lua.h\"\n\n#include \"lauxlib.h\"\n#include \"lualib.h\"\n\n\n/* prefix for open functions in C libraries */\n#define LUA_POF\t\t\"luaopen_\"\n\n/* separator for open functions in C libraries */\n#define LUA_OFSEP\t\"_\"\n\n\n#define LIBPREFIX\t\"LOADLIB: \"\n\n#define POF\t\tLUA_POF\n#define LIB_FAIL\t\"open\"\n\n\n/* error codes for ll_loadfunc */\n#define ERRLIB\t\t1\n#define ERRFUNC\t\t2\n\n#define setprogdir(L)\t\t((void)0)\n\n\nstatic void ll_unloadlib (void *lib);\nstatic void *ll_load (lua_State *L, const char *path);\nstatic lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym);\n\n\n\n#if defined(LUA_DL_DLOPEN)\n/*\n** {========================================================================\n** This is an implementation of loadlib based on the dlfcn interface.\n** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD,\n** NetBSD, AIX 4.2, HPUX 11, and  probably most other Unix flavors, at least\n** as an emulation layer on top of native functions.\n** =========================================================================\n*/\n\n#include <dlfcn.h>\n\nstatic void ll_unloadlib (void *lib) {\n  dlclose(lib);\n}\n\n\nstatic void *ll_load (lua_State *L, const char *path) {\n  void *lib = dlopen(path, RTLD_NOW);\n  if (lib == NULL) lua_pushstring(L, dlerror());\n  return lib;\n}\n\n\nstatic lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {\n  lua_CFunction f = (lua_CFunction)dlsym(lib, sym);\n  if (f == NULL) lua_pushstring(L, dlerror());\n  return f;\n}\n\n/* }====================================================== */\n\n\n\n#elif defined(LUA_DL_DLL)\n/*\n** {======================================================================\n** This is an implementation of loadlib for Windows using native functions.\n** =======================================================================\n*/\n\n#include <windows.h>\n\n\n#undef setprogdir\n\nstatic void setprogdir (lua_State *L) {\n  char buff[MAX_PATH + 1];\n  char *lb;\n  DWORD nsize = sizeof(buff)/sizeof(char);\n  DWORD n = GetModuleFileNameA(NULL, buff, nsize);\n  if (n == 0 || n == nsize || (lb = strrchr(buff, '\\\\')) == NULL)\n    luaL_error(L, \"unable to get ModuleFileName\");\n  else {\n    *lb = '\\0';\n    luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff);\n    lua_remove(L, -2);  /* remove original string */\n  }\n}\n\n\nstatic void pusherror (lua_State *L) {\n  int error = GetLastError();\n  char buffer[128];\n  if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,\n      NULL, error, 0, buffer, sizeof(buffer), NULL))\n    lua_pushstring(L, buffer);\n  else\n    lua_pushfstring(L, \"system error %d\\n\", error);\n}\n\nstatic void ll_unloadlib (void *lib) {\n  FreeLibrary((HINSTANCE)lib);\n}\n\n\nstatic void *ll_load (lua_State *L, const char *path) {\n  HINSTANCE lib = LoadLibraryA(path);\n  if (lib == NULL) pusherror(L);\n  return lib;\n}\n\n\nstatic lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {\n  lua_CFunction f = (lua_CFunction)GetProcAddress((HINSTANCE)lib, sym);\n  if (f == NULL) pusherror(L);\n  return f;\n}\n\n/* }====================================================== */\n\n\n\n#elif defined(LUA_DL_DYLD)\n/*\n** {======================================================================\n** Native Mac OS X / Darwin Implementation\n** =======================================================================\n*/\n\n#include <mach-o/dyld.h>\n\n\n/* Mac appends a `_' before C function names */\n#undef POF\n#define POF\t\"_\" LUA_POF\n\n\nstatic void pusherror (lua_State *L) {\n  const char *err_str;\n  const char *err_file;\n  NSLinkEditErrors err;\n  int err_num;\n  NSLinkEditError(&err, &err_num, &err_file, &err_str);\n  lua_pushstring(L, err_str);\n}\n\n\nstatic const char *errorfromcode (NSObjectFileImageReturnCode ret) {\n  switch (ret) {\n    case NSObjectFileImageInappropriateFile:\n      return \"file is not a bundle\";\n    case NSObjectFileImageArch:\n      return \"library is for wrong CPU type\";\n    case NSObjectFileImageFormat:\n      return \"bad format\";\n    case NSObjectFileImageAccess:\n      return \"cannot access file\";\n    case NSObjectFileImageFailure:\n    default:\n      return \"unable to load library\";\n  }\n}\n\n\nstatic void ll_unloadlib (void *lib) {\n  NSUnLinkModule((NSModule)lib, NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES);\n}\n\n\nstatic void *ll_load (lua_State *L, const char *path) {\n  NSObjectFileImage img;\n  NSObjectFileImageReturnCode ret;\n  /* this would be a rare case, but prevents crashing if it happens */\n  if(!_dyld_present()) {\n    lua_pushliteral(L, \"dyld not present\");\n    return NULL;\n  }\n  ret = NSCreateObjectFileImageFromFile(path, &img);\n  if (ret == NSObjectFileImageSuccess) {\n    NSModule mod = NSLinkModule(img, path, NSLINKMODULE_OPTION_PRIVATE |\n                       NSLINKMODULE_OPTION_RETURN_ON_ERROR);\n    NSDestroyObjectFileImage(img);\n    if (mod == NULL) pusherror(L);\n    return mod;\n  }\n  lua_pushstring(L, errorfromcode(ret));\n  return NULL;\n}\n\n\nstatic lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {\n  NSSymbol nss = NSLookupSymbolInModule((NSModule)lib, sym);\n  if (nss == NULL) {\n    lua_pushfstring(L, \"symbol \" LUA_QS \" not found\", sym);\n    return NULL;\n  }\n  return (lua_CFunction)NSAddressOfSymbol(nss);\n}\n\n/* }====================================================== */\n\n\n\n#else\n/*\n** {======================================================\n** Fallback for other systems\n** =======================================================\n*/\n\n#undef LIB_FAIL\n#define LIB_FAIL\t\"absent\"\n\n\n#define DLMSG\t\"dynamic libraries not enabled; check your Lua installation\"\n\n\nstatic void ll_unloadlib (void *lib) {\n  (void)lib;  /* to avoid warnings */\n}\n\n\nstatic void *ll_load (lua_State *L, const char *path) {\n  (void)path;  /* to avoid warnings */\n  lua_pushliteral(L, DLMSG);\n  return NULL;\n}\n\n\nstatic lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {\n  (void)lib; (void)sym;  /* to avoid warnings */\n  lua_pushliteral(L, DLMSG);\n  return NULL;\n}\n\n/* }====================================================== */\n#endif\n\n\n\nstatic void **ll_register (lua_State *L, const char *path) {\n  void **plib;\n  lua_pushfstring(L, \"%s%s\", LIBPREFIX, path);\n  lua_gettable(L, LUA_REGISTRYINDEX);  /* check library in registry? */\n  if (!lua_isnil(L, -1))  /* is there an entry? */\n    plib = (void **)lua_touserdata(L, -1);\n  else {  /* no entry yet; create one */\n    lua_pop(L, 1);\n    plib = (void **)lua_newuserdata(L, sizeof(const void *));\n    *plib = NULL;\n    luaL_getmetatable(L, \"_LOADLIB\");\n    lua_setmetatable(L, -2);\n    lua_pushfstring(L, \"%s%s\", LIBPREFIX, path);\n    lua_pushvalue(L, -2);\n    lua_settable(L, LUA_REGISTRYINDEX);\n  }\n  return plib;\n}\n\n\n/*\n** __gc tag method: calls library's `ll_unloadlib' function with the lib\n** handle\n*/\nstatic int gctm (lua_State *L) {\n  void **lib = (void **)luaL_checkudata(L, 1, \"_LOADLIB\");\n  if (*lib) ll_unloadlib(*lib);\n  *lib = NULL;  /* mark library as closed */\n  return 0;\n}\n\n\nstatic int ll_loadfunc (lua_State *L, const char *path, const char *sym) {\n  void **reg = ll_register(L, path);\n  if (*reg == NULL) *reg = ll_load(L, path);\n  if (*reg == NULL)\n    return ERRLIB;  /* unable to load library */\n  else {\n    lua_CFunction f = ll_sym(L, *reg, sym);\n    if (f == NULL)\n      return ERRFUNC;  /* unable to find function */\n    lua_pushcfunction(L, f);\n    return 0;  /* return function */\n  }\n}\n\n\nstatic int ll_loadlib (lua_State *L) {\n  const char *path = luaL_checkstring(L, 1);\n  const char *init = luaL_checkstring(L, 2);\n  int stat = ll_loadfunc(L, path, init);\n  if (stat == 0)  /* no errors? */\n    return 1;  /* return the loaded function */\n  else {  /* error; error message is on stack top */\n    lua_pushnil(L);\n    lua_insert(L, -2);\n    lua_pushstring(L, (stat == ERRLIB) ?  LIB_FAIL : \"init\");\n    return 3;  /* return nil, error message, and where */\n  }\n}\n\n\n\n/*\n** {======================================================\n** 'require' function\n** =======================================================\n*/\n\n\nstatic int readable (const char *filename) {\n  FILE *f = fopen(filename, \"r\");  /* try to open file */\n  if (f == NULL) return 0;  /* open failed */\n  fclose(f);\n  return 1;\n}\n\n\nstatic const char *pushnexttemplate (lua_State *L, const char *path) {\n  const char *l;\n  while (*path == *LUA_PATHSEP) path++;  /* skip separators */\n  if (*path == '\\0') return NULL;  /* no more templates */\n  l = strchr(path, *LUA_PATHSEP);  /* find next separator */\n  if (l == NULL) l = path + strlen(path);\n  lua_pushlstring(L, path, l - path);  /* template */\n  return l;\n}\n\n\nstatic const char *findfile (lua_State *L, const char *name,\n                                           const char *pname) {\n  const char *path;\n  name = luaL_gsub(L, name, \".\", LUA_DIRSEP);\n  lua_getfield(L, LUA_ENVIRONINDEX, pname);\n  path = lua_tostring(L, -1);\n  if (path == NULL)\n    luaL_error(L, LUA_QL(\"package.%s\") \" must be a string\", pname);\n  lua_pushliteral(L, \"\");  /* error accumulator */\n  while ((path = pushnexttemplate(L, path)) != NULL) {\n    const char *filename;\n    filename = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name);\n    lua_remove(L, -2);  /* remove path template */\n    if (readable(filename))  /* does file exist and is readable? */\n      return filename;  /* return that file name */\n    lua_pushfstring(L, \"\\n\\tno file \" LUA_QS, filename);\n    lua_remove(L, -2);  /* remove file name */\n    lua_concat(L, 2);  /* add entry to possible error message */\n  }\n  return NULL;  /* not found */\n}\n\n\nstatic void loaderror (lua_State *L, const char *filename) {\n  luaL_error(L, \"error loading module \" LUA_QS \" from file \" LUA_QS \":\\n\\t%s\",\n                lua_tostring(L, 1), filename, lua_tostring(L, -1));\n}\n\n\nstatic int loader_Lua (lua_State *L) {\n  const char *filename;\n  const char *name = luaL_checkstring(L, 1);\n  filename = findfile(L, name, \"path\");\n  if (filename == NULL) return 1;  /* library not found in this path */\n  if (luaL_loadfile(L, filename) != 0)\n    loaderror(L, filename);\n  return 1;  /* library loaded successfully */\n}\n\n\nstatic const char *mkfuncname (lua_State *L, const char *modname) {\n  const char *funcname;\n  const char *mark = strchr(modname, *LUA_IGMARK);\n  if (mark) modname = mark + 1;\n  funcname = luaL_gsub(L, modname, \".\", LUA_OFSEP);\n  funcname = lua_pushfstring(L, POF\"%s\", funcname);\n  lua_remove(L, -2);  /* remove 'gsub' result */\n  return funcname;\n}\n\n\nstatic int loader_C (lua_State *L) {\n  const char *funcname;\n  const char *name = luaL_checkstring(L, 1);\n  const char *filename = findfile(L, name, \"cpath\");\n  if (filename == NULL) return 1;  /* library not found in this path */\n  funcname = mkfuncname(L, name);\n  if (ll_loadfunc(L, filename, funcname) != 0)\n    loaderror(L, filename);\n  return 1;  /* library loaded successfully */\n}\n\n\nstatic int loader_Croot (lua_State *L) {\n  const char *funcname;\n  const char *filename;\n  const char *name = luaL_checkstring(L, 1);\n  const char *p = strchr(name, '.');\n  int stat;\n  if (p == NULL) return 0;  /* is root */\n  lua_pushlstring(L, name, p - name);\n  filename = findfile(L, lua_tostring(L, -1), \"cpath\");\n  if (filename == NULL) return 1;  /* root not found */\n  funcname = mkfuncname(L, name);\n  if ((stat = ll_loadfunc(L, filename, funcname)) != 0) {\n    if (stat != ERRFUNC) loaderror(L, filename);  /* real error */\n    lua_pushfstring(L, \"\\n\\tno module \" LUA_QS \" in file \" LUA_QS,\n                       name, filename);\n    return 1;  /* function not found */\n  }\n  return 1;\n}\n\n\nstatic int loader_preload (lua_State *L) {\n  const char *name = luaL_checkstring(L, 1);\n  lua_getfield(L, LUA_ENVIRONINDEX, \"preload\");\n  if (!lua_istable(L, -1))\n    luaL_error(L, LUA_QL(\"package.preload\") \" must be a table\");\n  lua_getfield(L, -1, name);\n  if (lua_isnil(L, -1))  /* not found? */\n    lua_pushfstring(L, \"\\n\\tno field package.preload['%s']\", name);\n  return 1;\n}\n\n\nstatic const int sentinel_ = 0;\n#define sentinel\t((void *)&sentinel_)\n\n\nstatic int ll_require (lua_State *L) {\n  const char *name = luaL_checkstring(L, 1);\n  int i;\n  lua_settop(L, 1);  /* _LOADED table will be at index 2 */\n  lua_getfield(L, LUA_REGISTRYINDEX, \"_LOADED\");\n  lua_getfield(L, 2, name);\n  if (lua_toboolean(L, -1)) {  /* is it there? */\n    if (lua_touserdata(L, -1) == sentinel)  /* check loops */\n      luaL_error(L, \"loop or previous error loading module \" LUA_QS, name);\n    return 1;  /* package is already loaded */\n  }\n  /* else must load it; iterate over available loaders */\n  lua_getfield(L, LUA_ENVIRONINDEX, \"loaders\");\n  if (!lua_istable(L, -1))\n    luaL_error(L, LUA_QL(\"package.loaders\") \" must be a table\");\n  lua_pushliteral(L, \"\");  /* error message accumulator */\n  for (i=1; ; i++) {\n    lua_rawgeti(L, -2, i);  /* get a loader */\n    if (lua_isnil(L, -1))\n      luaL_error(L, \"module \" LUA_QS \" not found:%s\",\n                    name, lua_tostring(L, -2));\n    lua_pushstring(L, name);\n    lua_call(L, 1, 1);  /* call it */\n    if (lua_isfunction(L, -1))  /* did it find module? */\n      break;  /* module loaded successfully */\n    else if (lua_isstring(L, -1))  /* loader returned error message? */\n      lua_concat(L, 2);  /* accumulate it */\n    else\n      lua_pop(L, 1);\n  }\n  lua_pushlightuserdata(L, sentinel);\n  lua_setfield(L, 2, name);  /* _LOADED[name] = sentinel */\n  lua_pushstring(L, name);  /* pass name as argument to module */\n  lua_call(L, 1, 1);  /* run loaded module */\n  if (!lua_isnil(L, -1))  /* non-nil return? */\n    lua_setfield(L, 2, name);  /* _LOADED[name] = returned value */\n  lua_getfield(L, 2, name);\n  if (lua_touserdata(L, -1) == sentinel) {   /* module did not set a value? */\n    lua_pushboolean(L, 1);  /* use true as result */\n    lua_pushvalue(L, -1);  /* extra copy to be returned */\n    lua_setfield(L, 2, name);  /* _LOADED[name] = true */\n  }\n  return 1;\n}\n\n/* }====================================================== */\n\n\n\n/*\n** {======================================================\n** 'module' function\n** =======================================================\n*/\n  \n\nstatic void setfenv (lua_State *L) {\n  lua_Debug ar;\n  if (lua_getstack(L, 1, &ar) == 0 ||\n      lua_getinfo(L, \"f\", &ar) == 0 ||  /* get calling function */\n      lua_iscfunction(L, -1))\n    luaL_error(L, LUA_QL(\"module\") \" not called from a Lua function\");\n  lua_pushvalue(L, -2);\n  lua_setfenv(L, -2);\n  lua_pop(L, 1);\n}\n\n\nstatic void dooptions (lua_State *L, int n) {\n  int i;\n  for (i = 2; i <= n; i++) {\n    lua_pushvalue(L, i);  /* get option (a function) */\n    lua_pushvalue(L, -2);  /* module */\n    lua_call(L, 1, 0);\n  }\n}\n\n\nstatic void modinit (lua_State *L, const char *modname) {\n  const char *dot;\n  lua_pushvalue(L, -1);\n  lua_setfield(L, -2, \"_M\");  /* module._M = module */\n  lua_pushstring(L, modname);\n  lua_setfield(L, -2, \"_NAME\");\n  dot = strrchr(modname, '.');  /* look for last dot in module name */\n  if (dot == NULL) dot = modname;\n  else dot++;\n  /* set _PACKAGE as package name (full module name minus last part) */\n  lua_pushlstring(L, modname, dot - modname);\n  lua_setfield(L, -2, \"_PACKAGE\");\n}\n\n\nstatic int ll_module (lua_State *L) {\n  const char *modname = luaL_checkstring(L, 1);\n  int loaded = lua_gettop(L) + 1;  /* index of _LOADED table */\n  lua_getfield(L, LUA_REGISTRYINDEX, \"_LOADED\");\n  lua_getfield(L, loaded, modname);  /* get _LOADED[modname] */\n  if (!lua_istable(L, -1)) {  /* not found? */\n    lua_pop(L, 1);  /* remove previous result */\n    /* try global variable (and create one if it does not exist) */\n    if (luaL_findtable(L, LUA_GLOBALSINDEX, modname, 1) != NULL)\n      return luaL_error(L, \"name conflict for module \" LUA_QS, modname);\n    lua_pushvalue(L, -1);\n    lua_setfield(L, loaded, modname);  /* _LOADED[modname] = new table */\n  }\n  /* check whether table already has a _NAME field */\n  lua_getfield(L, -1, \"_NAME\");\n  if (!lua_isnil(L, -1))  /* is table an initialized module? */\n    lua_pop(L, 1);\n  else {  /* no; initialize it */\n    lua_pop(L, 1);\n    modinit(L, modname);\n  }\n  lua_pushvalue(L, -1);\n  setfenv(L);\n  dooptions(L, loaded - 1);\n  return 0;\n}\n\n\nstatic int ll_seeall (lua_State *L) {\n  luaL_checktype(L, 1, LUA_TTABLE);\n  if (!lua_getmetatable(L, 1)) {\n    lua_createtable(L, 0, 1); /* create new metatable */\n    lua_pushvalue(L, -1);\n    lua_setmetatable(L, 1);\n  }\n  lua_pushvalue(L, LUA_GLOBALSINDEX);\n  lua_setfield(L, -2, \"__index\");  /* mt.__index = _G */\n  return 0;\n}\n\n\n/* }====================================================== */\n\n\n\n/* auxiliary mark (for internal use) */\n#define AUXMARK\t\t\"\\1\"\n\nstatic void setpath (lua_State *L, const char *fieldname, const char *envname,\n                                   const char *def) {\n  const char *path = getenv(envname);\n  if (path == NULL)  /* no environment variable? */\n    lua_pushstring(L, def);  /* use default */\n  else {\n    /* replace \";;\" by \";AUXMARK;\" and then AUXMARK by default path */\n    path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP,\n                              LUA_PATHSEP AUXMARK LUA_PATHSEP);\n    luaL_gsub(L, path, AUXMARK, def);\n    lua_remove(L, -2);\n  }\n  setprogdir(L);\n  lua_setfield(L, -2, fieldname);\n}\n\n\nstatic const luaL_Reg pk_funcs[] = {\n  {\"loadlib\", ll_loadlib},\n  {\"seeall\", ll_seeall},\n  {NULL, NULL}\n};\n\n\nstatic const luaL_Reg ll_funcs[] = {\n  {\"module\", ll_module},\n  {\"require\", ll_require},\n  {NULL, NULL}\n};\n\n\nstatic const lua_CFunction loaders[] =\n  {loader_preload, loader_Lua, loader_C, loader_Croot, NULL};\n\n\nLUALIB_API int luaopen_package (lua_State *L) {\n  int i;\n  /* create new type _LOADLIB */\n  luaL_newmetatable(L, \"_LOADLIB\");\n  lua_pushcfunction(L, gctm);\n  lua_setfield(L, -2, \"__gc\");\n  /* create `package' table */\n  luaL_register(L, LUA_LOADLIBNAME, pk_funcs);\n#if defined(LUA_COMPAT_LOADLIB) \n  lua_getfield(L, -1, \"loadlib\");\n  lua_setfield(L, LUA_GLOBALSINDEX, \"loadlib\");\n#endif\n  lua_pushvalue(L, -1);\n  lua_replace(L, LUA_ENVIRONINDEX);\n  /* create `loaders' table */\n  lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0);\n  /* fill it with pre-defined loaders */\n  for (i=0; loaders[i] != NULL; i++) {\n    lua_pushcfunction(L, loaders[i]);\n    lua_rawseti(L, -2, i+1);\n  }\n  lua_setfield(L, -2, \"loaders\");  /* put it in field `loaders' */\n  setpath(L, \"path\", LUA_PATH, LUA_PATH_DEFAULT);  /* set field `path' */\n  setpath(L, \"cpath\", LUA_CPATH, LUA_CPATH_DEFAULT); /* set field `cpath' */\n  /* store config information */\n  lua_pushliteral(L, LUA_DIRSEP \"\\n\" LUA_PATHSEP \"\\n\" LUA_PATH_MARK \"\\n\"\n                     LUA_EXECDIR \"\\n\" LUA_IGMARK);\n  lua_setfield(L, -2, \"config\");\n  /* set field `loaded' */\n  luaL_findtable(L, LUA_REGISTRYINDEX, \"_LOADED\", 2);\n  lua_setfield(L, -2, \"loaded\");\n  /* set field `preload' */\n  lua_newtable(L);\n  lua_setfield(L, -2, \"preload\");\n  lua_pushvalue(L, LUA_GLOBALSINDEX);\n  luaL_register(L, NULL, ll_funcs);  /* open lib into global table */\n  lua_pop(L, 1);\n  return 1;  /* return 'package' table */\n}\n\n"
  },
  {
    "path": "jni/lua/lobject.c",
    "content": "/*\n** $Id: lobject.c,v 2.22.1.1 2007/12/27 13:02:25 roberto Exp $\n** Some generic functions over Lua objects\n** See Copyright Notice in lua.h\n*/\n\n#include <ctype.h>\n#include <stdarg.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define lobject_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"ldo.h\"\n#include \"lmem.h\"\n#include \"lobject.h\"\n#include \"lstate.h\"\n#include \"lstring.h\"\n#include \"lvm.h\"\n\n\n\nconst TValue luaO_nilobject_ = {{NULL}, LUA_TNIL};\n\n\n/*\n** converts an integer to a \"floating point byte\", represented as\n** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if\n** eeeee != 0 and (xxx) otherwise.\n*/\nint luaO_int2fb (unsigned int x) {\n  int e = 0;  /* expoent */\n  while (x >= 16) {\n    x = (x+1) >> 1;\n    e++;\n  }\n  if (x < 8) return x;\n  else return ((e+1) << 3) | (cast_int(x) - 8);\n}\n\n\n/* converts back */\nint luaO_fb2int (int x) {\n  int e = (x >> 3) & 31;\n  if (e == 0) return x;\n  else return ((x & 7)+8) << (e - 1);\n}\n\n\nint luaO_log2 (unsigned int x) {\n  static const lu_byte log_2[256] = {\n    0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,\n    6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,\n    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\n    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\n    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\n    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8\n  };\n  int l = -1;\n  while (x >= 256) { l += 8; x >>= 8; }\n  return l + log_2[x];\n\n}\n\n\nint luaO_rawequalObj (const TValue *t1, const TValue *t2) {\n  if (ttype(t1) != ttype(t2)) return 0;\n  else switch (ttype(t1)) {\n    case LUA_TNIL:\n      return 1;\n    case LUA_TNUMBER:\n      return luai_numeq(nvalue(t1), nvalue(t2));\n    case LUA_TBOOLEAN:\n      return bvalue(t1) == bvalue(t2);  /* boolean true must be 1 !! */\n    case LUA_TLIGHTUSERDATA:\n      return pvalue(t1) == pvalue(t2);\n    default:\n      lua_assert(iscollectable(t1));\n      return gcvalue(t1) == gcvalue(t2);\n  }\n}\n\n\nint luaO_str2d (const char *s, lua_Number *result) {\n  char *endptr;\n  *result = lua_str2number(s, &endptr);\n  if (endptr == s) return 0;  /* conversion failed */\n  if (*endptr == 'x' || *endptr == 'X')  /* maybe an hexadecimal constant? */\n    *result = cast_num(strtoul(s, &endptr, 16));\n  if (*endptr == '\\0') return 1;  /* most common case */\n  while (isspace(cast(unsigned char, *endptr))) endptr++;\n  if (*endptr != '\\0') return 0;  /* invalid trailing characters? */\n  return 1;\n}\n\n\n\nstatic void pushstr (lua_State *L, const char *str) {\n  setsvalue2s(L, L->top, luaS_new(L, str));\n  incr_top(L);\n}\n\n\n/* this function handles only `%d', `%c', %f, %p, and `%s' formats */\nconst char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {\n  int n = 1;\n  pushstr(L, \"\");\n  for (;;) {\n    const char *e = strchr(fmt, '%');\n    if (e == NULL) break;\n    setsvalue2s(L, L->top, luaS_newlstr(L, fmt, e-fmt));\n    incr_top(L);\n    switch (*(e+1)) {\n      case 's': {\n        const char *s = va_arg(argp, char *);\n        if (s == NULL) s = \"(null)\";\n        pushstr(L, s);\n        break;\n      }\n      case 'c': {\n        char buff[2];\n        buff[0] = cast(char, va_arg(argp, int));\n        buff[1] = '\\0';\n        pushstr(L, buff);\n        break;\n      }\n      case 'd': {\n        setnvalue(L->top, cast_num(va_arg(argp, int)));\n        incr_top(L);\n        break;\n      }\n      case 'f': {\n        setnvalue(L->top, cast_num(va_arg(argp, l_uacNumber)));\n        incr_top(L);\n        break;\n      }\n      case 'p': {\n        char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */\n        sprintf(buff, \"%p\", va_arg(argp, void *));\n        pushstr(L, buff);\n        break;\n      }\n      case '%': {\n        pushstr(L, \"%\");\n        break;\n      }\n      default: {\n        char buff[3];\n        buff[0] = '%';\n        buff[1] = *(e+1);\n        buff[2] = '\\0';\n        pushstr(L, buff);\n        break;\n      }\n    }\n    n += 2;\n    fmt = e+2;\n  }\n  pushstr(L, fmt);\n  luaV_concat(L, n+1, cast_int(L->top - L->base) - 1);\n  L->top -= n;\n  return svalue(L->top - 1);\n}\n\n\nconst char *luaO_pushfstring (lua_State *L, const char *fmt, ...) {\n  const char *msg;\n  va_list argp;\n  va_start(argp, fmt);\n  msg = luaO_pushvfstring(L, fmt, argp);\n  va_end(argp);\n  return msg;\n}\n\n\nvoid luaO_chunkid (char *out, const char *source, size_t bufflen) {\n  if (*source == '=') {\n    strncpy(out, source+1, bufflen);  /* remove first char */\n    out[bufflen-1] = '\\0';  /* ensures null termination */\n  }\n  else {  /* out = \"source\", or \"...source\" */\n    if (*source == '@') {\n      size_t l;\n      source++;  /* skip the `@' */\n      bufflen -= sizeof(\" '...' \");\n      l = strlen(source);\n      strcpy(out, \"\");\n      if (l > bufflen) {\n        source += (l-bufflen);  /* get last part of file name */\n        strcat(out, \"...\");\n      }\n      strcat(out, source);\n    }\n    else {  /* out = [string \"string\"] */\n      size_t len = strcspn(source, \"\\n\\r\");  /* stop at first newline */\n      bufflen -= sizeof(\" [string \\\"...\\\"] \");\n      if (len > bufflen) len = bufflen;\n      strcpy(out, \"[string \\\"\");\n      if (source[len] != '\\0') {  /* must truncate? */\n        strncat(out, source, len);\n        strcat(out, \"...\");\n      }\n      else\n        strcat(out, source);\n      strcat(out, \"\\\"]\");\n    }\n  }\n}\n"
  },
  {
    "path": "jni/lua/lobject.h",
    "content": "/*\n** $Id: lobject.h,v 2.20.1.2 2008/08/06 13:29:48 roberto Exp $\n** Type definitions for Lua objects\n** See Copyright Notice in lua.h\n*/\n\n\n#ifndef lobject_h\n#define lobject_h\n\n\n#include <stdarg.h>\n\n\n#include \"llimits.h\"\n#include \"lua.h\"\n\n\n/* tags for values visible from Lua */\n#define LAST_TAG\tLUA_TTHREAD\n\n#define NUM_TAGS\t(LAST_TAG+1)\n\n\n/*\n** Extra tags for non-values\n*/\n#define LUA_TPROTO\t(LAST_TAG+1)\n#define LUA_TUPVAL\t(LAST_TAG+2)\n#define LUA_TDEADKEY\t(LAST_TAG+3)\n\n\n/*\n** Union of all collectable objects\n*/\ntypedef union GCObject GCObject;\n\n\n/*\n** Common Header for all collectable objects (in macro form, to be\n** included in other objects)\n*/\n#define CommonHeader\tGCObject *next; lu_byte tt; lu_byte marked\n\n\n/*\n** Common header in struct form\n*/\ntypedef struct GCheader {\n  CommonHeader;\n} GCheader;\n\n\n\n\n/*\n** Union of all Lua values\n*/\ntypedef union {\n  GCObject *gc;\n  void *p;\n  lua_Number n;\n  int b;\n} Value;\n\n\n/*\n** Tagged Values\n*/\n\n#define TValuefields\tValue value; int tt\n\ntypedef struct lua_TValue {\n  TValuefields;\n} TValue;\n\n\n/* Macros to test type */\n#define ttisnil(o)\t(ttype(o) == LUA_TNIL)\n#define ttisnumber(o)\t(ttype(o) == LUA_TNUMBER)\n#define ttisstring(o)\t(ttype(o) == LUA_TSTRING)\n#define ttistable(o)\t(ttype(o) == LUA_TTABLE)\n#define ttisfunction(o)\t(ttype(o) == LUA_TFUNCTION)\n#define ttisboolean(o)\t(ttype(o) == LUA_TBOOLEAN)\n#define ttisuserdata(o)\t(ttype(o) == LUA_TUSERDATA)\n#define ttisthread(o)\t(ttype(o) == LUA_TTHREAD)\n#define ttislightuserdata(o)\t(ttype(o) == LUA_TLIGHTUSERDATA)\n\n/* Macros to access values */\n#define ttype(o)\t((o)->tt)\n#define gcvalue(o)\tcheck_exp(iscollectable(o), (o)->value.gc)\n#define pvalue(o)\tcheck_exp(ttislightuserdata(o), (o)->value.p)\n#define nvalue(o)\tcheck_exp(ttisnumber(o), (o)->value.n)\n#define rawtsvalue(o)\tcheck_exp(ttisstring(o), &(o)->value.gc->ts)\n#define tsvalue(o)\t(&rawtsvalue(o)->tsv)\n#define rawuvalue(o)\tcheck_exp(ttisuserdata(o), &(o)->value.gc->u)\n#define uvalue(o)\t(&rawuvalue(o)->uv)\n#define clvalue(o)\tcheck_exp(ttisfunction(o), &(o)->value.gc->cl)\n#define hvalue(o)\tcheck_exp(ttistable(o), &(o)->value.gc->h)\n#define bvalue(o)\tcheck_exp(ttisboolean(o), (o)->value.b)\n#define thvalue(o)\tcheck_exp(ttisthread(o), &(o)->value.gc->th)\n\n#define l_isfalse(o)\t(ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0))\n\n/*\n** for internal debug only\n*/\n#define checkconsistency(obj) \\\n  lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt))\n\n#define checkliveness(g,obj) \\\n  lua_assert(!iscollectable(obj) || \\\n  ((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc)))\n\n\n/* Macros to set values */\n#define setnilvalue(obj) ((obj)->tt=LUA_TNIL)\n\n#define setnvalue(obj,x) \\\n  { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; }\n\n#define setpvalue(obj,x) \\\n  { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; }\n\n#define setbvalue(obj,x) \\\n  { TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; }\n\n#define setsvalue(L,obj,x) \\\n  { TValue *i_o=(obj); \\\n    i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \\\n    checkliveness(G(L),i_o); }\n\n#define setuvalue(L,obj,x) \\\n  { TValue *i_o=(obj); \\\n    i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \\\n    checkliveness(G(L),i_o); }\n\n#define setthvalue(L,obj,x) \\\n  { TValue *i_o=(obj); \\\n    i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \\\n    checkliveness(G(L),i_o); }\n\n#define setclvalue(L,obj,x) \\\n  { TValue *i_o=(obj); \\\n    i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \\\n    checkliveness(G(L),i_o); }\n\n#define sethvalue(L,obj,x) \\\n  { TValue *i_o=(obj); \\\n    i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \\\n    checkliveness(G(L),i_o); }\n\n#define setptvalue(L,obj,x) \\\n  { TValue *i_o=(obj); \\\n    i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \\\n    checkliveness(G(L),i_o); }\n\n\n\n\n#define setobj(L,obj1,obj2) \\\n  { const TValue *o2=(obj2); TValue *o1=(obj1); \\\n    o1->value = o2->value; o1->tt=o2->tt; \\\n    checkliveness(G(L),o1); }\n\n\n/*\n** different types of sets, according to destination\n*/\n\n/* from stack to (same) stack */\n#define setobjs2s\tsetobj\n/* to stack (not from same stack) */\n#define setobj2s\tsetobj\n#define setsvalue2s\tsetsvalue\n#define sethvalue2s\tsethvalue\n#define setptvalue2s\tsetptvalue\n/* from table to same table */\n#define setobjt2t\tsetobj\n/* to table */\n#define setobj2t\tsetobj\n/* to new object */\n#define setobj2n\tsetobj\n#define setsvalue2n\tsetsvalue\n\n#define setttype(obj, tt) (ttype(obj) = (tt))\n\n\n#define iscollectable(o)\t(ttype(o) >= LUA_TSTRING)\n\n\n\ntypedef TValue *StkId;  /* index to stack elements */\n\n\n/*\n** String headers for string table\n*/\ntypedef union TString {\n  L_Umaxalign dummy;  /* ensures maximum alignment for strings */\n  struct {\n    CommonHeader;\n    lu_byte reserved;\n    unsigned int hash;\n    size_t len;\n  } tsv;\n} TString;\n\n\n#define getstr(ts)\tcast(const char *, (ts) + 1)\n#define svalue(o)       getstr(rawtsvalue(o))\n\n\n\ntypedef union Udata {\n  L_Umaxalign dummy;  /* ensures maximum alignment for `local' udata */\n  struct {\n    CommonHeader;\n    struct Table *metatable;\n    struct Table *env;\n    size_t len;\n  } uv;\n} Udata;\n\n\n\n\n/*\n** Function Prototypes\n*/\ntypedef struct Proto {\n  CommonHeader;\n  TValue *k;  /* constants used by the function */\n  Instruction *code;\n  struct Proto **p;  /* functions defined inside the function */\n  int *lineinfo;  /* map from opcodes to source lines */\n  struct LocVar *locvars;  /* information about local variables */\n  TString **upvalues;  /* upvalue names */\n  TString  *source;\n  int sizeupvalues;\n  int sizek;  /* size of `k' */\n  int sizecode;\n  int sizelineinfo;\n  int sizep;  /* size of `p' */\n  int sizelocvars;\n  int linedefined;\n  int lastlinedefined;\n  GCObject *gclist;\n  lu_byte nups;  /* number of upvalues */\n  lu_byte numparams;\n  lu_byte is_vararg;\n  lu_byte maxstacksize;\n} Proto;\n\n\n/* masks for new-style vararg */\n#define VARARG_HASARG\t\t1\n#define VARARG_ISVARARG\t\t2\n#define VARARG_NEEDSARG\t\t4\n\n\ntypedef struct LocVar {\n  TString *varname;\n  int startpc;  /* first point where variable is active */\n  int endpc;    /* first point where variable is dead */\n} LocVar;\n\n\n\n/*\n** Upvalues\n*/\n\ntypedef struct UpVal {\n  CommonHeader;\n  TValue *v;  /* points to stack or to its own value */\n  union {\n    TValue value;  /* the value (when closed) */\n    struct {  /* double linked list (when open) */\n      struct UpVal *prev;\n      struct UpVal *next;\n    } l;\n  } u;\n} UpVal;\n\n\n/*\n** Closures\n*/\n\n#define ClosureHeader \\\n\tCommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \\\n\tstruct Table *env\n\ntypedef struct CClosure {\n  ClosureHeader;\n  lua_CFunction f;\n  TValue upvalue[1];\n} CClosure;\n\n\ntypedef struct LClosure {\n  ClosureHeader;\n  struct Proto *p;\n  UpVal *upvals[1];\n} LClosure;\n\n\ntypedef union Closure {\n  CClosure c;\n  LClosure l;\n} Closure;\n\n\n#define iscfunction(o)\t(ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC)\n#define isLfunction(o)\t(ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC)\n\n\n/*\n** Tables\n*/\n\ntypedef union TKey {\n  struct {\n    TValuefields;\n    struct Node *next;  /* for chaining */\n  } nk;\n  TValue tvk;\n} TKey;\n\n\ntypedef struct Node {\n  TValue i_val;\n  TKey i_key;\n} Node;\n\n\ntypedef struct Table {\n  CommonHeader;\n  lu_byte flags;  /* 1<<p means tagmethod(p) is not present */ \n  lu_byte lsizenode;  /* log2 of size of `node' array */\n  struct Table *metatable;\n  TValue *array;  /* array part */\n  Node *node;\n  Node *lastfree;  /* any free position is before this position */\n  GCObject *gclist;\n  int sizearray;  /* size of `array' array */\n} Table;\n\n\n\n/*\n** `module' operation for hashing (size is always a power of 2)\n*/\n#define lmod(s,size) \\\n\t(check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1)))))\n\n\n#define twoto(x)\t(1<<(x))\n#define sizenode(t)\t(twoto((t)->lsizenode))\n\n\n#define luaO_nilobject\t\t(&luaO_nilobject_)\n\nLUAI_DATA const TValue luaO_nilobject_;\n\n#define ceillog2(x)\t(luaO_log2((x)-1) + 1)\n\nLUAI_FUNC int luaO_log2 (unsigned int x);\nLUAI_FUNC int luaO_int2fb (unsigned int x);\nLUAI_FUNC int luaO_fb2int (int x);\nLUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2);\nLUAI_FUNC int luaO_str2d (const char *s, lua_Number *result);\nLUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt,\n                                                       va_list argp);\nLUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);\nLUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len);\n\n\n#endif\n\n"
  },
  {
    "path": "jni/lua/lopcodes.c",
    "content": "/*\n** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $\n** See Copyright Notice in lua.h\n*/\n\n\n#define lopcodes_c\n#define LUA_CORE\n\n\n#include \"lopcodes.h\"\n\n\n/* ORDER OP */\n\nconst char *const luaP_opnames[NUM_OPCODES+1] = {\n  \"MOVE\",\n  \"LOADK\",\n  \"LOADBOOL\",\n  \"LOADNIL\",\n  \"GETUPVAL\",\n  \"GETGLOBAL\",\n  \"GETTABLE\",\n  \"SETGLOBAL\",\n  \"SETUPVAL\",\n  \"SETTABLE\",\n  \"NEWTABLE\",\n  \"SELF\",\n  \"ADD\",\n  \"SUB\",\n  \"MUL\",\n  \"DIV\",\n  \"MOD\",\n  \"POW\",\n  \"UNM\",\n  \"NOT\",\n  \"LEN\",\n  \"CONCAT\",\n  \"JMP\",\n  \"EQ\",\n  \"LT\",\n  \"LE\",\n  \"TEST\",\n  \"TESTSET\",\n  \"CALL\",\n  \"TAILCALL\",\n  \"RETURN\",\n  \"FORLOOP\",\n  \"FORPREP\",\n  \"TFORLOOP\",\n  \"SETLIST\",\n  \"CLOSE\",\n  \"CLOSURE\",\n  \"VARARG\",\n  NULL\n};\n\n\n#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m))\n\nconst lu_byte luaP_opmodes[NUM_OPCODES] = {\n/*       T  A    B       C     mode\t\t   opcode\t*/\n  opmode(0, 1, OpArgR, OpArgN, iABC) \t\t/* OP_MOVE */\n ,opmode(0, 1, OpArgK, OpArgN, iABx)\t\t/* OP_LOADK */\n ,opmode(0, 1, OpArgU, OpArgU, iABC)\t\t/* OP_LOADBOOL */\n ,opmode(0, 1, OpArgR, OpArgN, iABC)\t\t/* OP_LOADNIL */\n ,opmode(0, 1, OpArgU, OpArgN, iABC)\t\t/* OP_GETUPVAL */\n ,opmode(0, 1, OpArgK, OpArgN, iABx)\t\t/* OP_GETGLOBAL */\n ,opmode(0, 1, OpArgR, OpArgK, iABC)\t\t/* OP_GETTABLE */\n ,opmode(0, 0, OpArgK, OpArgN, iABx)\t\t/* OP_SETGLOBAL */\n ,opmode(0, 0, OpArgU, OpArgN, iABC)\t\t/* OP_SETUPVAL */\n ,opmode(0, 0, OpArgK, OpArgK, iABC)\t\t/* OP_SETTABLE */\n ,opmode(0, 1, OpArgU, OpArgU, iABC)\t\t/* OP_NEWTABLE */\n ,opmode(0, 1, OpArgR, OpArgK, iABC)\t\t/* OP_SELF */\n ,opmode(0, 1, OpArgK, OpArgK, iABC)\t\t/* OP_ADD */\n ,opmode(0, 1, OpArgK, OpArgK, iABC)\t\t/* OP_SUB */\n ,opmode(0, 1, OpArgK, OpArgK, iABC)\t\t/* OP_MUL */\n ,opmode(0, 1, OpArgK, OpArgK, iABC)\t\t/* OP_DIV */\n ,opmode(0, 1, OpArgK, OpArgK, iABC)\t\t/* OP_MOD */\n ,opmode(0, 1, OpArgK, OpArgK, iABC)\t\t/* OP_POW */\n ,opmode(0, 1, OpArgR, OpArgN, iABC)\t\t/* OP_UNM */\n ,opmode(0, 1, OpArgR, OpArgN, iABC)\t\t/* OP_NOT */\n ,opmode(0, 1, OpArgR, OpArgN, iABC)\t\t/* OP_LEN */\n ,opmode(0, 1, OpArgR, OpArgR, iABC)\t\t/* OP_CONCAT */\n ,opmode(0, 0, OpArgR, OpArgN, iAsBx)\t\t/* OP_JMP */\n ,opmode(1, 0, OpArgK, OpArgK, iABC)\t\t/* OP_EQ */\n ,opmode(1, 0, OpArgK, OpArgK, iABC)\t\t/* OP_LT */\n ,opmode(1, 0, OpArgK, OpArgK, iABC)\t\t/* OP_LE */\n ,opmode(1, 1, OpArgR, OpArgU, iABC)\t\t/* OP_TEST */\n ,opmode(1, 1, OpArgR, OpArgU, iABC)\t\t/* OP_TESTSET */\n ,opmode(0, 1, OpArgU, OpArgU, iABC)\t\t/* OP_CALL */\n ,opmode(0, 1, OpArgU, OpArgU, iABC)\t\t/* OP_TAILCALL */\n ,opmode(0, 0, OpArgU, OpArgN, iABC)\t\t/* OP_RETURN */\n ,opmode(0, 1, OpArgR, OpArgN, iAsBx)\t\t/* OP_FORLOOP */\n ,opmode(0, 1, OpArgR, OpArgN, iAsBx)\t\t/* OP_FORPREP */\n ,opmode(1, 0, OpArgN, OpArgU, iABC)\t\t/* OP_TFORLOOP */\n ,opmode(0, 0, OpArgU, OpArgU, iABC)\t\t/* OP_SETLIST */\n ,opmode(0, 0, OpArgN, OpArgN, iABC)\t\t/* OP_CLOSE */\n ,opmode(0, 1, OpArgU, OpArgN, iABx)\t\t/* OP_CLOSURE */\n ,opmode(0, 1, OpArgU, OpArgN, iABC)\t\t/* OP_VARARG */\n};\n\n"
  },
  {
    "path": "jni/lua/lopcodes.h",
    "content": "/*\n** $Id: lopcodes.h,v 1.125.1.1 2007/12/27 13:02:25 roberto Exp $\n** Opcodes for Lua virtual machine\n** See Copyright Notice in lua.h\n*/\n\n#ifndef lopcodes_h\n#define lopcodes_h\n\n#include \"llimits.h\"\n\n\n/*===========================================================================\n  We assume that instructions are unsigned numbers.\n  All instructions have an opcode in the first 6 bits.\n  Instructions can have the following fields:\n\t`A' : 8 bits\n\t`B' : 9 bits\n\t`C' : 9 bits\n\t`Bx' : 18 bits (`B' and `C' together)\n\t`sBx' : signed Bx\n\n  A signed argument is represented in excess K; that is, the number\n  value is the unsigned value minus K. K is exactly the maximum value\n  for that argument (so that -max is represented by 0, and +max is\n  represented by 2*max), which is half the maximum for the corresponding\n  unsigned argument.\n===========================================================================*/\n\n\nenum OpMode {iABC, iABx, iAsBx};  /* basic instruction format */\n\n\n/*\n** size and position of opcode arguments.\n*/\n#define SIZE_C\t\t9\n#define SIZE_B\t\t9\n#define SIZE_Bx\t\t(SIZE_C + SIZE_B)\n#define SIZE_A\t\t8\n\n#define SIZE_OP\t\t6\n\n#define POS_OP\t\t0\n#define POS_A\t\t(POS_OP + SIZE_OP)\n#define POS_C\t\t(POS_A + SIZE_A)\n#define POS_B\t\t(POS_C + SIZE_C)\n#define POS_Bx\t\tPOS_C\n\n\n/*\n** limits for opcode arguments.\n** we use (signed) int to manipulate most arguments,\n** so they must fit in LUAI_BITSINT-1 bits (-1 for sign)\n*/\n#if SIZE_Bx < LUAI_BITSINT-1\n#define MAXARG_Bx        ((1<<SIZE_Bx)-1)\n#define MAXARG_sBx        (MAXARG_Bx>>1)         /* `sBx' is signed */\n#else\n#define MAXARG_Bx        MAX_INT\n#define MAXARG_sBx        MAX_INT\n#endif\n\n\n#define MAXARG_A        ((1<<SIZE_A)-1)\n#define MAXARG_B        ((1<<SIZE_B)-1)\n#define MAXARG_C        ((1<<SIZE_C)-1)\n\n\n/* creates a mask with `n' 1 bits at position `p' */\n#define MASK1(n,p)\t((~((~(Instruction)0)<<n))<<p)\n\n/* creates a mask with `n' 0 bits at position `p' */\n#define MASK0(n,p)\t(~MASK1(n,p))\n\n/*\n** the following macros help to manipulate instructions\n*/\n\n#define GET_OPCODE(i)\t(cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))\n#define SET_OPCODE(i,o)\t((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \\\n\t\t((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP))))\n\n#define GETARG_A(i)\t(cast(int, ((i)>>POS_A) & MASK1(SIZE_A,0)))\n#define SETARG_A(i,u)\t((i) = (((i)&MASK0(SIZE_A,POS_A)) | \\\n\t\t((cast(Instruction, u)<<POS_A)&MASK1(SIZE_A,POS_A))))\n\n#define GETARG_B(i)\t(cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0)))\n#define SETARG_B(i,b)\t((i) = (((i)&MASK0(SIZE_B,POS_B)) | \\\n\t\t((cast(Instruction, b)<<POS_B)&MASK1(SIZE_B,POS_B))))\n\n#define GETARG_C(i)\t(cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0)))\n#define SETARG_C(i,b)\t((i) = (((i)&MASK0(SIZE_C,POS_C)) | \\\n\t\t((cast(Instruction, b)<<POS_C)&MASK1(SIZE_C,POS_C))))\n\n#define GETARG_Bx(i)\t(cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0)))\n#define SETARG_Bx(i,b)\t((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \\\n\t\t((cast(Instruction, b)<<POS_Bx)&MASK1(SIZE_Bx,POS_Bx))))\n\n#define GETARG_sBx(i)\t(GETARG_Bx(i)-MAXARG_sBx)\n#define SETARG_sBx(i,b)\tSETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))\n\n\n#define CREATE_ABC(o,a,b,c)\t((cast(Instruction, o)<<POS_OP) \\\n\t\t\t| (cast(Instruction, a)<<POS_A) \\\n\t\t\t| (cast(Instruction, b)<<POS_B) \\\n\t\t\t| (cast(Instruction, c)<<POS_C))\n\n#define CREATE_ABx(o,a,bc)\t((cast(Instruction, o)<<POS_OP) \\\n\t\t\t| (cast(Instruction, a)<<POS_A) \\\n\t\t\t| (cast(Instruction, bc)<<POS_Bx))\n\n\n/*\n** Macros to operate RK indices\n*/\n\n/* this bit 1 means constant (0 means register) */\n#define BITRK\t\t(1 << (SIZE_B - 1))\n\n/* test whether value is a constant */\n#define ISK(x)\t\t((x) & BITRK)\n\n/* gets the index of the constant */\n#define INDEXK(r)\t((int)(r) & ~BITRK)\n\n#define MAXINDEXRK\t(BITRK - 1)\n\n/* code a constant index as a RK value */\n#define RKASK(x)\t((x) | BITRK)\n\n\n/*\n** invalid register that fits in 8 bits\n*/\n#define NO_REG\t\tMAXARG_A\n\n\n/*\n** R(x) - register\n** Kst(x) - constant (in constant table)\n** RK(x) == if ISK(x) then Kst(INDEXK(x)) else R(x)\n*/\n\n\n/*\n** grep \"ORDER OP\" if you change these enums\n*/\n\ntypedef enum {\n/*----------------------------------------------------------------------\nname\t\targs\tdescription\n------------------------------------------------------------------------*/\nOP_MOVE,/*\tA B\tR(A) := R(B)\t\t\t\t\t*/\nOP_LOADK,/*\tA Bx\tR(A) := Kst(Bx)\t\t\t\t\t*/\nOP_LOADBOOL,/*\tA B C\tR(A) := (Bool)B; if (C) pc++\t\t\t*/\nOP_LOADNIL,/*\tA B\tR(A) := ... := R(B) := nil\t\t\t*/\nOP_GETUPVAL,/*\tA B\tR(A) := UpValue[B]\t\t\t\t*/\n\nOP_GETGLOBAL,/*\tA Bx\tR(A) := Gbl[Kst(Bx)]\t\t\t\t*/\nOP_GETTABLE,/*\tA B C\tR(A) := R(B)[RK(C)]\t\t\t\t*/\n\nOP_SETGLOBAL,/*\tA Bx\tGbl[Kst(Bx)] := R(A)\t\t\t\t*/\nOP_SETUPVAL,/*\tA B\tUpValue[B] := R(A)\t\t\t\t*/\nOP_SETTABLE,/*\tA B C\tR(A)[RK(B)] := RK(C)\t\t\t\t*/\n\nOP_NEWTABLE,/*\tA B C\tR(A) := {} (size = B,C)\t\t\t\t*/\n\nOP_SELF,/*\tA B C\tR(A+1) := R(B); R(A) := R(B)[RK(C)]\t\t*/\n\nOP_ADD,/*\tA B C\tR(A) := RK(B) + RK(C)\t\t\t\t*/\nOP_SUB,/*\tA B C\tR(A) := RK(B) - RK(C)\t\t\t\t*/\nOP_MUL,/*\tA B C\tR(A) := RK(B) * RK(C)\t\t\t\t*/\nOP_DIV,/*\tA B C\tR(A) := RK(B) / RK(C)\t\t\t\t*/\nOP_MOD,/*\tA B C\tR(A) := RK(B) % RK(C)\t\t\t\t*/\nOP_POW,/*\tA B C\tR(A) := RK(B) ^ RK(C)\t\t\t\t*/\nOP_UNM,/*\tA B\tR(A) := -R(B)\t\t\t\t\t*/\nOP_NOT,/*\tA B\tR(A) := not R(B)\t\t\t\t*/\nOP_LEN,/*\tA B\tR(A) := length of R(B)\t\t\t\t*/\n\nOP_CONCAT,/*\tA B C\tR(A) := R(B).. ... ..R(C)\t\t\t*/\n\nOP_JMP,/*\tsBx\tpc+=sBx\t\t\t\t\t*/\n\nOP_EQ,/*\tA B C\tif ((RK(B) == RK(C)) ~= A) then pc++\t\t*/\nOP_LT,/*\tA B C\tif ((RK(B) <  RK(C)) ~= A) then pc++  \t\t*/\nOP_LE,/*\tA B C\tif ((RK(B) <= RK(C)) ~= A) then pc++  \t\t*/\n\nOP_TEST,/*\tA C\tif not (R(A) <=> C) then pc++\t\t\t*/ \nOP_TESTSET,/*\tA B C\tif (R(B) <=> C) then R(A) := R(B) else pc++\t*/ \n\nOP_CALL,/*\tA B C\tR(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */\nOP_TAILCALL,/*\tA B C\treturn R(A)(R(A+1), ... ,R(A+B-1))\t\t*/\nOP_RETURN,/*\tA B\treturn R(A), ... ,R(A+B-2)\t(see note)\t*/\n\nOP_FORLOOP,/*\tA sBx\tR(A)+=R(A+2);\n\t\t\tif R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/\nOP_FORPREP,/*\tA sBx\tR(A)-=R(A+2); pc+=sBx\t\t\t\t*/\n\nOP_TFORLOOP,/*\tA C\tR(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); \n                        if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++\t*/ \nOP_SETLIST,/*\tA B C\tR(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B\t*/\n\nOP_CLOSE,/*\tA \tclose all variables in the stack up to (>=) R(A)*/\nOP_CLOSURE,/*\tA Bx\tR(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n))\t*/\n\nOP_VARARG/*\tA B\tR(A), R(A+1), ..., R(A+B-1) = vararg\t\t*/\n} OpCode;\n\n\n#define NUM_OPCODES\t(cast(int, OP_VARARG) + 1)\n\n\n\n/*===========================================================================\n  Notes:\n  (*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1,\n      and can be 0: OP_CALL then sets `top' to last_result+1, so\n      next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'.\n\n  (*) In OP_VARARG, if (B == 0) then use actual number of varargs and\n      set top (like in OP_CALL with C == 0).\n\n  (*) In OP_RETURN, if (B == 0) then return up to `top'\n\n  (*) In OP_SETLIST, if (B == 0) then B = `top';\n      if (C == 0) then next `instruction' is real C\n\n  (*) For comparisons, A specifies what condition the test should accept\n      (true or false).\n\n  (*) All `skips' (pc++) assume that next instruction is a jump\n===========================================================================*/\n\n\n/*\n** masks for instruction properties. The format is:\n** bits 0-1: op mode\n** bits 2-3: C arg mode\n** bits 4-5: B arg mode\n** bit 6: instruction set register A\n** bit 7: operator is a test\n*/  \n\nenum OpArgMask {\n  OpArgN,  /* argument is not used */\n  OpArgU,  /* argument is used */\n  OpArgR,  /* argument is a register or a jump offset */\n  OpArgK   /* argument is a constant or register/constant */\n};\n\nLUAI_DATA const lu_byte luaP_opmodes[NUM_OPCODES];\n\n#define getOpMode(m)\t(cast(enum OpMode, luaP_opmodes[m] & 3))\n#define getBMode(m)\t(cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))\n#define getCMode(m)\t(cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3))\n#define testAMode(m)\t(luaP_opmodes[m] & (1 << 6))\n#define testTMode(m)\t(luaP_opmodes[m] & (1 << 7))\n\n\nLUAI_DATA const char *const luaP_opnames[NUM_OPCODES+1];  /* opcode names */\n\n\n/* number of list items to accumulate before a SETLIST instruction */\n#define LFIELDS_PER_FLUSH\t50\n\n\n#endif\n"
  },
  {
    "path": "jni/lua/loslib.c",
    "content": "/*\n** $Id: loslib.c,v 1.19.1.3 2008/01/18 16:38:18 roberto Exp $\n** Standard Operating System library\n** See Copyright Notice in lua.h\n*/\n\n\n#include <errno.h>\n#include <locale.h>\n#include <stdlib.h>\n#include <string.h>\n#include <time.h>\n\n#define loslib_c\n#define LUA_LIB\n\n#include \"lua.h\"\n\n#include \"lauxlib.h\"\n#include \"lualib.h\"\n\n\nstatic int os_pushresult (lua_State *L, int i, const char *filename) {\n  int en = errno;  /* calls to Lua API may change this value */\n  if (i) {\n    lua_pushboolean(L, 1);\n    return 1;\n  }\n  else {\n    lua_pushnil(L);\n    lua_pushfstring(L, \"%s: %s\", filename, strerror(en));\n    lua_pushinteger(L, en);\n    return 3;\n  }\n}\n\n\nstatic int os_execute (lua_State *L) {\n  lua_pushinteger(L, system(luaL_optstring(L, 1, NULL)));\n  return 1;\n}\n\n\nstatic int os_remove (lua_State *L) {\n  const char *filename = luaL_checkstring(L, 1);\n  return os_pushresult(L, remove(filename) == 0, filename);\n}\n\n\nstatic int os_rename (lua_State *L) {\n  const char *fromname = luaL_checkstring(L, 1);\n  const char *toname = luaL_checkstring(L, 2);\n  return os_pushresult(L, rename(fromname, toname) == 0, fromname);\n}\n\n\nstatic int os_tmpname (lua_State *L) {\n  char buff[LUA_TMPNAMBUFSIZE];\n  int err;\n  lua_tmpnam(buff, err);\n  if (err)\n    return luaL_error(L, \"unable to generate a unique filename\");\n  lua_pushstring(L, buff);\n  return 1;\n}\n\n\nstatic int os_getenv (lua_State *L) {\n  lua_pushstring(L, getenv(luaL_checkstring(L, 1)));  /* if NULL push nil */\n  return 1;\n}\n\n\nstatic int os_clock (lua_State *L) {\n  lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC);\n  return 1;\n}\n\n\n/*\n** {======================================================\n** Time/Date operations\n** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S,\n**   wday=%w+1, yday=%j, isdst=? }\n** =======================================================\n*/\n\nstatic void setfield (lua_State *L, const char *key, int value) {\n  lua_pushinteger(L, value);\n  lua_setfield(L, -2, key);\n}\n\nstatic void setboolfield (lua_State *L, const char *key, int value) {\n  if (value < 0)  /* undefined? */\n    return;  /* does not set field */\n  lua_pushboolean(L, value);\n  lua_setfield(L, -2, key);\n}\n\nstatic int getboolfield (lua_State *L, const char *key) {\n  int res;\n  lua_getfield(L, -1, key);\n  res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1);\n  lua_pop(L, 1);\n  return res;\n}\n\n\nstatic int getfield (lua_State *L, const char *key, int d) {\n  int res;\n  lua_getfield(L, -1, key);\n  if (lua_isnumber(L, -1))\n    res = (int)lua_tointeger(L, -1);\n  else {\n    if (d < 0)\n      return luaL_error(L, \"field \" LUA_QS \" missing in date table\", key);\n    res = d;\n  }\n  lua_pop(L, 1);\n  return res;\n}\n\n\nstatic int os_date (lua_State *L) {\n  const char *s = luaL_optstring(L, 1, \"%c\");\n  time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL));\n  struct tm *stm;\n  if (*s == '!') {  /* UTC? */\n    stm = gmtime(&t);\n    s++;  /* skip `!' */\n  }\n  else\n    stm = localtime(&t);\n  if (stm == NULL)  /* invalid date? */\n    lua_pushnil(L);\n  else if (strcmp(s, \"*t\") == 0) {\n    lua_createtable(L, 0, 9);  /* 9 = number of fields */\n    setfield(L, \"sec\", stm->tm_sec);\n    setfield(L, \"min\", stm->tm_min);\n    setfield(L, \"hour\", stm->tm_hour);\n    setfield(L, \"day\", stm->tm_mday);\n    setfield(L, \"month\", stm->tm_mon+1);\n    setfield(L, \"year\", stm->tm_year+1900);\n    setfield(L, \"wday\", stm->tm_wday+1);\n    setfield(L, \"yday\", stm->tm_yday+1);\n    setboolfield(L, \"isdst\", stm->tm_isdst);\n  }\n  else {\n    char cc[3];\n    luaL_Buffer b;\n    cc[0] = '%'; cc[2] = '\\0';\n    luaL_buffinit(L, &b);\n    for (; *s; s++) {\n      if (*s != '%' || *(s + 1) == '\\0')  /* no conversion specifier? */\n        luaL_addchar(&b, *s);\n      else {\n        size_t reslen;\n        char buff[200];  /* should be big enough for any conversion result */\n        cc[1] = *(++s);\n        reslen = strftime(buff, sizeof(buff), cc, stm);\n        luaL_addlstring(&b, buff, reslen);\n      }\n    }\n    luaL_pushresult(&b);\n  }\n  return 1;\n}\n\n\nstatic int os_time (lua_State *L) {\n  time_t t;\n  if (lua_isnoneornil(L, 1))  /* called without args? */\n    t = time(NULL);  /* get current time */\n  else {\n    struct tm ts;\n    luaL_checktype(L, 1, LUA_TTABLE);\n    lua_settop(L, 1);  /* make sure table is at the top */\n    ts.tm_sec = getfield(L, \"sec\", 0);\n    ts.tm_min = getfield(L, \"min\", 0);\n    ts.tm_hour = getfield(L, \"hour\", 12);\n    ts.tm_mday = getfield(L, \"day\", -1);\n    ts.tm_mon = getfield(L, \"month\", -1) - 1;\n    ts.tm_year = getfield(L, \"year\", -1) - 1900;\n    ts.tm_isdst = getboolfield(L, \"isdst\");\n    t = mktime(&ts);\n  }\n  if (t == (time_t)(-1))\n    lua_pushnil(L);\n  else\n    lua_pushnumber(L, (lua_Number)t);\n  return 1;\n}\n\n\nstatic int os_difftime (lua_State *L) {\n  lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)),\n                             (time_t)(luaL_optnumber(L, 2, 0))));\n  return 1;\n}\n\n/* }====================================================== */\n\n\nstatic int os_setlocale (lua_State *L) {\n  static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY,\n                      LC_NUMERIC, LC_TIME};\n  static const char *const catnames[] = {\"all\", \"collate\", \"ctype\", \"monetary\",\n     \"numeric\", \"time\", NULL};\n  const char *l = luaL_optstring(L, 1, NULL);\n  int op = luaL_checkoption(L, 2, \"all\", catnames);\n  lua_pushstring(L, setlocale(cat[op], l));\n  return 1;\n}\n\n\nstatic int os_exit (lua_State *L) {\n  exit(luaL_optint(L, 1, EXIT_SUCCESS));\n}\n\nstatic const luaL_Reg syslib[] = {\n  {\"clock\",     os_clock},\n  {\"date\",      os_date},\n  {\"difftime\",  os_difftime},\n  {\"execute\",   os_execute},\n  {\"exit\",      os_exit},\n  {\"getenv\",    os_getenv},\n  {\"remove\",    os_remove},\n  {\"rename\",    os_rename},\n  {\"setlocale\", os_setlocale},\n  {\"time\",      os_time},\n  {\"tmpname\",   os_tmpname},\n  {NULL, NULL}\n};\n\n/* }====================================================== */\n\n\n\nLUALIB_API int luaopen_os (lua_State *L) {\n  luaL_register(L, LUA_OSLIBNAME, syslib);\n  return 1;\n}\n\n"
  },
  {
    "path": "jni/lua/lparser.c",
    "content": "/*\n** $Id: lparser.c,v 2.42.1.4 2011/10/21 19:31:42 roberto Exp $\n** Lua Parser\n** See Copyright Notice in lua.h\n*/\n\n\n#include <string.h>\n\n#define lparser_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"lcode.h\"\n#include \"ldebug.h\"\n#include \"ldo.h\"\n#include \"lfunc.h\"\n#include \"llex.h\"\n#include \"lmem.h\"\n#include \"lobject.h\"\n#include \"lopcodes.h\"\n#include \"lparser.h\"\n#include \"lstate.h\"\n#include \"lstring.h\"\n#include \"ltable.h\"\n\n\n\n#define hasmultret(k)\t\t((k) == VCALL || (k) == VVARARG)\n\n#define getlocvar(fs, i)\t((fs)->f->locvars[(fs)->actvar[i]])\n\n#define luaY_checklimit(fs,v,l,m)\tif ((v)>(l)) errorlimit(fs,l,m)\n\n\n/*\n** nodes for block list (list of active blocks)\n*/\ntypedef struct BlockCnt {\n  struct BlockCnt *previous;  /* chain */\n  int breaklist;  /* list of jumps out of this loop */\n  lu_byte nactvar;  /* # active locals outside the breakable structure */\n  lu_byte upval;  /* true if some variable in the block is an upvalue */\n  lu_byte isbreakable;  /* true if `block' is a loop */\n} BlockCnt;\n\n\n\n/*\n** prototypes for recursive non-terminal functions\n*/\nstatic void chunk (LexState *ls);\nstatic void expr (LexState *ls, expdesc *v);\n\n\nstatic void anchor_token (LexState *ls) {\n  if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) {\n    TString *ts = ls->t.seminfo.ts;\n    luaX_newstring(ls, getstr(ts), ts->tsv.len);\n  }\n}\n\n\nstatic void error_expected (LexState *ls, int token) {\n  luaX_syntaxerror(ls,\n      luaO_pushfstring(ls->L, LUA_QS \" expected\", luaX_token2str(ls, token)));\n}\n\n\nstatic void errorlimit (FuncState *fs, int limit, const char *what) {\n  const char *msg = (fs->f->linedefined == 0) ?\n    luaO_pushfstring(fs->L, \"main function has more than %d %s\", limit, what) :\n    luaO_pushfstring(fs->L, \"function at line %d has more than %d %s\",\n                            fs->f->linedefined, limit, what);\n  luaX_lexerror(fs->ls, msg, 0);\n}\n\n\nstatic int testnext (LexState *ls, int c) {\n  if (ls->t.token == c) {\n    luaX_next(ls);\n    return 1;\n  }\n  else return 0;\n}\n\n\nstatic void check (LexState *ls, int c) {\n  if (ls->t.token != c)\n    error_expected(ls, c);\n}\n\nstatic void checknext (LexState *ls, int c) {\n  check(ls, c);\n  luaX_next(ls);\n}\n\n\n#define check_condition(ls,c,msg)\t{ if (!(c)) luaX_syntaxerror(ls, msg); }\n\n\n\nstatic void check_match (LexState *ls, int what, int who, int where) {\n  if (!testnext(ls, what)) {\n    if (where == ls->linenumber)\n      error_expected(ls, what);\n    else {\n      luaX_syntaxerror(ls, luaO_pushfstring(ls->L,\n             LUA_QS \" expected (to close \" LUA_QS \" at line %d)\",\n              luaX_token2str(ls, what), luaX_token2str(ls, who), where));\n    }\n  }\n}\n\n\nstatic TString *str_checkname (LexState *ls) {\n  TString *ts;\n  check(ls, TK_NAME);\n  ts = ls->t.seminfo.ts;\n  luaX_next(ls);\n  return ts;\n}\n\n\nstatic void init_exp (expdesc *e, expkind k, int i) {\n  e->f = e->t = NO_JUMP;\n  e->k = k;\n  e->u.s.info = i;\n}\n\n\nstatic void codestring (LexState *ls, expdesc *e, TString *s) {\n  init_exp(e, VK, luaK_stringK(ls->fs, s));\n}\n\n\nstatic void checkname(LexState *ls, expdesc *e) {\n  codestring(ls, e, str_checkname(ls));\n}\n\n\nstatic int registerlocalvar (LexState *ls, TString *varname) {\n  FuncState *fs = ls->fs;\n  Proto *f = fs->f;\n  int oldsize = f->sizelocvars;\n  luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars,\n                  LocVar, SHRT_MAX, \"too many local variables\");\n  while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL;\n  f->locvars[fs->nlocvars].varname = varname;\n  luaC_objbarrier(ls->L, f, varname);\n  return fs->nlocvars++;\n}\n\n\n#define new_localvarliteral(ls,v,n) \\\n  new_localvar(ls, luaX_newstring(ls, \"\" v, (sizeof(v)/sizeof(char))-1), n)\n\n\nstatic void new_localvar (LexState *ls, TString *name, int n) {\n  FuncState *fs = ls->fs;\n  luaY_checklimit(fs, fs->nactvar+n+1, LUAI_MAXVARS, \"local variables\");\n  fs->actvar[fs->nactvar+n] = cast(unsigned short, registerlocalvar(ls, name));\n}\n\n\nstatic void adjustlocalvars (LexState *ls, int nvars) {\n  FuncState *fs = ls->fs;\n  fs->nactvar = cast_byte(fs->nactvar + nvars);\n  for (; nvars; nvars--) {\n    getlocvar(fs, fs->nactvar - nvars).startpc = fs->pc;\n  }\n}\n\n\nstatic void removevars (LexState *ls, int tolevel) {\n  FuncState *fs = ls->fs;\n  while (fs->nactvar > tolevel)\n    getlocvar(fs, --fs->nactvar).endpc = fs->pc;\n}\n\n\nstatic int indexupvalue (FuncState *fs, TString *name, expdesc *v) {\n  int i;\n  Proto *f = fs->f;\n  int oldsize = f->sizeupvalues;\n  for (i=0; i<f->nups; i++) {\n    if (fs->upvalues[i].k == v->k && fs->upvalues[i].info == v->u.s.info) {\n      lua_assert(f->upvalues[i] == name);\n      return i;\n    }\n  }\n  /* new one */\n  luaY_checklimit(fs, f->nups + 1, LUAI_MAXUPVALUES, \"upvalues\");\n  luaM_growvector(fs->L, f->upvalues, f->nups, f->sizeupvalues,\n                  TString *, MAX_INT, \"\");\n  while (oldsize < f->sizeupvalues) f->upvalues[oldsize++] = NULL;\n  f->upvalues[f->nups] = name;\n  luaC_objbarrier(fs->L, f, name);\n  lua_assert(v->k == VLOCAL || v->k == VUPVAL);\n  fs->upvalues[f->nups].k = cast_byte(v->k);\n  fs->upvalues[f->nups].info = cast_byte(v->u.s.info);\n  return f->nups++;\n}\n\n\nstatic int searchvar (FuncState *fs, TString *n) {\n  int i;\n  for (i=fs->nactvar-1; i >= 0; i--) {\n    if (n == getlocvar(fs, i).varname)\n      return i;\n  }\n  return -1;  /* not found */\n}\n\n\nstatic void markupval (FuncState *fs, int level) {\n  BlockCnt *bl = fs->bl;\n  while (bl && bl->nactvar > level) bl = bl->previous;\n  if (bl) bl->upval = 1;\n}\n\n\nstatic int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) {\n  if (fs == NULL) {  /* no more levels? */\n    init_exp(var, VGLOBAL, NO_REG);  /* default is global variable */\n    return VGLOBAL;\n  }\n  else {\n    int v = searchvar(fs, n);  /* look up at current level */\n    if (v >= 0) {\n      init_exp(var, VLOCAL, v);\n      if (!base)\n        markupval(fs, v);  /* local will be used as an upval */\n      return VLOCAL;\n    }\n    else {  /* not found at current level; try upper one */\n      if (singlevaraux(fs->prev, n, var, 0) == VGLOBAL)\n        return VGLOBAL;\n      var->u.s.info = indexupvalue(fs, n, var);  /* else was LOCAL or UPVAL */\n      var->k = VUPVAL;  /* upvalue in this level */\n      return VUPVAL;\n    }\n  }\n}\n\n\nstatic void singlevar (LexState *ls, expdesc *var) {\n  TString *varname = str_checkname(ls);\n  FuncState *fs = ls->fs;\n  if (singlevaraux(fs, varname, var, 1) == VGLOBAL)\n    var->u.s.info = luaK_stringK(fs, varname);  /* info points to global name */\n}\n\n\nstatic void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) {\n  FuncState *fs = ls->fs;\n  int extra = nvars - nexps;\n  if (hasmultret(e->k)) {\n    extra++;  /* includes call itself */\n    if (extra < 0) extra = 0;\n    luaK_setreturns(fs, e, extra);  /* last exp. provides the difference */\n    if (extra > 1) luaK_reserveregs(fs, extra-1);\n  }\n  else {\n    if (e->k != VVOID) luaK_exp2nextreg(fs, e);  /* close last expression */\n    if (extra > 0) {\n      int reg = fs->freereg;\n      luaK_reserveregs(fs, extra);\n      luaK_nil(fs, reg, extra);\n    }\n  }\n}\n\n\nstatic void enterlevel (LexState *ls) {\n  if (++ls->L->nCcalls > LUAI_MAXCCALLS)\n\tluaX_lexerror(ls, \"chunk has too many syntax levels\", 0);\n}\n\n\n#define leavelevel(ls)\t((ls)->L->nCcalls--)\n\n\nstatic void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) {\n  bl->breaklist = NO_JUMP;\n  bl->isbreakable = isbreakable;\n  bl->nactvar = fs->nactvar;\n  bl->upval = 0;\n  bl->previous = fs->bl;\n  fs->bl = bl;\n  lua_assert(fs->freereg == fs->nactvar);\n}\n\n\nstatic void leaveblock (FuncState *fs) {\n  BlockCnt *bl = fs->bl;\n  fs->bl = bl->previous;\n  removevars(fs->ls, bl->nactvar);\n  if (bl->upval)\n    luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0);\n  /* a block either controls scope or breaks (never both) */\n  lua_assert(!bl->isbreakable || !bl->upval);\n  lua_assert(bl->nactvar == fs->nactvar);\n  fs->freereg = fs->nactvar;  /* free registers */\n  luaK_patchtohere(fs, bl->breaklist);\n}\n\n\nstatic void pushclosure (LexState *ls, FuncState *func, expdesc *v) {\n  FuncState *fs = ls->fs;\n  Proto *f = fs->f;\n  int oldsize = f->sizep;\n  int i;\n  luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *,\n                  MAXARG_Bx, \"constant table overflow\");\n  while (oldsize < f->sizep) f->p[oldsize++] = NULL;\n  f->p[fs->np++] = func->f;\n  luaC_objbarrier(ls->L, f, func->f);\n  init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1));\n  for (i=0; i<func->f->nups; i++) {\n    OpCode o = (func->upvalues[i].k == VLOCAL) ? OP_MOVE : OP_GETUPVAL;\n    luaK_codeABC(fs, o, 0, func->upvalues[i].info, 0);\n  }\n}\n\n\nstatic void open_func (LexState *ls, FuncState *fs) {\n  lua_State *L = ls->L;\n  Proto *f = luaF_newproto(L);\n  fs->f = f;\n  fs->prev = ls->fs;  /* linked list of funcstates */\n  fs->ls = ls;\n  fs->L = L;\n  ls->fs = fs;\n  fs->pc = 0;\n  fs->lasttarget = -1;\n  fs->jpc = NO_JUMP;\n  fs->freereg = 0;\n  fs->nk = 0;\n  fs->np = 0;\n  fs->nlocvars = 0;\n  fs->nactvar = 0;\n  fs->bl = NULL;\n  f->source = ls->source;\n  f->maxstacksize = 2;  /* registers 0/1 are always valid */\n  fs->h = luaH_new(L, 0, 0);\n  /* anchor table of constants and prototype (to avoid being collected) */\n  sethvalue2s(L, L->top, fs->h);\n  incr_top(L);\n  setptvalue2s(L, L->top, f);\n  incr_top(L);\n}\n\n\nstatic void close_func (LexState *ls) {\n  lua_State *L = ls->L;\n  FuncState *fs = ls->fs;\n  Proto *f = fs->f;\n  removevars(ls, 0);\n  luaK_ret(fs, 0, 0);  /* final return */\n  luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction);\n  f->sizecode = fs->pc;\n  luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int);\n  f->sizelineinfo = fs->pc;\n  luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue);\n  f->sizek = fs->nk;\n  luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *);\n  f->sizep = fs->np;\n  luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar);\n  f->sizelocvars = fs->nlocvars;\n  luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups, TString *);\n  f->sizeupvalues = f->nups;\n  lua_assert(luaG_checkcode(f));\n  lua_assert(fs->bl == NULL);\n  ls->fs = fs->prev;\n  /* last token read was anchored in defunct function; must reanchor it */\n  if (fs) anchor_token(ls);\n  L->top -= 2;  /* remove table and prototype from the stack */\n}\n\n\nProto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) {\n  struct LexState lexstate;\n  struct FuncState funcstate;\n  lexstate.buff = buff;\n  luaX_setinput(L, &lexstate, z, luaS_new(L, name));\n  open_func(&lexstate, &funcstate);\n  funcstate.f->is_vararg = VARARG_ISVARARG;  /* main func. is always vararg */\n  luaX_next(&lexstate);  /* read first token */\n  chunk(&lexstate);\n  check(&lexstate, TK_EOS);\n  close_func(&lexstate);\n  lua_assert(funcstate.prev == NULL);\n  lua_assert(funcstate.f->nups == 0);\n  lua_assert(lexstate.fs == NULL);\n  return funcstate.f;\n}\n\n\n\n/*============================================================*/\n/* GRAMMAR RULES */\n/*============================================================*/\n\n\nstatic void field (LexState *ls, expdesc *v) {\n  /* field -> ['.' | ':'] NAME */\n  FuncState *fs = ls->fs;\n  expdesc key;\n  luaK_exp2anyreg(fs, v);\n  luaX_next(ls);  /* skip the dot or colon */\n  checkname(ls, &key);\n  luaK_indexed(fs, v, &key);\n}\n\n\nstatic void yindex (LexState *ls, expdesc *v) {\n  /* index -> '[' expr ']' */\n  luaX_next(ls);  /* skip the '[' */\n  expr(ls, v);\n  luaK_exp2val(ls->fs, v);\n  checknext(ls, ']');\n}\n\n\n/*\n** {======================================================================\n** Rules for Constructors\n** =======================================================================\n*/\n\n\nstruct ConsControl {\n  expdesc v;  /* last list item read */\n  expdesc *t;  /* table descriptor */\n  int nh;  /* total number of `record' elements */\n  int na;  /* total number of array elements */\n  int tostore;  /* number of array elements pending to be stored */\n};\n\n\nstatic void recfield (LexState *ls, struct ConsControl *cc) {\n  /* recfield -> (NAME | `['exp1`]') = exp1 */\n  FuncState *fs = ls->fs;\n  int reg = ls->fs->freereg;\n  expdesc key, val;\n  int rkkey;\n  if (ls->t.token == TK_NAME) {\n    luaY_checklimit(fs, cc->nh, MAX_INT, \"items in a constructor\");\n    checkname(ls, &key);\n  }\n  else  /* ls->t.token == '[' */\n    yindex(ls, &key);\n  cc->nh++;\n  checknext(ls, '=');\n  rkkey = luaK_exp2RK(fs, &key);\n  expr(ls, &val);\n  luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val));\n  fs->freereg = reg;  /* free registers */\n}\n\n\nstatic void closelistfield (FuncState *fs, struct ConsControl *cc) {\n  if (cc->v.k == VVOID) return;  /* there is no list item */\n  luaK_exp2nextreg(fs, &cc->v);\n  cc->v.k = VVOID;\n  if (cc->tostore == LFIELDS_PER_FLUSH) {\n    luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore);  /* flush */\n    cc->tostore = 0;  /* no more items pending */\n  }\n}\n\n\nstatic void lastlistfield (FuncState *fs, struct ConsControl *cc) {\n  if (cc->tostore == 0) return;\n  if (hasmultret(cc->v.k)) {\n    luaK_setmultret(fs, &cc->v);\n    luaK_setlist(fs, cc->t->u.s.info, cc->na, LUA_MULTRET);\n    cc->na--;  /* do not count last expression (unknown number of elements) */\n  }\n  else {\n    if (cc->v.k != VVOID)\n      luaK_exp2nextreg(fs, &cc->v);\n    luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore);\n  }\n}\n\n\nstatic void listfield (LexState *ls, struct ConsControl *cc) {\n  expr(ls, &cc->v);\n  luaY_checklimit(ls->fs, cc->na, MAX_INT, \"items in a constructor\");\n  cc->na++;\n  cc->tostore++;\n}\n\n\nstatic void constructor (LexState *ls, expdesc *t) {\n  /* constructor -> ?? */\n  FuncState *fs = ls->fs;\n  int line = ls->linenumber;\n  int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0);\n  struct ConsControl cc;\n  cc.na = cc.nh = cc.tostore = 0;\n  cc.t = t;\n  init_exp(t, VRELOCABLE, pc);\n  init_exp(&cc.v, VVOID, 0);  /* no value (yet) */\n  luaK_exp2nextreg(ls->fs, t);  /* fix it at stack top (for gc) */\n  checknext(ls, '{');\n  do {\n    lua_assert(cc.v.k == VVOID || cc.tostore > 0);\n    if (ls->t.token == '}') break;\n    closelistfield(fs, &cc);\n    switch(ls->t.token) {\n      case TK_NAME: {  /* may be listfields or recfields */\n        luaX_lookahead(ls);\n        if (ls->lookahead.token != '=')  /* expression? */\n          listfield(ls, &cc);\n        else\n          recfield(ls, &cc);\n        break;\n      }\n      case '[': {  /* constructor_item -> recfield */\n        recfield(ls, &cc);\n        break;\n      }\n      default: {  /* constructor_part -> listfield */\n        listfield(ls, &cc);\n        break;\n      }\n    }\n  } while (testnext(ls, ',') || testnext(ls, ';'));\n  check_match(ls, '}', '{', line);\n  lastlistfield(fs, &cc);\n  SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */\n  SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh));  /* set initial table size */\n}\n\n/* }====================================================================== */\n\n\n\nstatic void parlist (LexState *ls) {\n  /* parlist -> [ param { `,' param } ] */\n  FuncState *fs = ls->fs;\n  Proto *f = fs->f;\n  int nparams = 0;\n  f->is_vararg = 0;\n  if (ls->t.token != ')') {  /* is `parlist' not empty? */\n    do {\n      switch (ls->t.token) {\n        case TK_NAME: {  /* param -> NAME */\n          new_localvar(ls, str_checkname(ls), nparams++);\n          break;\n        }\n        case TK_DOTS: {  /* param -> `...' */\n          luaX_next(ls);\n#if defined(LUA_COMPAT_VARARG)\n          /* use `arg' as default name */\n          new_localvarliteral(ls, \"arg\", nparams++);\n          f->is_vararg = VARARG_HASARG | VARARG_NEEDSARG;\n#endif\n          f->is_vararg |= VARARG_ISVARARG;\n          break;\n        }\n        default: luaX_syntaxerror(ls, \"<name> or \" LUA_QL(\"...\") \" expected\");\n      }\n    } while (!f->is_vararg && testnext(ls, ','));\n  }\n  adjustlocalvars(ls, nparams);\n  f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG));\n  luaK_reserveregs(fs, fs->nactvar);  /* reserve register for parameters */\n}\n\n\nstatic void body (LexState *ls, expdesc *e, int needself, int line) {\n  /* body ->  `(' parlist `)' chunk END */\n  FuncState new_fs;\n  open_func(ls, &new_fs);\n  new_fs.f->linedefined = line;\n  checknext(ls, '(');\n  if (needself) {\n    new_localvarliteral(ls, \"self\", 0);\n    adjustlocalvars(ls, 1);\n  }\n  parlist(ls);\n  checknext(ls, ')');\n  chunk(ls);\n  new_fs.f->lastlinedefined = ls->linenumber;\n  check_match(ls, TK_END, TK_FUNCTION, line);\n  close_func(ls);\n  pushclosure(ls, &new_fs, e);\n}\n\n\nstatic int explist1 (LexState *ls, expdesc *v) {\n  /* explist1 -> expr { `,' expr } */\n  int n = 1;  /* at least one expression */\n  expr(ls, v);\n  while (testnext(ls, ',')) {\n    luaK_exp2nextreg(ls->fs, v);\n    expr(ls, v);\n    n++;\n  }\n  return n;\n}\n\n\nstatic void funcargs (LexState *ls, expdesc *f) {\n  FuncState *fs = ls->fs;\n  expdesc args;\n  int base, nparams;\n  int line = ls->linenumber;\n  switch (ls->t.token) {\n    case '(': {  /* funcargs -> `(' [ explist1 ] `)' */\n      if (line != ls->lastline)\n        luaX_syntaxerror(ls,\"ambiguous syntax (function call x new statement)\");\n      luaX_next(ls);\n      if (ls->t.token == ')')  /* arg list is empty? */\n        args.k = VVOID;\n      else {\n        explist1(ls, &args);\n        luaK_setmultret(fs, &args);\n      }\n      check_match(ls, ')', '(', line);\n      break;\n    }\n    case '{': {  /* funcargs -> constructor */\n      constructor(ls, &args);\n      break;\n    }\n    case TK_STRING: {  /* funcargs -> STRING */\n      codestring(ls, &args, ls->t.seminfo.ts);\n      luaX_next(ls);  /* must use `seminfo' before `next' */\n      break;\n    }\n    default: {\n      luaX_syntaxerror(ls, \"function arguments expected\");\n      return;\n    }\n  }\n  lua_assert(f->k == VNONRELOC);\n  base = f->u.s.info;  /* base register for call */\n  if (hasmultret(args.k))\n    nparams = LUA_MULTRET;  /* open call */\n  else {\n    if (args.k != VVOID)\n      luaK_exp2nextreg(fs, &args);  /* close last argument */\n    nparams = fs->freereg - (base+1);\n  }\n  init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2));\n  luaK_fixline(fs, line);\n  fs->freereg = base+1;  /* call remove function and arguments and leaves\n                            (unless changed) one result */\n}\n\n\n\n\n/*\n** {======================================================================\n** Expression parsing\n** =======================================================================\n*/\n\n\nstatic void prefixexp (LexState *ls, expdesc *v) {\n  /* prefixexp -> NAME | '(' expr ')' */\n  switch (ls->t.token) {\n    case '(': {\n      int line = ls->linenumber;\n      luaX_next(ls);\n      expr(ls, v);\n      check_match(ls, ')', '(', line);\n      luaK_dischargevars(ls->fs, v);\n      return;\n    }\n    case TK_NAME: {\n      singlevar(ls, v);\n      return;\n    }\n    default: {\n      luaX_syntaxerror(ls, \"unexpected symbol\");\n      return;\n    }\n  }\n}\n\n\nstatic void primaryexp (LexState *ls, expdesc *v) {\n  /* primaryexp ->\n        prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */\n  FuncState *fs = ls->fs;\n  prefixexp(ls, v);\n  for (;;) {\n    switch (ls->t.token) {\n      case '.': {  /* field */\n        field(ls, v);\n        break;\n      }\n      case '[': {  /* `[' exp1 `]' */\n        expdesc key;\n        luaK_exp2anyreg(fs, v);\n        yindex(ls, &key);\n        luaK_indexed(fs, v, &key);\n        break;\n      }\n      case ':': {  /* `:' NAME funcargs */\n        expdesc key;\n        luaX_next(ls);\n        checkname(ls, &key);\n        luaK_self(fs, v, &key);\n        funcargs(ls, v);\n        break;\n      }\n      case '(': case TK_STRING: case '{': {  /* funcargs */\n        luaK_exp2nextreg(fs, v);\n        funcargs(ls, v);\n        break;\n      }\n      default: return;\n    }\n  }\n}\n\n\nstatic void simpleexp (LexState *ls, expdesc *v) {\n  /* simpleexp -> NUMBER | STRING | NIL | true | false | ... |\n                  constructor | FUNCTION body | primaryexp */\n  switch (ls->t.token) {\n    case TK_NUMBER: {\n      init_exp(v, VKNUM, 0);\n      v->u.nval = ls->t.seminfo.r;\n      break;\n    }\n    case TK_STRING: {\n      codestring(ls, v, ls->t.seminfo.ts);\n      break;\n    }\n    case TK_NIL: {\n      init_exp(v, VNIL, 0);\n      break;\n    }\n    case TK_TRUE: {\n      init_exp(v, VTRUE, 0);\n      break;\n    }\n    case TK_FALSE: {\n      init_exp(v, VFALSE, 0);\n      break;\n    }\n    case TK_DOTS: {  /* vararg */\n      FuncState *fs = ls->fs;\n      check_condition(ls, fs->f->is_vararg,\n                      \"cannot use \" LUA_QL(\"...\") \" outside a vararg function\");\n      fs->f->is_vararg &= ~VARARG_NEEDSARG;  /* don't need 'arg' */\n      init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0));\n      break;\n    }\n    case '{': {  /* constructor */\n      constructor(ls, v);\n      return;\n    }\n    case TK_FUNCTION: {\n      luaX_next(ls);\n      body(ls, v, 0, ls->linenumber);\n      return;\n    }\n    default: {\n      primaryexp(ls, v);\n      return;\n    }\n  }\n  luaX_next(ls);\n}\n\n\nstatic UnOpr getunopr (int op) {\n  switch (op) {\n    case TK_NOT: return OPR_NOT;\n    case '-': return OPR_MINUS;\n    case '#': return OPR_LEN;\n    default: return OPR_NOUNOPR;\n  }\n}\n\n\nstatic BinOpr getbinopr (int op) {\n  switch (op) {\n    case '+': return OPR_ADD;\n    case '-': return OPR_SUB;\n    case '*': return OPR_MUL;\n    case '/': return OPR_DIV;\n    case '%': return OPR_MOD;\n    case '^': return OPR_POW;\n    case TK_CONCAT: return OPR_CONCAT;\n    case TK_NE: return OPR_NE;\n    case TK_EQ: return OPR_EQ;\n    case '<': return OPR_LT;\n    case TK_LE: return OPR_LE;\n    case '>': return OPR_GT;\n    case TK_GE: return OPR_GE;\n    case TK_AND: return OPR_AND;\n    case TK_OR: return OPR_OR;\n    default: return OPR_NOBINOPR;\n  }\n}\n\n\nstatic const struct {\n  lu_byte left;  /* left priority for each binary operator */\n  lu_byte right; /* right priority */\n} priority[] = {  /* ORDER OPR */\n   {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7},  /* `+' `-' `/' `%' */\n   {10, 9}, {5, 4},                 /* power and concat (right associative) */\n   {3, 3}, {3, 3},                  /* equality and inequality */\n   {3, 3}, {3, 3}, {3, 3}, {3, 3},  /* order */\n   {2, 2}, {1, 1}                   /* logical (and/or) */\n};\n\n#define UNARY_PRIORITY\t8  /* priority for unary operators */\n\n\n/*\n** subexpr -> (simpleexp | unop subexpr) { binop subexpr }\n** where `binop' is any binary operator with a priority higher than `limit'\n*/\nstatic BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) {\n  BinOpr op;\n  UnOpr uop;\n  enterlevel(ls);\n  uop = getunopr(ls->t.token);\n  if (uop != OPR_NOUNOPR) {\n    luaX_next(ls);\n    subexpr(ls, v, UNARY_PRIORITY);\n    luaK_prefix(ls->fs, uop, v);\n  }\n  else simpleexp(ls, v);\n  /* expand while operators have priorities higher than `limit' */\n  op = getbinopr(ls->t.token);\n  while (op != OPR_NOBINOPR && priority[op].left > limit) {\n    expdesc v2;\n    BinOpr nextop;\n    luaX_next(ls);\n    luaK_infix(ls->fs, op, v);\n    /* read sub-expression with higher priority */\n    nextop = subexpr(ls, &v2, priority[op].right);\n    luaK_posfix(ls->fs, op, v, &v2);\n    op = nextop;\n  }\n  leavelevel(ls);\n  return op;  /* return first untreated operator */\n}\n\n\nstatic void expr (LexState *ls, expdesc *v) {\n  subexpr(ls, v, 0);\n}\n\n/* }==================================================================== */\n\n\n\n/*\n** {======================================================================\n** Rules for Statements\n** =======================================================================\n*/\n\n\nstatic int block_follow (int token) {\n  switch (token) {\n    case TK_ELSE: case TK_ELSEIF: case TK_END:\n    case TK_UNTIL: case TK_EOS:\n      return 1;\n    default: return 0;\n  }\n}\n\n\nstatic void block (LexState *ls) {\n  /* block -> chunk */\n  FuncState *fs = ls->fs;\n  BlockCnt bl;\n  enterblock(fs, &bl, 0);\n  chunk(ls);\n  lua_assert(bl.breaklist == NO_JUMP);\n  leaveblock(fs);\n}\n\n\n/*\n** structure to chain all variables in the left-hand side of an\n** assignment\n*/\nstruct LHS_assign {\n  struct LHS_assign *prev;\n  expdesc v;  /* variable (global, local, upvalue, or indexed) */\n};\n\n\n/*\n** check whether, in an assignment to a local variable, the local variable\n** is needed in a previous assignment (to a table). If so, save original\n** local value in a safe place and use this safe copy in the previous\n** assignment.\n*/\nstatic void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) {\n  FuncState *fs = ls->fs;\n  int extra = fs->freereg;  /* eventual position to save local variable */\n  int conflict = 0;\n  for (; lh; lh = lh->prev) {\n    if (lh->v.k == VINDEXED) {\n      if (lh->v.u.s.info == v->u.s.info) {  /* conflict? */\n        conflict = 1;\n        lh->v.u.s.info = extra;  /* previous assignment will use safe copy */\n      }\n      if (lh->v.u.s.aux == v->u.s.info) {  /* conflict? */\n        conflict = 1;\n        lh->v.u.s.aux = extra;  /* previous assignment will use safe copy */\n      }\n    }\n  }\n  if (conflict) {\n    luaK_codeABC(fs, OP_MOVE, fs->freereg, v->u.s.info, 0);  /* make copy */\n    luaK_reserveregs(fs, 1);\n  }\n}\n\n\nstatic void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {\n  expdesc e;\n  check_condition(ls, VLOCAL <= lh->v.k && lh->v.k <= VINDEXED,\n                      \"syntax error\");\n  if (testnext(ls, ',')) {  /* assignment -> `,' primaryexp assignment */\n    struct LHS_assign nv;\n    nv.prev = lh;\n    primaryexp(ls, &nv.v);\n    if (nv.v.k == VLOCAL)\n      check_conflict(ls, lh, &nv.v);\n    luaY_checklimit(ls->fs, nvars, LUAI_MAXCCALLS - ls->L->nCcalls,\n                    \"variables in assignment\");\n    assignment(ls, &nv, nvars+1);\n  }\n  else {  /* assignment -> `=' explist1 */\n    int nexps;\n    checknext(ls, '=');\n    nexps = explist1(ls, &e);\n    if (nexps != nvars) {\n      adjust_assign(ls, nvars, nexps, &e);\n      if (nexps > nvars)\n        ls->fs->freereg -= nexps - nvars;  /* remove extra values */\n    }\n    else {\n      luaK_setoneret(ls->fs, &e);  /* close last expression */\n      luaK_storevar(ls->fs, &lh->v, &e);\n      return;  /* avoid default */\n    }\n  }\n  init_exp(&e, VNONRELOC, ls->fs->freereg-1);  /* default assignment */\n  luaK_storevar(ls->fs, &lh->v, &e);\n}\n\n\nstatic int cond (LexState *ls) {\n  /* cond -> exp */\n  expdesc v;\n  expr(ls, &v);  /* read condition */\n  if (v.k == VNIL) v.k = VFALSE;  /* `falses' are all equal here */\n  luaK_goiftrue(ls->fs, &v);\n  return v.f;\n}\n\n\nstatic void breakstat (LexState *ls) {\n  FuncState *fs = ls->fs;\n  BlockCnt *bl = fs->bl;\n  int upval = 0;\n  while (bl && !bl->isbreakable) {\n    upval |= bl->upval;\n    bl = bl->previous;\n  }\n  if (!bl)\n    luaX_syntaxerror(ls, \"no loop to break\");\n  if (upval)\n    luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0);\n  luaK_concat(fs, &bl->breaklist, luaK_jump(fs));\n}\n\n\nstatic void whilestat (LexState *ls, int line) {\n  /* whilestat -> WHILE cond DO block END */\n  FuncState *fs = ls->fs;\n  int whileinit;\n  int condexit;\n  BlockCnt bl;\n  luaX_next(ls);  /* skip WHILE */\n  whileinit = luaK_getlabel(fs);\n  condexit = cond(ls);\n  enterblock(fs, &bl, 1);\n  checknext(ls, TK_DO);\n  block(ls);\n  luaK_patchlist(fs, luaK_jump(fs), whileinit);\n  check_match(ls, TK_END, TK_WHILE, line);\n  leaveblock(fs);\n  luaK_patchtohere(fs, condexit);  /* false conditions finish the loop */\n}\n\n\nstatic void repeatstat (LexState *ls, int line) {\n  /* repeatstat -> REPEAT block UNTIL cond */\n  int condexit;\n  FuncState *fs = ls->fs;\n  int repeat_init = luaK_getlabel(fs);\n  BlockCnt bl1, bl2;\n  enterblock(fs, &bl1, 1);  /* loop block */\n  enterblock(fs, &bl2, 0);  /* scope block */\n  luaX_next(ls);  /* skip REPEAT */\n  chunk(ls);\n  check_match(ls, TK_UNTIL, TK_REPEAT, line);\n  condexit = cond(ls);  /* read condition (inside scope block) */\n  if (!bl2.upval) {  /* no upvalues? */\n    leaveblock(fs);  /* finish scope */\n    luaK_patchlist(ls->fs, condexit, repeat_init);  /* close the loop */\n  }\n  else {  /* complete semantics when there are upvalues */\n    breakstat(ls);  /* if condition then break */\n    luaK_patchtohere(ls->fs, condexit);  /* else... */\n    leaveblock(fs);  /* finish scope... */\n    luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init);  /* and repeat */\n  }\n  leaveblock(fs);  /* finish loop */\n}\n\n\nstatic int exp1 (LexState *ls) {\n  expdesc e;\n  int k;\n  expr(ls, &e);\n  k = e.k;\n  luaK_exp2nextreg(ls->fs, &e);\n  return k;\n}\n\n\nstatic void forbody (LexState *ls, int base, int line, int nvars, int isnum) {\n  /* forbody -> DO block */\n  BlockCnt bl;\n  FuncState *fs = ls->fs;\n  int prep, endfor;\n  adjustlocalvars(ls, 3);  /* control variables */\n  checknext(ls, TK_DO);\n  prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs);\n  enterblock(fs, &bl, 0);  /* scope for declared variables */\n  adjustlocalvars(ls, nvars);\n  luaK_reserveregs(fs, nvars);\n  block(ls);\n  leaveblock(fs);  /* end of scope for declared variables */\n  luaK_patchtohere(fs, prep);\n  endfor = (isnum) ? luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP) :\n                     luaK_codeABC(fs, OP_TFORLOOP, base, 0, nvars);\n  luaK_fixline(fs, line);  /* pretend that `OP_FOR' starts the loop */\n  luaK_patchlist(fs, (isnum ? endfor : luaK_jump(fs)), prep + 1);\n}\n\n\nstatic void fornum (LexState *ls, TString *varname, int line) {\n  /* fornum -> NAME = exp1,exp1[,exp1] forbody */\n  FuncState *fs = ls->fs;\n  int base = fs->freereg;\n  new_localvarliteral(ls, \"(for index)\", 0);\n  new_localvarliteral(ls, \"(for limit)\", 1);\n  new_localvarliteral(ls, \"(for step)\", 2);\n  new_localvar(ls, varname, 3);\n  checknext(ls, '=');\n  exp1(ls);  /* initial value */\n  checknext(ls, ',');\n  exp1(ls);  /* limit */\n  if (testnext(ls, ','))\n    exp1(ls);  /* optional step */\n  else {  /* default step = 1 */\n    luaK_codeABx(fs, OP_LOADK, fs->freereg, luaK_numberK(fs, 1));\n    luaK_reserveregs(fs, 1);\n  }\n  forbody(ls, base, line, 1, 1);\n}\n\n\nstatic void forlist (LexState *ls, TString *indexname) {\n  /* forlist -> NAME {,NAME} IN explist1 forbody */\n  FuncState *fs = ls->fs;\n  expdesc e;\n  int nvars = 0;\n  int line;\n  int base = fs->freereg;\n  /* create control variables */\n  new_localvarliteral(ls, \"(for generator)\", nvars++);\n  new_localvarliteral(ls, \"(for state)\", nvars++);\n  new_localvarliteral(ls, \"(for control)\", nvars++);\n  /* create declared variables */\n  new_localvar(ls, indexname, nvars++);\n  while (testnext(ls, ','))\n    new_localvar(ls, str_checkname(ls), nvars++);\n  checknext(ls, TK_IN);\n  line = ls->linenumber;\n  adjust_assign(ls, 3, explist1(ls, &e), &e);\n  luaK_checkstack(fs, 3);  /* extra space to call generator */\n  forbody(ls, base, line, nvars - 3, 0);\n}\n\n\nstatic void forstat (LexState *ls, int line) {\n  /* forstat -> FOR (fornum | forlist) END */\n  FuncState *fs = ls->fs;\n  TString *varname;\n  BlockCnt bl;\n  enterblock(fs, &bl, 1);  /* scope for loop and control variables */\n  luaX_next(ls);  /* skip `for' */\n  varname = str_checkname(ls);  /* first variable name */\n  switch (ls->t.token) {\n    case '=': fornum(ls, varname, line); break;\n    case ',': case TK_IN: forlist(ls, varname); break;\n    default: luaX_syntaxerror(ls, LUA_QL(\"=\") \" or \" LUA_QL(\"in\") \" expected\");\n  }\n  check_match(ls, TK_END, TK_FOR, line);\n  leaveblock(fs);  /* loop scope (`break' jumps to this point) */\n}\n\n\nstatic int test_then_block (LexState *ls) {\n  /* test_then_block -> [IF | ELSEIF] cond THEN block */\n  int condexit;\n  luaX_next(ls);  /* skip IF or ELSEIF */\n  condexit = cond(ls);\n  checknext(ls, TK_THEN);\n  block(ls);  /* `then' part */\n  return condexit;\n}\n\n\nstatic void ifstat (LexState *ls, int line) {\n  /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */\n  FuncState *fs = ls->fs;\n  int flist;\n  int escapelist = NO_JUMP;\n  flist = test_then_block(ls);  /* IF cond THEN block */\n  while (ls->t.token == TK_ELSEIF) {\n    luaK_concat(fs, &escapelist, luaK_jump(fs));\n    luaK_patchtohere(fs, flist);\n    flist = test_then_block(ls);  /* ELSEIF cond THEN block */\n  }\n  if (ls->t.token == TK_ELSE) {\n    luaK_concat(fs, &escapelist, luaK_jump(fs));\n    luaK_patchtohere(fs, flist);\n    luaX_next(ls);  /* skip ELSE (after patch, for correct line info) */\n    block(ls);  /* `else' part */\n  }\n  else\n    luaK_concat(fs, &escapelist, flist);\n  luaK_patchtohere(fs, escapelist);\n  check_match(ls, TK_END, TK_IF, line);\n}\n\n\nstatic void localfunc (LexState *ls) {\n  expdesc v, b;\n  FuncState *fs = ls->fs;\n  new_localvar(ls, str_checkname(ls), 0);\n  init_exp(&v, VLOCAL, fs->freereg);\n  luaK_reserveregs(fs, 1);\n  adjustlocalvars(ls, 1);\n  body(ls, &b, 0, ls->linenumber);\n  luaK_storevar(fs, &v, &b);\n  /* debug information will only see the variable after this point! */\n  getlocvar(fs, fs->nactvar - 1).startpc = fs->pc;\n}\n\n\nstatic void localstat (LexState *ls) {\n  /* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */\n  int nvars = 0;\n  int nexps;\n  expdesc e;\n  do {\n    new_localvar(ls, str_checkname(ls), nvars++);\n  } while (testnext(ls, ','));\n  if (testnext(ls, '='))\n    nexps = explist1(ls, &e);\n  else {\n    e.k = VVOID;\n    nexps = 0;\n  }\n  adjust_assign(ls, nvars, nexps, &e);\n  adjustlocalvars(ls, nvars);\n}\n\n\nstatic int funcname (LexState *ls, expdesc *v) {\n  /* funcname -> NAME {field} [`:' NAME] */\n  int needself = 0;\n  singlevar(ls, v);\n  while (ls->t.token == '.')\n    field(ls, v);\n  if (ls->t.token == ':') {\n    needself = 1;\n    field(ls, v);\n  }\n  return needself;\n}\n\n\nstatic void funcstat (LexState *ls, int line) {\n  /* funcstat -> FUNCTION funcname body */\n  int needself;\n  expdesc v, b;\n  luaX_next(ls);  /* skip FUNCTION */\n  needself = funcname(ls, &v);\n  body(ls, &b, needself, line);\n  luaK_storevar(ls->fs, &v, &b);\n  luaK_fixline(ls->fs, line);  /* definition `happens' in the first line */\n}\n\n\nstatic void exprstat (LexState *ls) {\n  /* stat -> func | assignment */\n  FuncState *fs = ls->fs;\n  struct LHS_assign v;\n  primaryexp(ls, &v.v);\n  if (v.v.k == VCALL)  /* stat -> func */\n    SETARG_C(getcode(fs, &v.v), 1);  /* call statement uses no results */\n  else {  /* stat -> assignment */\n    v.prev = NULL;\n    assignment(ls, &v, 1);\n  }\n}\n\n\nstatic void retstat (LexState *ls) {\n  /* stat -> RETURN explist */\n  FuncState *fs = ls->fs;\n  expdesc e;\n  int first, nret;  /* registers with returned values */\n  luaX_next(ls);  /* skip RETURN */\n  if (block_follow(ls->t.token) || ls->t.token == ';')\n    first = nret = 0;  /* return no values */\n  else {\n    nret = explist1(ls, &e);  /* optional return values */\n    if (hasmultret(e.k)) {\n      luaK_setmultret(fs, &e);\n      if (e.k == VCALL && nret == 1) {  /* tail call? */\n        SET_OPCODE(getcode(fs,&e), OP_TAILCALL);\n        lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar);\n      }\n      first = fs->nactvar;\n      nret = LUA_MULTRET;  /* return all values */\n    }\n    else {\n      if (nret == 1)  /* only one single value? */\n        first = luaK_exp2anyreg(fs, &e);\n      else {\n        luaK_exp2nextreg(fs, &e);  /* values must go to the `stack' */\n        first = fs->nactvar;  /* return all `active' values */\n        lua_assert(nret == fs->freereg - first);\n      }\n    }\n  }\n  luaK_ret(fs, first, nret);\n}\n\n\nstatic int statement (LexState *ls) {\n  int line = ls->linenumber;  /* may be needed for error messages */\n  switch (ls->t.token) {\n    case TK_IF: {  /* stat -> ifstat */\n      ifstat(ls, line);\n      return 0;\n    }\n    case TK_WHILE: {  /* stat -> whilestat */\n      whilestat(ls, line);\n      return 0;\n    }\n    case TK_DO: {  /* stat -> DO block END */\n      luaX_next(ls);  /* skip DO */\n      block(ls);\n      check_match(ls, TK_END, TK_DO, line);\n      return 0;\n    }\n    case TK_FOR: {  /* stat -> forstat */\n      forstat(ls, line);\n      return 0;\n    }\n    case TK_REPEAT: {  /* stat -> repeatstat */\n      repeatstat(ls, line);\n      return 0;\n    }\n    case TK_FUNCTION: {\n      funcstat(ls, line);  /* stat -> funcstat */\n      return 0;\n    }\n    case TK_LOCAL: {  /* stat -> localstat */\n      luaX_next(ls);  /* skip LOCAL */\n      if (testnext(ls, TK_FUNCTION))  /* local function? */\n        localfunc(ls);\n      else\n        localstat(ls);\n      return 0;\n    }\n    case TK_RETURN: {  /* stat -> retstat */\n      retstat(ls);\n      return 1;  /* must be last statement */\n    }\n    case TK_BREAK: {  /* stat -> breakstat */\n      luaX_next(ls);  /* skip BREAK */\n      breakstat(ls);\n      return 1;  /* must be last statement */\n    }\n    default: {\n      exprstat(ls);\n      return 0;  /* to avoid warnings */\n    }\n  }\n}\n\n\nstatic void chunk (LexState *ls) {\n  /* chunk -> { stat [`;'] } */\n  int islast = 0;\n  enterlevel(ls);\n  while (!islast && !block_follow(ls->t.token)) {\n    islast = statement(ls);\n    testnext(ls, ';');\n    lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg &&\n               ls->fs->freereg >= ls->fs->nactvar);\n    ls->fs->freereg = ls->fs->nactvar;  /* free registers */\n  }\n  leavelevel(ls);\n}\n\n/* }====================================================================== */\n"
  },
  {
    "path": "jni/lua/lparser.h",
    "content": "/*\n** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $\n** Lua Parser\n** See Copyright Notice in lua.h\n*/\n\n#ifndef lparser_h\n#define lparser_h\n\n#include \"llimits.h\"\n#include \"lobject.h\"\n#include \"lzio.h\"\n\n\n/*\n** Expression descriptor\n*/\n\ntypedef enum {\n  VVOID,\t/* no value */\n  VNIL,\n  VTRUE,\n  VFALSE,\n  VK,\t\t/* info = index of constant in `k' */\n  VKNUM,\t/* nval = numerical value */\n  VLOCAL,\t/* info = local register */\n  VUPVAL,       /* info = index of upvalue in `upvalues' */\n  VGLOBAL,\t/* info = index of table; aux = index of global name in `k' */\n  VINDEXED,\t/* info = table register; aux = index register (or `k') */\n  VJMP,\t\t/* info = instruction pc */\n  VRELOCABLE,\t/* info = instruction pc */\n  VNONRELOC,\t/* info = result register */\n  VCALL,\t/* info = instruction pc */\n  VVARARG\t/* info = instruction pc */\n} expkind;\n\ntypedef struct expdesc {\n  expkind k;\n  union {\n    struct { int info, aux; } s;\n    lua_Number nval;\n  } u;\n  int t;  /* patch list of `exit when true' */\n  int f;  /* patch list of `exit when false' */\n} expdesc;\n\n\ntypedef struct upvaldesc {\n  lu_byte k;\n  lu_byte info;\n} upvaldesc;\n\n\nstruct BlockCnt;  /* defined in lparser.c */\n\n\n/* state needed to generate code for a given function */\ntypedef struct FuncState {\n  Proto *f;  /* current function header */\n  Table *h;  /* table to find (and reuse) elements in `k' */\n  struct FuncState *prev;  /* enclosing function */\n  struct LexState *ls;  /* lexical state */\n  struct lua_State *L;  /* copy of the Lua state */\n  struct BlockCnt *bl;  /* chain of current blocks */\n  int pc;  /* next position to code (equivalent to `ncode') */\n  int lasttarget;   /* `pc' of last `jump target' */\n  int jpc;  /* list of pending jumps to `pc' */\n  int freereg;  /* first free register */\n  int nk;  /* number of elements in `k' */\n  int np;  /* number of elements in `p' */\n  short nlocvars;  /* number of elements in `locvars' */\n  lu_byte nactvar;  /* number of active local variables */\n  upvaldesc upvalues[LUAI_MAXUPVALUES];  /* upvalues */\n  unsigned short actvar[LUAI_MAXVARS];  /* declared-variable stack */\n} FuncState;\n\n\nLUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,\n                                            const char *name);\n\n\n#endif\n"
  },
  {
    "path": "jni/lua/lstate.c",
    "content": "/*\n** $Id: lstate.c,v 2.36.1.2 2008/01/03 15:20:39 roberto Exp $\n** Global State\n** See Copyright Notice in lua.h\n*/\n\n\n#include <stddef.h>\n\n#define lstate_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"ldebug.h\"\n#include \"ldo.h\"\n#include \"lfunc.h\"\n#include \"lgc.h\"\n#include \"llex.h\"\n#include \"lmem.h\"\n#include \"lstate.h\"\n#include \"lstring.h\"\n#include \"ltable.h\"\n#include \"ltm.h\"\n\n\n#define state_size(x)\t(sizeof(x) + LUAI_EXTRASPACE)\n#define fromstate(l)\t(cast(lu_byte *, (l)) - LUAI_EXTRASPACE)\n#define tostate(l)   (cast(lua_State *, cast(lu_byte *, l) + LUAI_EXTRASPACE))\n\n\n/*\n** Main thread combines a thread state and the global state\n*/\ntypedef struct LG {\n  lua_State l;\n  global_State g;\n} LG;\n  \n\n\nstatic void stack_init (lua_State *L1, lua_State *L) {\n  /* initialize CallInfo array */\n  L1->base_ci = luaM_newvector(L, BASIC_CI_SIZE, CallInfo);\n  L1->ci = L1->base_ci;\n  L1->size_ci = BASIC_CI_SIZE;\n  L1->end_ci = L1->base_ci + L1->size_ci - 1;\n  /* initialize stack array */\n  L1->stack = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, TValue);\n  L1->stacksize = BASIC_STACK_SIZE + EXTRA_STACK;\n  L1->top = L1->stack;\n  L1->stack_last = L1->stack+(L1->stacksize - EXTRA_STACK)-1;\n  /* initialize first ci */\n  L1->ci->func = L1->top;\n  setnilvalue(L1->top++);  /* `function' entry for this `ci' */\n  L1->base = L1->ci->base = L1->top;\n  L1->ci->top = L1->top + LUA_MINSTACK;\n}\n\n\nstatic void freestack (lua_State *L, lua_State *L1) {\n  luaM_freearray(L, L1->base_ci, L1->size_ci, CallInfo);\n  luaM_freearray(L, L1->stack, L1->stacksize, TValue);\n}\n\n\n/*\n** open parts that may cause memory-allocation errors\n*/\nstatic void f_luaopen (lua_State *L, void *ud) {\n  global_State *g = G(L);\n  UNUSED(ud);\n  stack_init(L, L);  /* init stack */\n  sethvalue(L, gt(L), luaH_new(L, 0, 2));  /* table of globals */\n  sethvalue(L, registry(L), luaH_new(L, 0, 2));  /* registry */\n  luaS_resize(L, MINSTRTABSIZE);  /* initial size of string table */\n  luaT_init(L);\n  luaX_init(L);\n  luaS_fix(luaS_newliteral(L, MEMERRMSG));\n  g->GCthreshold = 4*g->totalbytes;\n}\n\n\nstatic void preinit_state (lua_State *L, global_State *g) {\n  G(L) = g;\n  L->stack = NULL;\n  L->stacksize = 0;\n  L->errorJmp = NULL;\n  L->hook = NULL;\n  L->hookmask = 0;\n  L->basehookcount = 0;\n  L->allowhook = 1;\n  resethookcount(L);\n  L->openupval = NULL;\n  L->size_ci = 0;\n  L->nCcalls = L->baseCcalls = 0;\n  L->status = 0;\n  L->base_ci = L->ci = NULL;\n  L->savedpc = NULL;\n  L->errfunc = 0;\n  setnilvalue(gt(L));\n}\n\n\nstatic void close_state (lua_State *L) {\n  global_State *g = G(L);\n  luaF_close(L, L->stack);  /* close all upvalues for this thread */\n  luaC_freeall(L);  /* collect all objects */\n  lua_assert(g->rootgc == obj2gco(L));\n  lua_assert(g->strt.nuse == 0);\n  luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size, TString *);\n  luaZ_freebuffer(L, &g->buff);\n  freestack(L, L);\n  lua_assert(g->totalbytes == sizeof(LG));\n  (*g->frealloc)(g->ud, fromstate(L), state_size(LG), 0);\n}\n\n\nlua_State *luaE_newthread (lua_State *L) {\n  lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State)));\n  luaC_link(L, obj2gco(L1), LUA_TTHREAD);\n  preinit_state(L1, G(L));\n  stack_init(L1, L);  /* init stack */\n  setobj2n(L, gt(L1), gt(L));  /* share table of globals */\n  L1->hookmask = L->hookmask;\n  L1->basehookcount = L->basehookcount;\n  L1->hook = L->hook;\n  resethookcount(L1);\n  lua_assert(iswhite(obj2gco(L1)));\n  return L1;\n}\n\n\nvoid luaE_freethread (lua_State *L, lua_State *L1) {\n  luaF_close(L1, L1->stack);  /* close all upvalues for this thread */\n  lua_assert(L1->openupval == NULL);\n  luai_userstatefree(L1);\n  freestack(L, L1);\n  luaM_freemem(L, fromstate(L1), state_size(lua_State));\n}\n\n\nLUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {\n  int i;\n  lua_State *L;\n  global_State *g;\n  void *l = (*f)(ud, NULL, 0, state_size(LG));\n  if (l == NULL) return NULL;\n  L = tostate(l);\n  g = &((LG *)L)->g;\n  L->next = NULL;\n  L->tt = LUA_TTHREAD;\n  g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT);\n  L->marked = luaC_white(g);\n  set2bits(L->marked, FIXEDBIT, SFIXEDBIT);\n  preinit_state(L, g);\n  g->frealloc = f;\n  g->ud = ud;\n  g->mainthread = L;\n  g->uvhead.u.l.prev = &g->uvhead;\n  g->uvhead.u.l.next = &g->uvhead;\n  g->GCthreshold = 0;  /* mark it as unfinished state */\n  g->strt.size = 0;\n  g->strt.nuse = 0;\n  g->strt.hash = NULL;\n  setnilvalue(registry(L));\n  luaZ_initbuffer(L, &g->buff);\n  g->panic = NULL;\n  g->gcstate = GCSpause;\n  g->rootgc = obj2gco(L);\n  g->sweepstrgc = 0;\n  g->sweepgc = &g->rootgc;\n  g->gray = NULL;\n  g->grayagain = NULL;\n  g->weak = NULL;\n  g->tmudata = NULL;\n  g->totalbytes = sizeof(LG);\n  g->gcpause = LUAI_GCPAUSE;\n  g->gcstepmul = LUAI_GCMUL;\n  g->gcdept = 0;\n  for (i=0; i<NUM_TAGS; i++) g->mt[i] = NULL;\n  if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) {\n    /* memory allocation error: free partial state */\n    close_state(L);\n    L = NULL;\n  }\n  else\n    luai_userstateopen(L);\n  return L;\n}\n\n\nstatic void callallgcTM (lua_State *L, void *ud) {\n  UNUSED(ud);\n  luaC_callGCTM(L);  /* call GC metamethods for all udata */\n}\n\n\nLUA_API void lua_close (lua_State *L) {\n  L = G(L)->mainthread;  /* only the main thread can be closed */\n  lua_lock(L);\n  luaF_close(L, L->stack);  /* close all upvalues for this thread */\n  luaC_separateudata(L, 1);  /* separate udata that have GC metamethods */\n  L->errfunc = 0;  /* no error function during GC metamethods */\n  do {  /* repeat until no more errors */\n    L->ci = L->base_ci;\n    L->base = L->top = L->ci->base;\n    L->nCcalls = L->baseCcalls = 0;\n  } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0);\n  lua_assert(G(L)->tmudata == NULL);\n  luai_userstateclose(L);\n  close_state(L);\n}\n\n"
  },
  {
    "path": "jni/lua/lstate.h",
    "content": "/*\n** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $\n** Global State\n** See Copyright Notice in lua.h\n*/\n\n#ifndef lstate_h\n#define lstate_h\n\n#include \"lua.h\"\n\n#include \"lobject.h\"\n#include \"ltm.h\"\n#include \"lzio.h\"\n\n\n\nstruct lua_longjmp;  /* defined in ldo.c */\n\n\n/* table of globals */\n#define gt(L)\t(&L->l_gt)\n\n/* registry */\n#define registry(L)\t(&G(L)->l_registry)\n\n\n/* extra stack space to handle TM calls and some other extras */\n#define EXTRA_STACK   5\n\n\n#define BASIC_CI_SIZE           8\n\n#define BASIC_STACK_SIZE        (2*LUA_MINSTACK)\n\n\n\ntypedef struct stringtable {\n  GCObject **hash;\n  lu_int32 nuse;  /* number of elements */\n  int size;\n} stringtable;\n\n\n/*\n** informations about a call\n*/\ntypedef struct CallInfo {\n  StkId base;  /* base for this function */\n  StkId func;  /* function index in the stack */\n  StkId\ttop;  /* top for this function */\n  const Instruction *savedpc;\n  int nresults;  /* expected number of results from this function */\n  int tailcalls;  /* number of tail calls lost under this entry */\n} CallInfo;\n\n\n\n#define curr_func(L)\t(clvalue(L->ci->func))\n#define ci_func(ci)\t(clvalue((ci)->func))\n#define f_isLua(ci)\t(!ci_func(ci)->c.isC)\n#define isLua(ci)\t(ttisfunction((ci)->func) && f_isLua(ci))\n\n\n/*\n** `global state', shared by all threads of this state\n*/\ntypedef struct global_State {\n  stringtable strt;  /* hash table for strings */\n  lua_Alloc frealloc;  /* function to reallocate memory */\n  void *ud;         /* auxiliary data to `frealloc' */\n  lu_byte currentwhite;\n  lu_byte gcstate;  /* state of garbage collector */\n  int sweepstrgc;  /* position of sweep in `strt' */\n  GCObject *rootgc;  /* list of all collectable objects */\n  GCObject **sweepgc;  /* position of sweep in `rootgc' */\n  GCObject *gray;  /* list of gray objects */\n  GCObject *grayagain;  /* list of objects to be traversed atomically */\n  GCObject *weak;  /* list of weak tables (to be cleared) */\n  GCObject *tmudata;  /* last element of list of userdata to be GC */\n  Mbuffer buff;  /* temporary buffer for string concatentation */\n  lu_mem GCthreshold;\n  lu_mem totalbytes;  /* number of bytes currently allocated */\n  lu_mem estimate;  /* an estimate of number of bytes actually in use */\n  lu_mem gcdept;  /* how much GC is `behind schedule' */\n  int gcpause;  /* size of pause between successive GCs */\n  int gcstepmul;  /* GC `granularity' */\n  lua_CFunction panic;  /* to be called in unprotected errors */\n  TValue l_registry;\n  struct lua_State *mainthread;\n  UpVal uvhead;  /* head of double-linked list of all open upvalues */\n  struct Table *mt[NUM_TAGS];  /* metatables for basic types */\n  TString *tmname[TM_N];  /* array with tag-method names */\n} global_State;\n\n\n/*\n** `per thread' state\n*/\nstruct lua_State {\n  CommonHeader;\n  lu_byte status;\n  StkId top;  /* first free slot in the stack */\n  StkId base;  /* base of current function */\n  global_State *l_G;\n  CallInfo *ci;  /* call info for current function */\n  const Instruction *savedpc;  /* `savedpc' of current function */\n  StkId stack_last;  /* last free slot in the stack */\n  StkId stack;  /* stack base */\n  CallInfo *end_ci;  /* points after end of ci array*/\n  CallInfo *base_ci;  /* array of CallInfo's */\n  int stacksize;\n  int size_ci;  /* size of array `base_ci' */\n  unsigned short nCcalls;  /* number of nested C calls */\n  unsigned short baseCcalls;  /* nested C calls when resuming coroutine */\n  lu_byte hookmask;\n  lu_byte allowhook;\n  int basehookcount;\n  int hookcount;\n  lua_Hook hook;\n  TValue l_gt;  /* table of globals */\n  TValue env;  /* temporary place for environments */\n  GCObject *openupval;  /* list of open upvalues in this stack */\n  GCObject *gclist;\n  struct lua_longjmp *errorJmp;  /* current error recover point */\n  ptrdiff_t errfunc;  /* current error handling function (stack index) */\n};\n\n\n#define G(L)\t(L->l_G)\n\n\n/*\n** Union of all collectable objects\n*/\nunion GCObject {\n  GCheader gch;\n  union TString ts;\n  union Udata u;\n  union Closure cl;\n  struct Table h;\n  struct Proto p;\n  struct UpVal uv;\n  struct lua_State th;  /* thread */\n};\n\n\n/* macros to convert a GCObject into a specific value */\n#define rawgco2ts(o)\tcheck_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts))\n#define gco2ts(o)\t(&rawgco2ts(o)->tsv)\n#define rawgco2u(o)\tcheck_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u))\n#define gco2u(o)\t(&rawgco2u(o)->uv)\n#define gco2cl(o)\tcheck_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl))\n#define gco2h(o)\tcheck_exp((o)->gch.tt == LUA_TTABLE, &((o)->h))\n#define gco2p(o)\tcheck_exp((o)->gch.tt == LUA_TPROTO, &((o)->p))\n#define gco2uv(o)\tcheck_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv))\n#define ngcotouv(o) \\\n\tcheck_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv))\n#define gco2th(o)\tcheck_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th))\n\n/* macro to convert any Lua object into a GCObject */\n#define obj2gco(v)\t(cast(GCObject *, (v)))\n\n\nLUAI_FUNC lua_State *luaE_newthread (lua_State *L);\nLUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);\n\n#endif\n\n"
  },
  {
    "path": "jni/lua/lstring.c",
    "content": "/*\n** $Id: lstring.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $\n** String table (keeps all strings handled by Lua)\n** See Copyright Notice in lua.h\n*/\n\n\n#include <string.h>\n\n#define lstring_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"lmem.h\"\n#include \"lobject.h\"\n#include \"lstate.h\"\n#include \"lstring.h\"\n\n\n\nvoid luaS_resize (lua_State *L, int newsize) {\n  GCObject **newhash;\n  stringtable *tb;\n  int i;\n  if (G(L)->gcstate == GCSsweepstring)\n    return;  /* cannot resize during GC traverse */\n  newhash = luaM_newvector(L, newsize, GCObject *);\n  tb = &G(L)->strt;\n  for (i=0; i<newsize; i++) newhash[i] = NULL;\n  /* rehash */\n  for (i=0; i<tb->size; i++) {\n    GCObject *p = tb->hash[i];\n    while (p) {  /* for each node in the list */\n      GCObject *next = p->gch.next;  /* save next */\n      unsigned int h = gco2ts(p)->hash;\n      int h1 = lmod(h, newsize);  /* new position */\n      lua_assert(cast_int(h%newsize) == lmod(h, newsize));\n      p->gch.next = newhash[h1];  /* chain it */\n      newhash[h1] = p;\n      p = next;\n    }\n  }\n  luaM_freearray(L, tb->hash, tb->size, TString *);\n  tb->size = newsize;\n  tb->hash = newhash;\n}\n\n\nstatic TString *newlstr (lua_State *L, const char *str, size_t l,\n                                       unsigned int h) {\n  TString *ts;\n  stringtable *tb;\n  if (l+1 > (MAX_SIZET - sizeof(TString))/sizeof(char))\n    luaM_toobig(L);\n  ts = cast(TString *, luaM_malloc(L, (l+1)*sizeof(char)+sizeof(TString)));\n  ts->tsv.len = l;\n  ts->tsv.hash = h;\n  ts->tsv.marked = luaC_white(G(L));\n  ts->tsv.tt = LUA_TSTRING;\n  ts->tsv.reserved = 0;\n  memcpy(ts+1, str, l*sizeof(char));\n  ((char *)(ts+1))[l] = '\\0';  /* ending 0 */\n  tb = &G(L)->strt;\n  h = lmod(h, tb->size);\n  ts->tsv.next = tb->hash[h];  /* chain new entry */\n  tb->hash[h] = obj2gco(ts);\n  tb->nuse++;\n  if (tb->nuse > cast(lu_int32, tb->size) && tb->size <= MAX_INT/2)\n    luaS_resize(L, tb->size*2);  /* too crowded */\n  return ts;\n}\n\n\nTString *luaS_newlstr (lua_State *L, const char *str, size_t l) {\n  GCObject *o;\n  unsigned int h = cast(unsigned int, l);  /* seed */\n  size_t step = (l>>5)+1;  /* if string is too long, don't hash all its chars */\n  size_t l1;\n  for (l1=l; l1>=step; l1-=step)  /* compute hash */\n    h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1]));\n  for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)];\n       o != NULL;\n       o = o->gch.next) {\n    TString *ts = rawgco2ts(o);\n    if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) {\n      /* string may be dead */\n      if (isdead(G(L), o)) changewhite(o);\n      return ts;\n    }\n  }\n  return newlstr(L, str, l, h);  /* not found */\n}\n\n\nUdata *luaS_newudata (lua_State *L, size_t s, Table *e) {\n  Udata *u;\n  if (s > MAX_SIZET - sizeof(Udata))\n    luaM_toobig(L);\n  u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata)));\n  u->uv.marked = luaC_white(G(L));  /* is not finalized */\n  u->uv.tt = LUA_TUSERDATA;\n  u->uv.len = s;\n  u->uv.metatable = NULL;\n  u->uv.env = e;\n  /* chain it on udata list (after main thread) */\n  u->uv.next = G(L)->mainthread->next;\n  G(L)->mainthread->next = obj2gco(u);\n  return u;\n}\n\n"
  },
  {
    "path": "jni/lua/lstring.h",
    "content": "/*\n** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $\n** String table (keep all strings handled by Lua)\n** See Copyright Notice in lua.h\n*/\n\n#ifndef lstring_h\n#define lstring_h\n\n\n#include \"lgc.h\"\n#include \"lobject.h\"\n#include \"lstate.h\"\n\n\n#define sizestring(s)\t(sizeof(union TString)+((s)->len+1)*sizeof(char))\n\n#define sizeudata(u)\t(sizeof(union Udata)+(u)->len)\n\n#define luaS_new(L, s)\t(luaS_newlstr(L, s, strlen(s)))\n#define luaS_newliteral(L, s)\t(luaS_newlstr(L, \"\" s, \\\n                                 (sizeof(s)/sizeof(char))-1))\n\n#define luaS_fix(s)\tl_setbit((s)->tsv.marked, FIXEDBIT)\n\nLUAI_FUNC void luaS_resize (lua_State *L, int newsize);\nLUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);\nLUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);\n\n\n#endif\n"
  },
  {
    "path": "jni/lua/lstrlib.c",
    "content": "/*\n** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $\n** Standard library for string operations and pattern-matching\n** See Copyright Notice in lua.h\n*/\n\n\n#include <ctype.h>\n#include <stddef.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define lstrlib_c\n#define LUA_LIB\n\n#include \"lua.h\"\n\n#include \"lauxlib.h\"\n#include \"lualib.h\"\n\n\n/* macro to `unsign' a character */\n#define uchar(c)        ((unsigned char)(c))\n\n\n\nstatic int str_len (lua_State *L) {\n  size_t l;\n  luaL_checklstring(L, 1, &l);\n  lua_pushinteger(L, l);\n  return 1;\n}\n\n\nstatic ptrdiff_t posrelat (ptrdiff_t pos, size_t len) {\n  /* relative string position: negative means back from end */\n  if (pos < 0) pos += (ptrdiff_t)len + 1;\n  return (pos >= 0) ? pos : 0;\n}\n\n\nstatic int str_sub (lua_State *L) {\n  size_t l;\n  const char *s = luaL_checklstring(L, 1, &l);\n  ptrdiff_t start = posrelat(luaL_checkinteger(L, 2), l);\n  ptrdiff_t end = posrelat(luaL_optinteger(L, 3, -1), l);\n  if (start < 1) start = 1;\n  if (end > (ptrdiff_t)l) end = (ptrdiff_t)l;\n  if (start <= end)\n    lua_pushlstring(L, s+start-1, end-start+1);\n  else lua_pushliteral(L, \"\");\n  return 1;\n}\n\n\nstatic int str_reverse (lua_State *L) {\n  size_t l;\n  luaL_Buffer b;\n  const char *s = luaL_checklstring(L, 1, &l);\n  luaL_buffinit(L, &b);\n  while (l--) luaL_addchar(&b, s[l]);\n  luaL_pushresult(&b);\n  return 1;\n}\n\n\nstatic int str_lower (lua_State *L) {\n  size_t l;\n  size_t i;\n  luaL_Buffer b;\n  const char *s = luaL_checklstring(L, 1, &l);\n  luaL_buffinit(L, &b);\n  for (i=0; i<l; i++)\n    luaL_addchar(&b, tolower(uchar(s[i])));\n  luaL_pushresult(&b);\n  return 1;\n}\n\n\nstatic int str_upper (lua_State *L) {\n  size_t l;\n  size_t i;\n  luaL_Buffer b;\n  const char *s = luaL_checklstring(L, 1, &l);\n  luaL_buffinit(L, &b);\n  for (i=0; i<l; i++)\n    luaL_addchar(&b, toupper(uchar(s[i])));\n  luaL_pushresult(&b);\n  return 1;\n}\n\nstatic int str_rep (lua_State *L) {\n  size_t l;\n  luaL_Buffer b;\n  const char *s = luaL_checklstring(L, 1, &l);\n  int n = luaL_checkint(L, 2);\n  luaL_buffinit(L, &b);\n  while (n-- > 0)\n    luaL_addlstring(&b, s, l);\n  luaL_pushresult(&b);\n  return 1;\n}\n\n\nstatic int str_byte (lua_State *L) {\n  size_t l;\n  const char *s = luaL_checklstring(L, 1, &l);\n  ptrdiff_t posi = posrelat(luaL_optinteger(L, 2, 1), l);\n  ptrdiff_t pose = posrelat(luaL_optinteger(L, 3, posi), l);\n  int n, i;\n  if (posi <= 0) posi = 1;\n  if ((size_t)pose > l) pose = l;\n  if (posi > pose) return 0;  /* empty interval; return no values */\n  n = (int)(pose -  posi + 1);\n  if (posi + n <= pose)  /* overflow? */\n    luaL_error(L, \"string slice too long\");\n  luaL_checkstack(L, n, \"string slice too long\");\n  for (i=0; i<n; i++)\n    lua_pushinteger(L, uchar(s[posi+i-1]));\n  return n;\n}\n\n\nstatic int str_char (lua_State *L) {\n  int n = lua_gettop(L);  /* number of arguments */\n  int i;\n  luaL_Buffer b;\n  luaL_buffinit(L, &b);\n  for (i=1; i<=n; i++) {\n    int c = luaL_checkint(L, i);\n    luaL_argcheck(L, uchar(c) == c, i, \"invalid value\");\n    luaL_addchar(&b, uchar(c));\n  }\n  luaL_pushresult(&b);\n  return 1;\n}\n\n\nstatic int writer (lua_State *L, const void* b, size_t size, void* B) {\n  (void)L;\n  luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);\n  return 0;\n}\n\n\nstatic int str_dump (lua_State *L) {\n  luaL_Buffer b;\n  luaL_checktype(L, 1, LUA_TFUNCTION);\n  lua_settop(L, 1);\n  luaL_buffinit(L,&b);\n  if (lua_dump(L, writer, &b) != 0)\n    luaL_error(L, \"unable to dump given function\");\n  luaL_pushresult(&b);\n  return 1;\n}\n\n\n\n/*\n** {======================================================\n** PATTERN MATCHING\n** =======================================================\n*/\n\n\n#define CAP_UNFINISHED\t(-1)\n#define CAP_POSITION\t(-2)\n\ntypedef struct MatchState {\n  const char *src_init;  /* init of source string */\n  const char *src_end;  /* end (`\\0') of source string */\n  lua_State *L;\n  int level;  /* total number of captures (finished or unfinished) */\n  struct {\n    const char *init;\n    ptrdiff_t len;\n  } capture[LUA_MAXCAPTURES];\n} MatchState;\n\n\n#define L_ESC\t\t'%'\n#define SPECIALS\t\"^$*+?.([%-\"\n\n\nstatic int check_capture (MatchState *ms, int l) {\n  l -= '1';\n  if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED)\n    return luaL_error(ms->L, \"invalid capture index\");\n  return l;\n}\n\n\nstatic int capture_to_close (MatchState *ms) {\n  int level = ms->level;\n  for (level--; level>=0; level--)\n    if (ms->capture[level].len == CAP_UNFINISHED) return level;\n  return luaL_error(ms->L, \"invalid pattern capture\");\n}\n\n\nstatic const char *classend (MatchState *ms, const char *p) {\n  switch (*p++) {\n    case L_ESC: {\n      if (*p == '\\0')\n        luaL_error(ms->L, \"malformed pattern (ends with \" LUA_QL(\"%%\") \")\");\n      return p+1;\n    }\n    case '[': {\n      if (*p == '^') p++;\n      do {  /* look for a `]' */\n        if (*p == '\\0')\n          luaL_error(ms->L, \"malformed pattern (missing \" LUA_QL(\"]\") \")\");\n        if (*(p++) == L_ESC && *p != '\\0')\n          p++;  /* skip escapes (e.g. `%]') */\n      } while (*p != ']');\n      return p+1;\n    }\n    default: {\n      return p;\n    }\n  }\n}\n\n\nstatic int match_class (int c, int cl) {\n  int res;\n  switch (tolower(cl)) {\n    case 'a' : res = isalpha(c); break;\n    case 'c' : res = iscntrl(c); break;\n    case 'd' : res = isdigit(c); break;\n    case 'l' : res = islower(c); break;\n    case 'p' : res = ispunct(c); break;\n    case 's' : res = isspace(c); break;\n    case 'u' : res = isupper(c); break;\n    case 'w' : res = isalnum(c); break;\n    case 'x' : res = isxdigit(c); break;\n    case 'z' : res = (c == 0); break;\n    default: return (cl == c);\n  }\n  return (islower(cl) ? res : !res);\n}\n\n\nstatic int matchbracketclass (int c, const char *p, const char *ec) {\n  int sig = 1;\n  if (*(p+1) == '^') {\n    sig = 0;\n    p++;  /* skip the `^' */\n  }\n  while (++p < ec) {\n    if (*p == L_ESC) {\n      p++;\n      if (match_class(c, uchar(*p)))\n        return sig;\n    }\n    else if ((*(p+1) == '-') && (p+2 < ec)) {\n      p+=2;\n      if (uchar(*(p-2)) <= c && c <= uchar(*p))\n        return sig;\n    }\n    else if (uchar(*p) == c) return sig;\n  }\n  return !sig;\n}\n\n\nstatic int singlematch (int c, const char *p, const char *ep) {\n  switch (*p) {\n    case '.': return 1;  /* matches any char */\n    case L_ESC: return match_class(c, uchar(*(p+1)));\n    case '[': return matchbracketclass(c, p, ep-1);\n    default:  return (uchar(*p) == c);\n  }\n}\n\n\nstatic const char *match (MatchState *ms, const char *s, const char *p);\n\n\nstatic const char *matchbalance (MatchState *ms, const char *s,\n                                   const char *p) {\n  if (*p == 0 || *(p+1) == 0)\n    luaL_error(ms->L, \"unbalanced pattern\");\n  if (*s != *p) return NULL;\n  else {\n    int b = *p;\n    int e = *(p+1);\n    int cont = 1;\n    while (++s < ms->src_end) {\n      if (*s == e) {\n        if (--cont == 0) return s+1;\n      }\n      else if (*s == b) cont++;\n    }\n  }\n  return NULL;  /* string ends out of balance */\n}\n\n\nstatic const char *max_expand (MatchState *ms, const char *s,\n                                 const char *p, const char *ep) {\n  ptrdiff_t i = 0;  /* counts maximum expand for item */\n  while ((s+i)<ms->src_end && singlematch(uchar(*(s+i)), p, ep))\n    i++;\n  /* keeps trying to match with the maximum repetitions */\n  while (i>=0) {\n    const char *res = match(ms, (s+i), ep+1);\n    if (res) return res;\n    i--;  /* else didn't match; reduce 1 repetition to try again */\n  }\n  return NULL;\n}\n\n\nstatic const char *min_expand (MatchState *ms, const char *s,\n                                 const char *p, const char *ep) {\n  for (;;) {\n    const char *res = match(ms, s, ep+1);\n    if (res != NULL)\n      return res;\n    else if (s<ms->src_end && singlematch(uchar(*s), p, ep))\n      s++;  /* try with one more repetition */\n    else return NULL;\n  }\n}\n\n\nstatic const char *start_capture (MatchState *ms, const char *s,\n                                    const char *p, int what) {\n  const char *res;\n  int level = ms->level;\n  if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, \"too many captures\");\n  ms->capture[level].init = s;\n  ms->capture[level].len = what;\n  ms->level = level+1;\n  if ((res=match(ms, s, p)) == NULL)  /* match failed? */\n    ms->level--;  /* undo capture */\n  return res;\n}\n\n\nstatic const char *end_capture (MatchState *ms, const char *s,\n                                  const char *p) {\n  int l = capture_to_close(ms);\n  const char *res;\n  ms->capture[l].len = s - ms->capture[l].init;  /* close capture */\n  if ((res = match(ms, s, p)) == NULL)  /* match failed? */\n    ms->capture[l].len = CAP_UNFINISHED;  /* undo capture */\n  return res;\n}\n\n\nstatic const char *match_capture (MatchState *ms, const char *s, int l) {\n  size_t len;\n  l = check_capture(ms, l);\n  len = ms->capture[l].len;\n  if ((size_t)(ms->src_end-s) >= len &&\n      memcmp(ms->capture[l].init, s, len) == 0)\n    return s+len;\n  else return NULL;\n}\n\n\nstatic const char *match (MatchState *ms, const char *s, const char *p) {\n  init: /* using goto's to optimize tail recursion */\n  switch (*p) {\n    case '(': {  /* start capture */\n      if (*(p+1) == ')')  /* position capture? */\n        return start_capture(ms, s, p+2, CAP_POSITION);\n      else\n        return start_capture(ms, s, p+1, CAP_UNFINISHED);\n    }\n    case ')': {  /* end capture */\n      return end_capture(ms, s, p+1);\n    }\n    case L_ESC: {\n      switch (*(p+1)) {\n        case 'b': {  /* balanced string? */\n          s = matchbalance(ms, s, p+2);\n          if (s == NULL) return NULL;\n          p+=4; goto init;  /* else return match(ms, s, p+4); */\n        }\n        case 'f': {  /* frontier? */\n          const char *ep; char previous;\n          p += 2;\n          if (*p != '[')\n            luaL_error(ms->L, \"missing \" LUA_QL(\"[\") \" after \"\n                               LUA_QL(\"%%f\") \" in pattern\");\n          ep = classend(ms, p);  /* points to what is next */\n          previous = (s == ms->src_init) ? '\\0' : *(s-1);\n          if (matchbracketclass(uchar(previous), p, ep-1) ||\n             !matchbracketclass(uchar(*s), p, ep-1)) return NULL;\n          p=ep; goto init;  /* else return match(ms, s, ep); */\n        }\n        default: {\n          if (isdigit(uchar(*(p+1)))) {  /* capture results (%0-%9)? */\n            s = match_capture(ms, s, uchar(*(p+1)));\n            if (s == NULL) return NULL;\n            p+=2; goto init;  /* else return match(ms, s, p+2) */\n          }\n          goto dflt;  /* case default */\n        }\n      }\n    }\n    case '\\0': {  /* end of pattern */\n      return s;  /* match succeeded */\n    }\n    case '$': {\n      if (*(p+1) == '\\0')  /* is the `$' the last char in pattern? */\n        return (s == ms->src_end) ? s : NULL;  /* check end of string */\n      else goto dflt;\n    }\n    default: dflt: {  /* it is a pattern item */\n      const char *ep = classend(ms, p);  /* points to what is next */\n      int m = s<ms->src_end && singlematch(uchar(*s), p, ep);\n      switch (*ep) {\n        case '?': {  /* optional */\n          const char *res;\n          if (m && ((res=match(ms, s+1, ep+1)) != NULL))\n            return res;\n          p=ep+1; goto init;  /* else return match(ms, s, ep+1); */\n        }\n        case '*': {  /* 0 or more repetitions */\n          return max_expand(ms, s, p, ep);\n        }\n        case '+': {  /* 1 or more repetitions */\n          return (m ? max_expand(ms, s+1, p, ep) : NULL);\n        }\n        case '-': {  /* 0 or more repetitions (minimum) */\n          return min_expand(ms, s, p, ep);\n        }\n        default: {\n          if (!m) return NULL;\n          s++; p=ep; goto init;  /* else return match(ms, s+1, ep); */\n        }\n      }\n    }\n  }\n}\n\n\n\nstatic const char *lmemfind (const char *s1, size_t l1,\n                               const char *s2, size_t l2) {\n  if (l2 == 0) return s1;  /* empty strings are everywhere */\n  else if (l2 > l1) return NULL;  /* avoids a negative `l1' */\n  else {\n    const char *init;  /* to search for a `*s2' inside `s1' */\n    l2--;  /* 1st char will be checked by `memchr' */\n    l1 = l1-l2;  /* `s2' cannot be found after that */\n    while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) {\n      init++;   /* 1st char is already checked */\n      if (memcmp(init, s2+1, l2) == 0)\n        return init-1;\n      else {  /* correct `l1' and `s1' to try again */\n        l1 -= init-s1;\n        s1 = init;\n      }\n    }\n    return NULL;  /* not found */\n  }\n}\n\n\nstatic void push_onecapture (MatchState *ms, int i, const char *s,\n                                                    const char *e) {\n  if (i >= ms->level) {\n    if (i == 0)  /* ms->level == 0, too */\n      lua_pushlstring(ms->L, s, e - s);  /* add whole match */\n    else\n      luaL_error(ms->L, \"invalid capture index\");\n  }\n  else {\n    ptrdiff_t l = ms->capture[i].len;\n    if (l == CAP_UNFINISHED) luaL_error(ms->L, \"unfinished capture\");\n    if (l == CAP_POSITION)\n      lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1);\n    else\n      lua_pushlstring(ms->L, ms->capture[i].init, l);\n  }\n}\n\n\nstatic int push_captures (MatchState *ms, const char *s, const char *e) {\n  int i;\n  int nlevels = (ms->level == 0 && s) ? 1 : ms->level;\n  luaL_checkstack(ms->L, nlevels, \"too many captures\");\n  for (i = 0; i < nlevels; i++)\n    push_onecapture(ms, i, s, e);\n  return nlevels;  /* number of strings pushed */\n}\n\n\nstatic int str_find_aux (lua_State *L, int find) {\n  size_t l1, l2;\n  const char *s = luaL_checklstring(L, 1, &l1);\n  const char *p = luaL_checklstring(L, 2, &l2);\n  ptrdiff_t init = posrelat(luaL_optinteger(L, 3, 1), l1) - 1;\n  if (init < 0) init = 0;\n  else if ((size_t)(init) > l1) init = (ptrdiff_t)l1;\n  if (find && (lua_toboolean(L, 4) ||  /* explicit request? */\n      strpbrk(p, SPECIALS) == NULL)) {  /* or no special characters? */\n    /* do a plain search */\n    const char *s2 = lmemfind(s+init, l1-init, p, l2);\n    if (s2) {\n      lua_pushinteger(L, s2-s+1);\n      lua_pushinteger(L, s2-s+l2);\n      return 2;\n    }\n  }\n  else {\n    MatchState ms;\n    int anchor = (*p == '^') ? (p++, 1) : 0;\n    const char *s1=s+init;\n    ms.L = L;\n    ms.src_init = s;\n    ms.src_end = s+l1;\n    do {\n      const char *res;\n      ms.level = 0;\n      if ((res=match(&ms, s1, p)) != NULL) {\n        if (find) {\n          lua_pushinteger(L, s1-s+1);  /* start */\n          lua_pushinteger(L, res-s);   /* end */\n          return push_captures(&ms, NULL, 0) + 2;\n        }\n        else\n          return push_captures(&ms, s1, res);\n      }\n    } while (s1++ < ms.src_end && !anchor);\n  }\n  lua_pushnil(L);  /* not found */\n  return 1;\n}\n\n\nstatic int str_find (lua_State *L) {\n  return str_find_aux(L, 1);\n}\n\n\nstatic int str_match (lua_State *L) {\n  return str_find_aux(L, 0);\n}\n\n\nstatic int gmatch_aux (lua_State *L) {\n  MatchState ms;\n  size_t ls;\n  const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls);\n  const char *p = lua_tostring(L, lua_upvalueindex(2));\n  const char *src;\n  ms.L = L;\n  ms.src_init = s;\n  ms.src_end = s+ls;\n  for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3));\n       src <= ms.src_end;\n       src++) {\n    const char *e;\n    ms.level = 0;\n    if ((e = match(&ms, src, p)) != NULL) {\n      lua_Integer newstart = e-s;\n      if (e == src) newstart++;  /* empty match? go at least one position */\n      lua_pushinteger(L, newstart);\n      lua_replace(L, lua_upvalueindex(3));\n      return push_captures(&ms, src, e);\n    }\n  }\n  return 0;  /* not found */\n}\n\n\nstatic int gmatch (lua_State *L) {\n  luaL_checkstring(L, 1);\n  luaL_checkstring(L, 2);\n  lua_settop(L, 2);\n  lua_pushinteger(L, 0);\n  lua_pushcclosure(L, gmatch_aux, 3);\n  return 1;\n}\n\n\nstatic int gfind_nodef (lua_State *L) {\n  return luaL_error(L, LUA_QL(\"string.gfind\") \" was renamed to \"\n                       LUA_QL(\"string.gmatch\"));\n}\n\n\nstatic void add_s (MatchState *ms, luaL_Buffer *b, const char *s,\n                                                   const char *e) {\n  size_t l, i;\n  const char *news = lua_tolstring(ms->L, 3, &l);\n  for (i = 0; i < l; i++) {\n    if (news[i] != L_ESC)\n      luaL_addchar(b, news[i]);\n    else {\n      i++;  /* skip ESC */\n      if (!isdigit(uchar(news[i])))\n        luaL_addchar(b, news[i]);\n      else if (news[i] == '0')\n          luaL_addlstring(b, s, e - s);\n      else {\n        push_onecapture(ms, news[i] - '1', s, e);\n        luaL_addvalue(b);  /* add capture to accumulated result */\n      }\n    }\n  }\n}\n\n\nstatic void add_value (MatchState *ms, luaL_Buffer *b, const char *s,\n                                                       const char *e) {\n  lua_State *L = ms->L;\n  switch (lua_type(L, 3)) {\n    case LUA_TNUMBER:\n    case LUA_TSTRING: {\n      add_s(ms, b, s, e);\n      return;\n    }\n    case LUA_TFUNCTION: {\n      int n;\n      lua_pushvalue(L, 3);\n      n = push_captures(ms, s, e);\n      lua_call(L, n, 1);\n      break;\n    }\n    case LUA_TTABLE: {\n      push_onecapture(ms, 0, s, e);\n      lua_gettable(L, 3);\n      break;\n    }\n  }\n  if (!lua_toboolean(L, -1)) {  /* nil or false? */\n    lua_pop(L, 1);\n    lua_pushlstring(L, s, e - s);  /* keep original text */\n  }\n  else if (!lua_isstring(L, -1))\n    luaL_error(L, \"invalid replacement value (a %s)\", luaL_typename(L, -1)); \n  luaL_addvalue(b);  /* add result to accumulator */\n}\n\n\nstatic int str_gsub (lua_State *L) {\n  size_t srcl;\n  const char *src = luaL_checklstring(L, 1, &srcl);\n  const char *p = luaL_checkstring(L, 2);\n  int  tr = lua_type(L, 3);\n  int max_s = luaL_optint(L, 4, srcl+1);\n  int anchor = (*p == '^') ? (p++, 1) : 0;\n  int n = 0;\n  MatchState ms;\n  luaL_Buffer b;\n  luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING ||\n                   tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3,\n                      \"string/function/table expected\");\n  luaL_buffinit(L, &b);\n  ms.L = L;\n  ms.src_init = src;\n  ms.src_end = src+srcl;\n  while (n < max_s) {\n    const char *e;\n    ms.level = 0;\n    e = match(&ms, src, p);\n    if (e) {\n      n++;\n      add_value(&ms, &b, src, e);\n    }\n    if (e && e>src) /* non empty match? */\n      src = e;  /* skip it */\n    else if (src < ms.src_end)\n      luaL_addchar(&b, *src++);\n    else break;\n    if (anchor) break;\n  }\n  luaL_addlstring(&b, src, ms.src_end-src);\n  luaL_pushresult(&b);\n  lua_pushinteger(L, n);  /* number of substitutions */\n  return 2;\n}\n\n/* }====================================================== */\n\n\n/* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */\n#define MAX_ITEM\t512\n/* valid flags in a format specification */\n#define FLAGS\t\"-+ #0\"\n/*\n** maximum size of each format specification (such as '%-099.99d')\n** (+10 accounts for %99.99x plus margin of error)\n*/\n#define MAX_FORMAT\t(sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10)\n\n\nstatic void addquoted (lua_State *L, luaL_Buffer *b, int arg) {\n  size_t l;\n  const char *s = luaL_checklstring(L, arg, &l);\n  luaL_addchar(b, '\"');\n  while (l--) {\n    switch (*s) {\n      case '\"': case '\\\\': case '\\n': {\n        luaL_addchar(b, '\\\\');\n        luaL_addchar(b, *s);\n        break;\n      }\n      case '\\r': {\n        luaL_addlstring(b, \"\\\\r\", 2);\n        break;\n      }\n      case '\\0': {\n        luaL_addlstring(b, \"\\\\000\", 4);\n        break;\n      }\n      default: {\n        luaL_addchar(b, *s);\n        break;\n      }\n    }\n    s++;\n  }\n  luaL_addchar(b, '\"');\n}\n\nstatic const char *scanformat (lua_State *L, const char *strfrmt, char *form) {\n  const char *p = strfrmt;\n  while (*p != '\\0' && strchr(FLAGS, *p) != NULL) p++;  /* skip flags */\n  if ((size_t)(p - strfrmt) >= sizeof(FLAGS))\n    luaL_error(L, \"invalid format (repeated flags)\");\n  if (isdigit(uchar(*p))) p++;  /* skip width */\n  if (isdigit(uchar(*p))) p++;  /* (2 digits at most) */\n  if (*p == '.') {\n    p++;\n    if (isdigit(uchar(*p))) p++;  /* skip precision */\n    if (isdigit(uchar(*p))) p++;  /* (2 digits at most) */\n  }\n  if (isdigit(uchar(*p)))\n    luaL_error(L, \"invalid format (width or precision too long)\");\n  *(form++) = '%';\n  strncpy(form, strfrmt, p - strfrmt + 1);\n  form += p - strfrmt + 1;\n  *form = '\\0';\n  return p;\n}\n\n\nstatic void addintlen (char *form) {\n  size_t l = strlen(form);\n  char spec = form[l - 1];\n  strcpy(form + l - 1, LUA_INTFRMLEN);\n  form[l + sizeof(LUA_INTFRMLEN) - 2] = spec;\n  form[l + sizeof(LUA_INTFRMLEN) - 1] = '\\0';\n}\n\n\nstatic int str_format (lua_State *L) {\n  int top = lua_gettop(L);\n  int arg = 1;\n  size_t sfl;\n  const char *strfrmt = luaL_checklstring(L, arg, &sfl);\n  const char *strfrmt_end = strfrmt+sfl;\n  luaL_Buffer b;\n  luaL_buffinit(L, &b);\n  while (strfrmt < strfrmt_end) {\n    if (*strfrmt != L_ESC)\n      luaL_addchar(&b, *strfrmt++);\n    else if (*++strfrmt == L_ESC)\n      luaL_addchar(&b, *strfrmt++);  /* %% */\n    else { /* format item */\n      char form[MAX_FORMAT];  /* to store the format (`%...') */\n      char buff[MAX_ITEM];  /* to store the formatted item */\n      if (++arg > top)\n        luaL_argerror(L, arg, \"no value\");\n      strfrmt = scanformat(L, strfrmt, form);\n      switch (*strfrmt++) {\n        case 'c': {\n          sprintf(buff, form, (int)luaL_checknumber(L, arg));\n          break;\n        }\n        case 'd':  case 'i': {\n          addintlen(form);\n          sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg));\n          break;\n        }\n        case 'o':  case 'u':  case 'x':  case 'X': {\n          addintlen(form);\n          sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));\n          break;\n        }\n        case 'e':  case 'E': case 'f':\n        case 'g': case 'G': {\n          sprintf(buff, form, (double)luaL_checknumber(L, arg));\n          break;\n        }\n        case 'q': {\n          addquoted(L, &b, arg);\n          continue;  /* skip the 'addsize' at the end */\n        }\n        case 's': {\n          size_t l;\n          const char *s = luaL_checklstring(L, arg, &l);\n          if (!strchr(form, '.') && l >= 100) {\n            /* no precision and string is too long to be formatted;\n               keep original string */\n            lua_pushvalue(L, arg);\n            luaL_addvalue(&b);\n            continue;  /* skip the `addsize' at the end */\n          }\n          else {\n            sprintf(buff, form, s);\n            break;\n          }\n        }\n        default: {  /* also treat cases `pnLlh' */\n          return luaL_error(L, \"invalid option \" LUA_QL(\"%%%c\") \" to \"\n                               LUA_QL(\"format\"), *(strfrmt - 1));\n        }\n      }\n      luaL_addlstring(&b, buff, strlen(buff));\n    }\n  }\n  luaL_pushresult(&b);\n  return 1;\n}\n\n\nstatic const luaL_Reg strlib[] = {\n  {\"byte\", str_byte},\n  {\"char\", str_char},\n  {\"dump\", str_dump},\n  {\"find\", str_find},\n  {\"format\", str_format},\n  {\"gfind\", gfind_nodef},\n  {\"gmatch\", gmatch},\n  {\"gsub\", str_gsub},\n  {\"len\", str_len},\n  {\"lower\", str_lower},\n  {\"match\", str_match},\n  {\"rep\", str_rep},\n  {\"reverse\", str_reverse},\n  {\"sub\", str_sub},\n  {\"upper\", str_upper},\n  {NULL, NULL}\n};\n\n\nstatic void createmetatable (lua_State *L) {\n  lua_createtable(L, 0, 1);  /* create metatable for strings */\n  lua_pushliteral(L, \"\");  /* dummy string */\n  lua_pushvalue(L, -2);\n  lua_setmetatable(L, -2);  /* set string metatable */\n  lua_pop(L, 1);  /* pop dummy string */\n  lua_pushvalue(L, -2);  /* string library... */\n  lua_setfield(L, -2, \"__index\");  /* ...is the __index metamethod */\n  lua_pop(L, 1);  /* pop metatable */\n}\n\n\n/*\n** Open string library\n*/\nLUALIB_API int luaopen_string (lua_State *L) {\n  luaL_register(L, LUA_STRLIBNAME, strlib);\n#if defined(LUA_COMPAT_GFIND)\n  lua_getfield(L, -1, \"gmatch\");\n  lua_setfield(L, -2, \"gfind\");\n#endif\n  createmetatable(L);\n  return 1;\n}\n\n"
  },
  {
    "path": "jni/lua/ltable.c",
    "content": "/*\n** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $\n** Lua tables (hash)\n** See Copyright Notice in lua.h\n*/\n\n\n/*\n** Implementation of tables (aka arrays, objects, or hash tables).\n** Tables keep its elements in two parts: an array part and a hash part.\n** Non-negative integer keys are all candidates to be kept in the array\n** part. The actual size of the array is the largest `n' such that at\n** least half the slots between 0 and n are in use.\n** Hash uses a mix of chained scatter table with Brent's variation.\n** A main invariant of these tables is that, if an element is not\n** in its main position (i.e. the `original' position that its hash gives\n** to it), then the colliding element is in its own main position.\n** Hence even when the load factor reaches 100%, performance remains good.\n*/\n\n#include <math.h>\n#include <string.h>\n\n#define ltable_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"ldebug.h\"\n#include \"ldo.h\"\n#include \"lgc.h\"\n#include \"lmem.h\"\n#include \"lobject.h\"\n#include \"lstate.h\"\n#include \"ltable.h\"\n\n\n/*\n** max size of array part is 2^MAXBITS\n*/\n#if LUAI_BITSINT > 26\n#define MAXBITS\t\t26\n#else\n#define MAXBITS\t\t(LUAI_BITSINT-2)\n#endif\n\n#define MAXASIZE\t(1 << MAXBITS)\n\n\n#define hashpow2(t,n)      (gnode(t, lmod((n), sizenode(t))))\n  \n#define hashstr(t,str)  hashpow2(t, (str)->tsv.hash)\n#define hashboolean(t,p)        hashpow2(t, p)\n\n\n/*\n** for some types, it is better to avoid modulus by power of 2, as\n** they tend to have many 2 factors.\n*/\n#define hashmod(t,n)\t(gnode(t, ((n) % ((sizenode(t)-1)|1))))\n\n\n#define hashpointer(t,p)\thashmod(t, IntPoint(p))\n\n\n/*\n** number of ints inside a lua_Number\n*/\n#define numints\t\tcast_int(sizeof(lua_Number)/sizeof(int))\n\n\n\n#define dummynode\t\t(&dummynode_)\n\nstatic const Node dummynode_ = {\n  {{NULL}, LUA_TNIL},  /* value */\n  {{{NULL}, LUA_TNIL, NULL}}  /* key */\n};\n\n\n/*\n** hash for lua_Numbers\n*/\nstatic Node *hashnum (const Table *t, lua_Number n) {\n  unsigned int a[numints];\n  int i;\n  if (luai_numeq(n, 0))  /* avoid problems with -0 */\n    return gnode(t, 0);\n  memcpy(a, &n, sizeof(a));\n  for (i = 1; i < numints; i++) a[0] += a[i];\n  return hashmod(t, a[0]);\n}\n\n\n\n/*\n** returns the `main' position of an element in a table (that is, the index\n** of its hash value)\n*/\nstatic Node *mainposition (const Table *t, const TValue *key) {\n  switch (ttype(key)) {\n    case LUA_TNUMBER:\n      return hashnum(t, nvalue(key));\n    case LUA_TSTRING:\n      return hashstr(t, rawtsvalue(key));\n    case LUA_TBOOLEAN:\n      return hashboolean(t, bvalue(key));\n    case LUA_TLIGHTUSERDATA:\n      return hashpointer(t, pvalue(key));\n    default:\n      return hashpointer(t, gcvalue(key));\n  }\n}\n\n\n/*\n** returns the index for `key' if `key' is an appropriate key to live in\n** the array part of the table, -1 otherwise.\n*/\nstatic int arrayindex (const TValue *key) {\n  if (ttisnumber(key)) {\n    lua_Number n = nvalue(key);\n    int k;\n    lua_number2int(k, n);\n    if (luai_numeq(cast_num(k), n))\n      return k;\n  }\n  return -1;  /* `key' did not match some condition */\n}\n\n\n/*\n** returns the index of a `key' for table traversals. First goes all\n** elements in the array part, then elements in the hash part. The\n** beginning of a traversal is signalled by -1.\n*/\nstatic int findindex (lua_State *L, Table *t, StkId key) {\n  int i;\n  if (ttisnil(key)) return -1;  /* first iteration */\n  i = arrayindex(key);\n  if (0 < i && i <= t->sizearray)  /* is `key' inside array part? */\n    return i-1;  /* yes; that's the index (corrected to C) */\n  else {\n    Node *n = mainposition(t, key);\n    do {  /* check whether `key' is somewhere in the chain */\n      /* key may be dead already, but it is ok to use it in `next' */\n      if (luaO_rawequalObj(key2tval(n), key) ||\n            (ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) &&\n             gcvalue(gkey(n)) == gcvalue(key))) {\n        i = cast_int(n - gnode(t, 0));  /* key index in hash table */\n        /* hash elements are numbered after array ones */\n        return i + t->sizearray;\n      }\n      else n = gnext(n);\n    } while (n);\n    luaG_runerror(L, \"invalid key to \" LUA_QL(\"next\"));  /* key not found */\n    return 0;  /* to avoid warnings */\n  }\n}\n\n\nint luaH_next (lua_State *L, Table *t, StkId key) {\n  int i = findindex(L, t, key);  /* find original element */\n  for (i++; i < t->sizearray; i++) {  /* try first array part */\n    if (!ttisnil(&t->array[i])) {  /* a non-nil value? */\n      setnvalue(key, cast_num(i+1));\n      setobj2s(L, key+1, &t->array[i]);\n      return 1;\n    }\n  }\n  for (i -= t->sizearray; i < sizenode(t); i++) {  /* then hash part */\n    if (!ttisnil(gval(gnode(t, i)))) {  /* a non-nil value? */\n      setobj2s(L, key, key2tval(gnode(t, i)));\n      setobj2s(L, key+1, gval(gnode(t, i)));\n      return 1;\n    }\n  }\n  return 0;  /* no more elements */\n}\n\n\n/*\n** {=============================================================\n** Rehash\n** ==============================================================\n*/\n\n\nstatic int computesizes (int nums[], int *narray) {\n  int i;\n  int twotoi;  /* 2^i */\n  int a = 0;  /* number of elements smaller than 2^i */\n  int na = 0;  /* number of elements to go to array part */\n  int n = 0;  /* optimal size for array part */\n  for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) {\n    if (nums[i] > 0) {\n      a += nums[i];\n      if (a > twotoi/2) {  /* more than half elements present? */\n        n = twotoi;  /* optimal size (till now) */\n        na = a;  /* all elements smaller than n will go to array part */\n      }\n    }\n    if (a == *narray) break;  /* all elements already counted */\n  }\n  *narray = n;\n  lua_assert(*narray/2 <= na && na <= *narray);\n  return na;\n}\n\n\nstatic int countint (const TValue *key, int *nums) {\n  int k = arrayindex(key);\n  if (0 < k && k <= MAXASIZE) {  /* is `key' an appropriate array index? */\n    nums[ceillog2(k)]++;  /* count as such */\n    return 1;\n  }\n  else\n    return 0;\n}\n\n\nstatic int numusearray (const Table *t, int *nums) {\n  int lg;\n  int ttlg;  /* 2^lg */\n  int ause = 0;  /* summation of `nums' */\n  int i = 1;  /* count to traverse all array keys */\n  for (lg=0, ttlg=1; lg<=MAXBITS; lg++, ttlg*=2) {  /* for each slice */\n    int lc = 0;  /* counter */\n    int lim = ttlg;\n    if (lim > t->sizearray) {\n      lim = t->sizearray;  /* adjust upper limit */\n      if (i > lim)\n        break;  /* no more elements to count */\n    }\n    /* count elements in range (2^(lg-1), 2^lg] */\n    for (; i <= lim; i++) {\n      if (!ttisnil(&t->array[i-1]))\n        lc++;\n    }\n    nums[lg] += lc;\n    ause += lc;\n  }\n  return ause;\n}\n\n\nstatic int numusehash (const Table *t, int *nums, int *pnasize) {\n  int totaluse = 0;  /* total number of elements */\n  int ause = 0;  /* summation of `nums' */\n  int i = sizenode(t);\n  while (i--) {\n    Node *n = &t->node[i];\n    if (!ttisnil(gval(n))) {\n      ause += countint(key2tval(n), nums);\n      totaluse++;\n    }\n  }\n  *pnasize += ause;\n  return totaluse;\n}\n\n\nstatic void setarrayvector (lua_State *L, Table *t, int size) {\n  int i;\n  luaM_reallocvector(L, t->array, t->sizearray, size, TValue);\n  for (i=t->sizearray; i<size; i++)\n     setnilvalue(&t->array[i]);\n  t->sizearray = size;\n}\n\n\nstatic void setnodevector (lua_State *L, Table *t, int size) {\n  int lsize;\n  if (size == 0) {  /* no elements to hash part? */\n    t->node = cast(Node *, dummynode);  /* use common `dummynode' */\n    lsize = 0;\n  }\n  else {\n    int i;\n    lsize = ceillog2(size);\n    if (lsize > MAXBITS)\n      luaG_runerror(L, \"table overflow\");\n    size = twoto(lsize);\n    t->node = luaM_newvector(L, size, Node);\n    for (i=0; i<size; i++) {\n      Node *n = gnode(t, i);\n      gnext(n) = NULL;\n      setnilvalue(gkey(n));\n      setnilvalue(gval(n));\n    }\n  }\n  t->lsizenode = cast_byte(lsize);\n  t->lastfree = gnode(t, size);  /* all positions are free */\n}\n\n\nstatic void resize (lua_State *L, Table *t, int nasize, int nhsize) {\n  int i;\n  int oldasize = t->sizearray;\n  int oldhsize = t->lsizenode;\n  Node *nold = t->node;  /* save old hash ... */\n  if (nasize > oldasize)  /* array part must grow? */\n    setarrayvector(L, t, nasize);\n  /* create new hash part with appropriate size */\n  setnodevector(L, t, nhsize);  \n  if (nasize < oldasize) {  /* array part must shrink? */\n    t->sizearray = nasize;\n    /* re-insert elements from vanishing slice */\n    for (i=nasize; i<oldasize; i++) {\n      if (!ttisnil(&t->array[i]))\n        setobjt2t(L, luaH_setnum(L, t, i+1), &t->array[i]);\n    }\n    /* shrink array */\n    luaM_reallocvector(L, t->array, oldasize, nasize, TValue);\n  }\n  /* re-insert elements from hash part */\n  for (i = twoto(oldhsize) - 1; i >= 0; i--) {\n    Node *old = nold+i;\n    if (!ttisnil(gval(old)))\n      setobjt2t(L, luaH_set(L, t, key2tval(old)), gval(old));\n  }\n  if (nold != dummynode)\n    luaM_freearray(L, nold, twoto(oldhsize), Node);  /* free old array */\n}\n\n\nvoid luaH_resizearray (lua_State *L, Table *t, int nasize) {\n  int nsize = (t->node == dummynode) ? 0 : sizenode(t);\n  resize(L, t, nasize, nsize);\n}\n\n\nstatic void rehash (lua_State *L, Table *t, const TValue *ek) {\n  int nasize, na;\n  int nums[MAXBITS+1];  /* nums[i] = number of keys between 2^(i-1) and 2^i */\n  int i;\n  int totaluse;\n  for (i=0; i<=MAXBITS; i++) nums[i] = 0;  /* reset counts */\n  nasize = numusearray(t, nums);  /* count keys in array part */\n  totaluse = nasize;  /* all those keys are integer keys */\n  totaluse += numusehash(t, nums, &nasize);  /* count keys in hash part */\n  /* count extra key */\n  nasize += countint(ek, nums);\n  totaluse++;\n  /* compute new size for array part */\n  na = computesizes(nums, &nasize);\n  /* resize the table to new computed sizes */\n  resize(L, t, nasize, totaluse - na);\n}\n\n\n\n/*\n** }=============================================================\n*/\n\n\nTable *luaH_new (lua_State *L, int narray, int nhash) {\n  Table *t = luaM_new(L, Table);\n  luaC_link(L, obj2gco(t), LUA_TTABLE);\n  t->metatable = NULL;\n  t->flags = cast_byte(~0);\n  /* temporary values (kept only if some malloc fails) */\n  t->array = NULL;\n  t->sizearray = 0;\n  t->lsizenode = 0;\n  t->node = cast(Node *, dummynode);\n  setarrayvector(L, t, narray);\n  setnodevector(L, t, nhash);\n  return t;\n}\n\n\nvoid luaH_free (lua_State *L, Table *t) {\n  if (t->node != dummynode)\n    luaM_freearray(L, t->node, sizenode(t), Node);\n  luaM_freearray(L, t->array, t->sizearray, TValue);\n  luaM_free(L, t);\n}\n\n\nstatic Node *getfreepos (Table *t) {\n  while (t->lastfree-- > t->node) {\n    if (ttisnil(gkey(t->lastfree)))\n      return t->lastfree;\n  }\n  return NULL;  /* could not find a free place */\n}\n\n\n\n/*\n** inserts a new key into a hash table; first, check whether key's main \n** position is free. If not, check whether colliding node is in its main \n** position or not: if it is not, move colliding node to an empty place and \n** put new key in its main position; otherwise (colliding node is in its main \n** position), new key goes to an empty position. \n*/\nstatic TValue *newkey (lua_State *L, Table *t, const TValue *key) {\n  Node *mp = mainposition(t, key);\n  if (!ttisnil(gval(mp)) || mp == dummynode) {\n    Node *othern;\n    Node *n = getfreepos(t);  /* get a free place */\n    if (n == NULL) {  /* cannot find a free place? */\n      rehash(L, t, key);  /* grow table */\n      return luaH_set(L, t, key);  /* re-insert key into grown table */\n    }\n    lua_assert(n != dummynode);\n    othern = mainposition(t, key2tval(mp));\n    if (othern != mp) {  /* is colliding node out of its main position? */\n      /* yes; move colliding node into free position */\n      while (gnext(othern) != mp) othern = gnext(othern);  /* find previous */\n      gnext(othern) = n;  /* redo the chain with `n' in place of `mp' */\n      *n = *mp;  /* copy colliding node into free pos. (mp->next also goes) */\n      gnext(mp) = NULL;  /* now `mp' is free */\n      setnilvalue(gval(mp));\n    }\n    else {  /* colliding node is in its own main position */\n      /* new node will go into free position */\n      gnext(n) = gnext(mp);  /* chain new position */\n      gnext(mp) = n;\n      mp = n;\n    }\n  }\n  gkey(mp)->value = key->value; gkey(mp)->tt = key->tt;\n  luaC_barriert(L, t, key);\n  lua_assert(ttisnil(gval(mp)));\n  return gval(mp);\n}\n\n\n/*\n** search function for integers\n*/\nconst TValue *luaH_getnum (Table *t, int key) {\n  /* (1 <= key && key <= t->sizearray) */\n  if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray))\n    return &t->array[key-1];\n  else {\n    lua_Number nk = cast_num(key);\n    Node *n = hashnum(t, nk);\n    do {  /* check whether `key' is somewhere in the chain */\n      if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk))\n        return gval(n);  /* that's it */\n      else n = gnext(n);\n    } while (n);\n    return luaO_nilobject;\n  }\n}\n\n\n/*\n** search function for strings\n*/\nconst TValue *luaH_getstr (Table *t, TString *key) {\n  Node *n = hashstr(t, key);\n  do {  /* check whether `key' is somewhere in the chain */\n    if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key)\n      return gval(n);  /* that's it */\n    else n = gnext(n);\n  } while (n);\n  return luaO_nilobject;\n}\n\n\n/*\n** main search function\n*/\nconst TValue *luaH_get (Table *t, const TValue *key) {\n  switch (ttype(key)) {\n    case LUA_TNIL: return luaO_nilobject;\n    case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key));\n    case LUA_TNUMBER: {\n      int k;\n      lua_Number n = nvalue(key);\n      lua_number2int(k, n);\n      if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */\n        return luaH_getnum(t, k);  /* use specialized version */\n      /* else go through */\n    }\n    default: {\n      Node *n = mainposition(t, key);\n      do {  /* check whether `key' is somewhere in the chain */\n        if (luaO_rawequalObj(key2tval(n), key))\n          return gval(n);  /* that's it */\n        else n = gnext(n);\n      } while (n);\n      return luaO_nilobject;\n    }\n  }\n}\n\n\nTValue *luaH_set (lua_State *L, Table *t, const TValue *key) {\n  const TValue *p = luaH_get(t, key);\n  t->flags = 0;\n  if (p != luaO_nilobject)\n    return cast(TValue *, p);\n  else {\n    if (ttisnil(key)) luaG_runerror(L, \"table index is nil\");\n    else if (ttisnumber(key) && luai_numisnan(nvalue(key)))\n      luaG_runerror(L, \"table index is NaN\");\n    return newkey(L, t, key);\n  }\n}\n\n\nTValue *luaH_setnum (lua_State *L, Table *t, int key) {\n  const TValue *p = luaH_getnum(t, key);\n  if (p != luaO_nilobject)\n    return cast(TValue *, p);\n  else {\n    TValue k;\n    setnvalue(&k, cast_num(key));\n    return newkey(L, t, &k);\n  }\n}\n\n\nTValue *luaH_setstr (lua_State *L, Table *t, TString *key) {\n  const TValue *p = luaH_getstr(t, key);\n  if (p != luaO_nilobject)\n    return cast(TValue *, p);\n  else {\n    TValue k;\n    setsvalue(L, &k, key);\n    return newkey(L, t, &k);\n  }\n}\n\n\nstatic int unbound_search (Table *t, unsigned int j) {\n  unsigned int i = j;  /* i is zero or a present index */\n  j++;\n  /* find `i' and `j' such that i is present and j is not */\n  while (!ttisnil(luaH_getnum(t, j))) {\n    i = j;\n    j *= 2;\n    if (j > cast(unsigned int, MAX_INT)) {  /* overflow? */\n      /* table was built with bad purposes: resort to linear search */\n      i = 1;\n      while (!ttisnil(luaH_getnum(t, i))) i++;\n      return i - 1;\n    }\n  }\n  /* now do a binary search between them */\n  while (j - i > 1) {\n    unsigned int m = (i+j)/2;\n    if (ttisnil(luaH_getnum(t, m))) j = m;\n    else i = m;\n  }\n  return i;\n}\n\n\n/*\n** Try to find a boundary in table `t'. A `boundary' is an integer index\n** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil).\n*/\nint luaH_getn (Table *t) {\n  unsigned int j = t->sizearray;\n  if (j > 0 && ttisnil(&t->array[j - 1])) {\n    /* there is a boundary in the array part: (binary) search for it */\n    unsigned int i = 0;\n    while (j - i > 1) {\n      unsigned int m = (i+j)/2;\n      if (ttisnil(&t->array[m - 1])) j = m;\n      else i = m;\n    }\n    return i;\n  }\n  /* else must find a boundary in hash part */\n  else if (t->node == dummynode)  /* hash part is empty? */\n    return j;  /* that is easy... */\n  else return unbound_search(t, j);\n}\n\n\n\n#if defined(LUA_DEBUG)\n\nNode *luaH_mainposition (const Table *t, const TValue *key) {\n  return mainposition(t, key);\n}\n\nint luaH_isdummy (Node *n) { return n == dummynode; }\n\n#endif\n"
  },
  {
    "path": "jni/lua/ltable.h",
    "content": "/*\n** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $\n** Lua tables (hash)\n** See Copyright Notice in lua.h\n*/\n\n#ifndef ltable_h\n#define ltable_h\n\n#include \"lobject.h\"\n\n\n#define gnode(t,i)\t(&(t)->node[i])\n#define gkey(n)\t\t(&(n)->i_key.nk)\n#define gval(n)\t\t(&(n)->i_val)\n#define gnext(n)\t((n)->i_key.nk.next)\n\n#define key2tval(n)\t(&(n)->i_key.tvk)\n\n\nLUAI_FUNC const TValue *luaH_getnum (Table *t, int key);\nLUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key);\nLUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key);\nLUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key);\nLUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key);\nLUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key);\nLUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash);\nLUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize);\nLUAI_FUNC void luaH_free (lua_State *L, Table *t);\nLUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);\nLUAI_FUNC int luaH_getn (Table *t);\n\n\n#if defined(LUA_DEBUG)\nLUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key);\nLUAI_FUNC int luaH_isdummy (Node *n);\n#endif\n\n\n#endif\n"
  },
  {
    "path": "jni/lua/ltablib.c",
    "content": "/*\n** $Id: ltablib.c,v 1.38.1.3 2008/02/14 16:46:58 roberto Exp $\n** Library for Table Manipulation\n** See Copyright Notice in lua.h\n*/\n\n\n#include <stddef.h>\n\n#define ltablib_c\n#define LUA_LIB\n\n#include \"lua.h\"\n\n#include \"lauxlib.h\"\n#include \"lualib.h\"\n\n\n#define aux_getn(L,n)\t(luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n))\n\n\nstatic int foreachi (lua_State *L) {\n  int i;\n  int n = aux_getn(L, 1);\n  luaL_checktype(L, 2, LUA_TFUNCTION);\n  for (i=1; i <= n; i++) {\n    lua_pushvalue(L, 2);  /* function */\n    lua_pushinteger(L, i);  /* 1st argument */\n    lua_rawgeti(L, 1, i);  /* 2nd argument */\n    lua_call(L, 2, 1);\n    if (!lua_isnil(L, -1))\n      return 1;\n    lua_pop(L, 1);  /* remove nil result */\n  }\n  return 0;\n}\n\n\nstatic int foreach (lua_State *L) {\n  luaL_checktype(L, 1, LUA_TTABLE);\n  luaL_checktype(L, 2, LUA_TFUNCTION);\n  lua_pushnil(L);  /* first key */\n  while (lua_next(L, 1)) {\n    lua_pushvalue(L, 2);  /* function */\n    lua_pushvalue(L, -3);  /* key */\n    lua_pushvalue(L, -3);  /* value */\n    lua_call(L, 2, 1);\n    if (!lua_isnil(L, -1))\n      return 1;\n    lua_pop(L, 2);  /* remove value and result */\n  }\n  return 0;\n}\n\n\nstatic int maxn (lua_State *L) {\n  lua_Number max = 0;\n  luaL_checktype(L, 1, LUA_TTABLE);\n  lua_pushnil(L);  /* first key */\n  while (lua_next(L, 1)) {\n    lua_pop(L, 1);  /* remove value */\n    if (lua_type(L, -1) == LUA_TNUMBER) {\n      lua_Number v = lua_tonumber(L, -1);\n      if (v > max) max = v;\n    }\n  }\n  lua_pushnumber(L, max);\n  return 1;\n}\n\n\nstatic int getn (lua_State *L) {\n  lua_pushinteger(L, aux_getn(L, 1));\n  return 1;\n}\n\n\nstatic int setn (lua_State *L) {\n  luaL_checktype(L, 1, LUA_TTABLE);\n#ifndef luaL_setn\n  luaL_setn(L, 1, luaL_checkint(L, 2));\n#else\n  luaL_error(L, LUA_QL(\"setn\") \" is obsolete\");\n#endif\n  lua_pushvalue(L, 1);\n  return 1;\n}\n\n\nstatic int tinsert (lua_State *L) {\n  int e = aux_getn(L, 1) + 1;  /* first empty element */\n  int pos;  /* where to insert new element */\n  switch (lua_gettop(L)) {\n    case 2: {  /* called with only 2 arguments */\n      pos = e;  /* insert new element at the end */\n      break;\n    }\n    case 3: {\n      int i;\n      pos = luaL_checkint(L, 2);  /* 2nd argument is the position */\n      if (pos > e) e = pos;  /* `grow' array if necessary */\n      for (i = e; i > pos; i--) {  /* move up elements */\n        lua_rawgeti(L, 1, i-1);\n        lua_rawseti(L, 1, i);  /* t[i] = t[i-1] */\n      }\n      break;\n    }\n    default: {\n      return luaL_error(L, \"wrong number of arguments to \" LUA_QL(\"insert\"));\n    }\n  }\n  luaL_setn(L, 1, e);  /* new size */\n  lua_rawseti(L, 1, pos);  /* t[pos] = v */\n  return 0;\n}\n\n\nstatic int tremove (lua_State *L) {\n  int e = aux_getn(L, 1);\n  int pos = luaL_optint(L, 2, e);\n  if (!(1 <= pos && pos <= e))  /* position is outside bounds? */\n   return 0;  /* nothing to remove */\n  luaL_setn(L, 1, e - 1);  /* t.n = n-1 */\n  lua_rawgeti(L, 1, pos);  /* result = t[pos] */\n  for ( ;pos<e; pos++) {\n    lua_rawgeti(L, 1, pos+1);\n    lua_rawseti(L, 1, pos);  /* t[pos] = t[pos+1] */\n  }\n  lua_pushnil(L);\n  lua_rawseti(L, 1, e);  /* t[e] = nil */\n  return 1;\n}\n\n\nstatic void addfield (lua_State *L, luaL_Buffer *b, int i) {\n  lua_rawgeti(L, 1, i);\n  if (!lua_isstring(L, -1))\n    luaL_error(L, \"invalid value (%s) at index %d in table for \"\n                  LUA_QL(\"concat\"), luaL_typename(L, -1), i);\n    luaL_addvalue(b);\n}\n\n\nstatic int tconcat (lua_State *L) {\n  luaL_Buffer b;\n  size_t lsep;\n  int i, last;\n  const char *sep = luaL_optlstring(L, 2, \"\", &lsep);\n  luaL_checktype(L, 1, LUA_TTABLE);\n  i = luaL_optint(L, 3, 1);\n  last = luaL_opt(L, luaL_checkint, 4, luaL_getn(L, 1));\n  luaL_buffinit(L, &b);\n  for (; i < last; i++) {\n    addfield(L, &b, i);\n    luaL_addlstring(&b, sep, lsep);\n  }\n  if (i == last)  /* add last value (if interval was not empty) */\n    addfield(L, &b, i);\n  luaL_pushresult(&b);\n  return 1;\n}\n\n\n\n/*\n** {======================================================\n** Quicksort\n** (based on `Algorithms in MODULA-3', Robert Sedgewick;\n**  Addison-Wesley, 1993.)\n*/\n\n\nstatic void set2 (lua_State *L, int i, int j) {\n  lua_rawseti(L, 1, i);\n  lua_rawseti(L, 1, j);\n}\n\nstatic int sort_comp (lua_State *L, int a, int b) {\n  if (!lua_isnil(L, 2)) {  /* function? */\n    int res;\n    lua_pushvalue(L, 2);\n    lua_pushvalue(L, a-1);  /* -1 to compensate function */\n    lua_pushvalue(L, b-2);  /* -2 to compensate function and `a' */\n    lua_call(L, 2, 1);\n    res = lua_toboolean(L, -1);\n    lua_pop(L, 1);\n    return res;\n  }\n  else  /* a < b? */\n    return lua_lessthan(L, a, b);\n}\n\nstatic void auxsort (lua_State *L, int l, int u) {\n  while (l < u) {  /* for tail recursion */\n    int i, j;\n    /* sort elements a[l], a[(l+u)/2] and a[u] */\n    lua_rawgeti(L, 1, l);\n    lua_rawgeti(L, 1, u);\n    if (sort_comp(L, -1, -2))  /* a[u] < a[l]? */\n      set2(L, l, u);  /* swap a[l] - a[u] */\n    else\n      lua_pop(L, 2);\n    if (u-l == 1) break;  /* only 2 elements */\n    i = (l+u)/2;\n    lua_rawgeti(L, 1, i);\n    lua_rawgeti(L, 1, l);\n    if (sort_comp(L, -2, -1))  /* a[i]<a[l]? */\n      set2(L, i, l);\n    else {\n      lua_pop(L, 1);  /* remove a[l] */\n      lua_rawgeti(L, 1, u);\n      if (sort_comp(L, -1, -2))  /* a[u]<a[i]? */\n        set2(L, i, u);\n      else\n        lua_pop(L, 2);\n    }\n    if (u-l == 2) break;  /* only 3 elements */\n    lua_rawgeti(L, 1, i);  /* Pivot */\n    lua_pushvalue(L, -1);\n    lua_rawgeti(L, 1, u-1);\n    set2(L, i, u-1);\n    /* a[l] <= P == a[u-1] <= a[u], only need to sort from l+1 to u-2 */\n    i = l; j = u-1;\n    for (;;) {  /* invariant: a[l..i] <= P <= a[j..u] */\n      /* repeat ++i until a[i] >= P */\n      while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) {\n        if (i>u) luaL_error(L, \"invalid order function for sorting\");\n        lua_pop(L, 1);  /* remove a[i] */\n      }\n      /* repeat --j until a[j] <= P */\n      while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) {\n        if (j<l) luaL_error(L, \"invalid order function for sorting\");\n        lua_pop(L, 1);  /* remove a[j] */\n      }\n      if (j<i) {\n        lua_pop(L, 3);  /* pop pivot, a[i], a[j] */\n        break;\n      }\n      set2(L, i, j);\n    }\n    lua_rawgeti(L, 1, u-1);\n    lua_rawgeti(L, 1, i);\n    set2(L, u-1, i);  /* swap pivot (a[u-1]) with a[i] */\n    /* a[l..i-1] <= a[i] == P <= a[i+1..u] */\n    /* adjust so that smaller half is in [j..i] and larger one in [l..u] */\n    if (i-l < u-i) {\n      j=l; i=i-1; l=i+2;\n    }\n    else {\n      j=i+1; i=u; u=j-2;\n    }\n    auxsort(L, j, i);  /* call recursively the smaller one */\n  }  /* repeat the routine for the larger one */\n}\n\nstatic int sort (lua_State *L) {\n  int n = aux_getn(L, 1);\n  luaL_checkstack(L, 40, \"\");  /* assume array is smaller than 2^40 */\n  if (!lua_isnoneornil(L, 2))  /* is there a 2nd argument? */\n    luaL_checktype(L, 2, LUA_TFUNCTION);\n  lua_settop(L, 2);  /* make sure there is two arguments */\n  auxsort(L, 1, n);\n  return 0;\n}\n\n/* }====================================================== */\n\n\nstatic const luaL_Reg tab_funcs[] = {\n  {\"concat\", tconcat},\n  {\"foreach\", foreach},\n  {\"foreachi\", foreachi},\n  {\"getn\", getn},\n  {\"maxn\", maxn},\n  {\"insert\", tinsert},\n  {\"remove\", tremove},\n  {\"setn\", setn},\n  {\"sort\", sort},\n  {NULL, NULL}\n};\n\n\nLUALIB_API int luaopen_table (lua_State *L) {\n  luaL_register(L, LUA_TABLIBNAME, tab_funcs);\n  return 1;\n}\n\n"
  },
  {
    "path": "jni/lua/ltm.c",
    "content": "/*\n** $Id: ltm.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $\n** Tag methods\n** See Copyright Notice in lua.h\n*/\n\n\n#include <string.h>\n\n#define ltm_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"lobject.h\"\n#include \"lstate.h\"\n#include \"lstring.h\"\n#include \"ltable.h\"\n#include \"ltm.h\"\n\n\n\nconst char *const luaT_typenames[] = {\n  \"nil\", \"boolean\", \"userdata\", \"number\",\n  \"string\", \"table\", \"function\", \"userdata\", \"thread\",\n  \"proto\", \"upval\"\n};\n\n\nvoid luaT_init (lua_State *L) {\n  static const char *const luaT_eventname[] = {  /* ORDER TM */\n    \"__index\", \"__newindex\",\n    \"__gc\", \"__mode\", \"__eq\",\n    \"__add\", \"__sub\", \"__mul\", \"__div\", \"__mod\",\n    \"__pow\", \"__unm\", \"__len\", \"__lt\", \"__le\",\n    \"__concat\", \"__call\"\n  };\n  int i;\n  for (i=0; i<TM_N; i++) {\n    G(L)->tmname[i] = luaS_new(L, luaT_eventname[i]);\n    luaS_fix(G(L)->tmname[i]);  /* never collect these names */\n  }\n}\n\n\n/*\n** function to be used with macro \"fasttm\": optimized for absence of\n** tag methods\n*/\nconst TValue *luaT_gettm (Table *events, TMS event, TString *ename) {\n  const TValue *tm = luaH_getstr(events, ename);\n  lua_assert(event <= TM_EQ);\n  if (ttisnil(tm)) {  /* no tag method? */\n    events->flags |= cast_byte(1u<<event);  /* cache this fact */\n    return NULL;\n  }\n  else return tm;\n}\n\n\nconst TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {\n  Table *mt;\n  switch (ttype(o)) {\n    case LUA_TTABLE:\n      mt = hvalue(o)->metatable;\n      break;\n    case LUA_TUSERDATA:\n      mt = uvalue(o)->metatable;\n      break;\n    default:\n      mt = G(L)->mt[ttype(o)];\n  }\n  return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject);\n}\n\n"
  },
  {
    "path": "jni/lua/ltm.h",
    "content": "/*\n** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $\n** Tag methods\n** See Copyright Notice in lua.h\n*/\n\n#ifndef ltm_h\n#define ltm_h\n\n\n#include \"lobject.h\"\n\n\n/*\n* WARNING: if you change the order of this enumeration,\n* grep \"ORDER TM\"\n*/\ntypedef enum {\n  TM_INDEX,\n  TM_NEWINDEX,\n  TM_GC,\n  TM_MODE,\n  TM_EQ,  /* last tag method with `fast' access */\n  TM_ADD,\n  TM_SUB,\n  TM_MUL,\n  TM_DIV,\n  TM_MOD,\n  TM_POW,\n  TM_UNM,\n  TM_LEN,\n  TM_LT,\n  TM_LE,\n  TM_CONCAT,\n  TM_CALL,\n  TM_N\t\t/* number of elements in the enum */\n} TMS;\n\n\n\n#define gfasttm(g,et,e) ((et) == NULL ? NULL : \\\n  ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))\n\n#define fasttm(l,et,e)\tgfasttm(G(l), et, e)\n\nLUAI_DATA const char *const luaT_typenames[];\n\n\nLUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);\nLUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,\n                                                       TMS event);\nLUAI_FUNC void luaT_init (lua_State *L);\n\n#endif\n"
  },
  {
    "path": "jni/lua/lua.h",
    "content": "/*\n** $Id: lua.h,v 1.218.1.7 2012/01/13 20:36:20 roberto Exp $\n** Lua - An Extensible Extension Language\n** Lua.org, PUC-Rio, Brazil (http://www.lua.org)\n** See Copyright Notice at the end of this file\n*/\n\n\n#ifndef lua_h\n#define lua_h\n\n#include <stdarg.h>\n#include <stddef.h>\n\n\n#include \"luaconf.h\"\n\n\n#define LUA_VERSION\t\"Lua 5.1\"\n#define LUA_RELEASE\t\"Lua 5.1.5\"\n#define LUA_VERSION_NUM\t501\n#define LUA_COPYRIGHT\t\"Copyright (C) 1994-2012 Lua.org, PUC-Rio\"\n#define LUA_AUTHORS \t\"R. Ierusalimschy, L. H. de Figueiredo & W. Celes\"\n\n\n/* mark for precompiled code (`<esc>Lua') */\n#define\tLUA_SIGNATURE\t\"\\033Lua\"\n\n/* option for multiple returns in `lua_pcall' and `lua_call' */\n#define LUA_MULTRET\t(-1)\n\n\n/*\n** pseudo-indices\n*/\n#define LUA_REGISTRYINDEX\t(-10000)\n#define LUA_ENVIRONINDEX\t(-10001)\n#define LUA_GLOBALSINDEX\t(-10002)\n#define lua_upvalueindex(i)\t(LUA_GLOBALSINDEX-(i))\n\n\n/* thread status; 0 is OK */\n#define LUA_YIELD\t1\n#define LUA_ERRRUN\t2\n#define LUA_ERRSYNTAX\t3\n#define LUA_ERRMEM\t4\n#define LUA_ERRERR\t5\n\n\ntypedef struct lua_State lua_State;\n\ntypedef int (*lua_CFunction) (lua_State *L);\n\n\n/*\n** functions that read/write blocks when loading/dumping Lua chunks\n*/\ntypedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);\n\ntypedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);\n\n\n/*\n** prototype for memory-allocation functions\n*/\ntypedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);\n\n\n/*\n** basic types\n*/\n#define LUA_TNONE\t\t(-1)\n\n#define LUA_TNIL\t\t0\n#define LUA_TBOOLEAN\t\t1\n#define LUA_TLIGHTUSERDATA\t2\n#define LUA_TNUMBER\t\t3\n#define LUA_TSTRING\t\t4\n#define LUA_TTABLE\t\t5\n#define LUA_TFUNCTION\t\t6\n#define LUA_TUSERDATA\t\t7\n#define LUA_TTHREAD\t\t8\n\n\n\n/* minimum Lua stack available to a C function */\n#define LUA_MINSTACK\t20\n\n\n/*\n** generic extra include file\n*/\n#if defined(LUA_USER_H)\n#include LUA_USER_H\n#endif\n\n\n/* type of numbers in Lua */\ntypedef LUA_NUMBER lua_Number;\n\n\n/* type for integer functions */\ntypedef LUA_INTEGER lua_Integer;\n\n\n\n/*\n** state manipulation\n*/\nLUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);\nLUA_API void       (lua_close) (lua_State *L);\nLUA_API lua_State *(lua_newthread) (lua_State *L);\n\nLUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);\n\n\n/*\n** basic stack manipulation\n*/\nLUA_API int   (lua_gettop) (lua_State *L);\nLUA_API void  (lua_settop) (lua_State *L, int idx);\nLUA_API void  (lua_pushvalue) (lua_State *L, int idx);\nLUA_API void  (lua_remove) (lua_State *L, int idx);\nLUA_API void  (lua_insert) (lua_State *L, int idx);\nLUA_API void  (lua_replace) (lua_State *L, int idx);\nLUA_API int   (lua_checkstack) (lua_State *L, int sz);\n\nLUA_API void  (lua_xmove) (lua_State *from, lua_State *to, int n);\n\n\n/*\n** access functions (stack -> C)\n*/\n\nLUA_API int             (lua_isnumber) (lua_State *L, int idx);\nLUA_API int             (lua_isstring) (lua_State *L, int idx);\nLUA_API int             (lua_iscfunction) (lua_State *L, int idx);\nLUA_API int             (lua_isuserdata) (lua_State *L, int idx);\nLUA_API int             (lua_type) (lua_State *L, int idx);\nLUA_API const char     *(lua_typename) (lua_State *L, int tp);\n\nLUA_API int            (lua_equal) (lua_State *L, int idx1, int idx2);\nLUA_API int            (lua_rawequal) (lua_State *L, int idx1, int idx2);\nLUA_API int            (lua_lessthan) (lua_State *L, int idx1, int idx2);\n\nLUA_API lua_Number      (lua_tonumber) (lua_State *L, int idx);\nLUA_API lua_Integer     (lua_tointeger) (lua_State *L, int idx);\nLUA_API int             (lua_toboolean) (lua_State *L, int idx);\nLUA_API const char     *(lua_tolstring) (lua_State *L, int idx, size_t *len);\nLUA_API size_t          (lua_objlen) (lua_State *L, int idx);\nLUA_API lua_CFunction   (lua_tocfunction) (lua_State *L, int idx);\nLUA_API void\t       *(lua_touserdata) (lua_State *L, int idx);\nLUA_API lua_State      *(lua_tothread) (lua_State *L, int idx);\nLUA_API const void     *(lua_topointer) (lua_State *L, int idx);\n\n\n/*\n** push functions (C -> stack)\n*/\nLUA_API void  (lua_pushnil) (lua_State *L);\nLUA_API void  (lua_pushnumber) (lua_State *L, lua_Number n);\nLUA_API void  (lua_pushinteger) (lua_State *L, lua_Integer n);\nLUA_API void  (lua_pushlstring) (lua_State *L, const char *s, size_t l);\nLUA_API void  (lua_pushstring) (lua_State *L, const char *s);\nLUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,\n                                                      va_list argp);\nLUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);\nLUA_API void  (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);\nLUA_API void  (lua_pushboolean) (lua_State *L, int b);\nLUA_API void  (lua_pushlightuserdata) (lua_State *L, void *p);\nLUA_API int   (lua_pushthread) (lua_State *L);\n\n\n/*\n** get functions (Lua -> stack)\n*/\nLUA_API void  (lua_gettable) (lua_State *L, int idx);\nLUA_API void  (lua_getfield) (lua_State *L, int idx, const char *k);\nLUA_API void  (lua_rawget) (lua_State *L, int idx);\nLUA_API void  (lua_rawgeti) (lua_State *L, int idx, int n);\nLUA_API void  (lua_createtable) (lua_State *L, int narr, int nrec);\nLUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);\nLUA_API int   (lua_getmetatable) (lua_State *L, int objindex);\nLUA_API void  (lua_getfenv) (lua_State *L, int idx);\n\n\n/*\n** set functions (stack -> Lua)\n*/\nLUA_API void  (lua_settable) (lua_State *L, int idx);\nLUA_API void  (lua_setfield) (lua_State *L, int idx, const char *k);\nLUA_API void  (lua_rawset) (lua_State *L, int idx);\nLUA_API void  (lua_rawseti) (lua_State *L, int idx, int n);\nLUA_API int   (lua_setmetatable) (lua_State *L, int objindex);\nLUA_API int   (lua_setfenv) (lua_State *L, int idx);\n\n\n/*\n** `load' and `call' functions (load and run Lua code)\n*/\nLUA_API void  (lua_call) (lua_State *L, int nargs, int nresults);\nLUA_API int   (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);\nLUA_API int   (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);\nLUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,\n                                        const char *chunkname);\n\nLUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);\n\n\n/*\n** coroutine functions\n*/\nLUA_API int  (lua_yield) (lua_State *L, int nresults);\nLUA_API int  (lua_resume) (lua_State *L, int narg);\nLUA_API int  (lua_status) (lua_State *L);\n\n/*\n** garbage-collection function and options\n*/\n\n#define LUA_GCSTOP\t\t0\n#define LUA_GCRESTART\t\t1\n#define LUA_GCCOLLECT\t\t2\n#define LUA_GCCOUNT\t\t3\n#define LUA_GCCOUNTB\t\t4\n#define LUA_GCSTEP\t\t5\n#define LUA_GCSETPAUSE\t\t6\n#define LUA_GCSETSTEPMUL\t7\n\nLUA_API int (lua_gc) (lua_State *L, int what, int data);\n\n\n/*\n** miscellaneous functions\n*/\n\nLUA_API int   (lua_error) (lua_State *L);\n\nLUA_API int   (lua_next) (lua_State *L, int idx);\n\nLUA_API void  (lua_concat) (lua_State *L, int n);\n\nLUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);\nLUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);\n\n\n\n/* \n** ===============================================================\n** some useful macros\n** ===============================================================\n*/\n\n#define lua_pop(L,n)\t\tlua_settop(L, -(n)-1)\n\n#define lua_newtable(L)\t\tlua_createtable(L, 0, 0)\n\n#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))\n\n#define lua_pushcfunction(L,f)\tlua_pushcclosure(L, (f), 0)\n\n#define lua_strlen(L,i)\t\tlua_objlen(L, (i))\n\n#define lua_isfunction(L,n)\t(lua_type(L, (n)) == LUA_TFUNCTION)\n#define lua_istable(L,n)\t(lua_type(L, (n)) == LUA_TTABLE)\n#define lua_islightuserdata(L,n)\t(lua_type(L, (n)) == LUA_TLIGHTUSERDATA)\n#define lua_isnil(L,n)\t\t(lua_type(L, (n)) == LUA_TNIL)\n#define lua_isboolean(L,n)\t(lua_type(L, (n)) == LUA_TBOOLEAN)\n#define lua_isthread(L,n)\t(lua_type(L, (n)) == LUA_TTHREAD)\n#define lua_isnone(L,n)\t\t(lua_type(L, (n)) == LUA_TNONE)\n#define lua_isnoneornil(L, n)\t(lua_type(L, (n)) <= 0)\n\n#define lua_pushliteral(L, s)\t\\\n\tlua_pushlstring(L, \"\" s, (sizeof(s)/sizeof(char))-1)\n\n#define lua_setglobal(L,s)\tlua_setfield(L, LUA_GLOBALSINDEX, (s))\n#define lua_getglobal(L,s)\tlua_getfield(L, LUA_GLOBALSINDEX, (s))\n\n#define lua_tostring(L,i)\tlua_tolstring(L, (i), NULL)\n\n\n\n/*\n** compatibility macros and functions\n*/\n\n#define lua_open()\tluaL_newstate()\n\n#define lua_getregistry(L)\tlua_pushvalue(L, LUA_REGISTRYINDEX)\n\n#define lua_getgccount(L)\tlua_gc(L, LUA_GCCOUNT, 0)\n\n#define lua_Chunkreader\t\tlua_Reader\n#define lua_Chunkwriter\t\tlua_Writer\n\n\n/* hack */\nLUA_API void lua_setlevel\t(lua_State *from, lua_State *to);\n\n\n/*\n** {======================================================================\n** Debug API\n** =======================================================================\n*/\n\n\n/*\n** Event codes\n*/\n#define LUA_HOOKCALL\t0\n#define LUA_HOOKRET\t1\n#define LUA_HOOKLINE\t2\n#define LUA_HOOKCOUNT\t3\n#define LUA_HOOKTAILRET 4\n\n\n/*\n** Event masks\n*/\n#define LUA_MASKCALL\t(1 << LUA_HOOKCALL)\n#define LUA_MASKRET\t(1 << LUA_HOOKRET)\n#define LUA_MASKLINE\t(1 << LUA_HOOKLINE)\n#define LUA_MASKCOUNT\t(1 << LUA_HOOKCOUNT)\n\ntypedef struct lua_Debug lua_Debug;  /* activation record */\n\n\n/* Functions to be called by the debuger in specific events */\ntypedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);\n\n\nLUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);\nLUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);\nLUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);\nLUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);\nLUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);\nLUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);\n\nLUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);\nLUA_API lua_Hook lua_gethook (lua_State *L);\nLUA_API int lua_gethookmask (lua_State *L);\nLUA_API int lua_gethookcount (lua_State *L);\n\n\nstruct lua_Debug {\n  int event;\n  const char *name;\t/* (n) */\n  const char *namewhat;\t/* (n) `global', `local', `field', `method' */\n  const char *what;\t/* (S) `Lua', `C', `main', `tail' */\n  const char *source;\t/* (S) */\n  int currentline;\t/* (l) */\n  int nups;\t\t/* (u) number of upvalues */\n  int linedefined;\t/* (S) */\n  int lastlinedefined;\t/* (S) */\n  char short_src[LUA_IDSIZE]; /* (S) */\n  /* private part */\n  int i_ci;  /* active function */\n};\n\n/* }====================================================================== */\n\n\n/******************************************************************************\n* Copyright (C) 1994-2012 Lua.org, PUC-Rio.  All rights reserved.\n*\n* Permission is hereby granted, free of charge, to any person obtaining\n* a copy of this software and associated documentation files (the\n* \"Software\"), to deal in the Software without restriction, including\n* without limitation the rights to use, copy, modify, merge, publish,\n* distribute, sublicense, and/or sell copies of the Software, and to\n* permit persons to whom the Software is furnished to do so, subject to\n* the following conditions:\n*\n* The above copyright notice and this permission notice shall be\n* included in all copies or substantial portions of the Software.\n*\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n******************************************************************************/\n\n\n#endif\n"
  },
  {
    "path": "jni/lua/lua.hpp",
    "content": "// lua.hpp\n// Lua header files for C++\n// <<extern \"C\">> not supplied automatically because Lua also compiles as C++\n\nextern \"C\" {\n#include \"lua.h\"\n#include \"lualib.h\"\n#include \"lauxlib.h\"\n}\n"
  },
  {
    "path": "jni/lua/luaconf.h",
    "content": "/*\n** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $\n** Configuration file for Lua\n** See Copyright Notice in lua.h\n*/\n\n\n#ifndef lconfig_h\n#define lconfig_h\n\n#include <limits.h>\n#include <stddef.h>\n\n\n/*\n** ==================================================================\n** Search for \"@@\" to find all configurable definitions.\n** ===================================================================\n*/\n\n\n/*\n@@ LUA_ANSI controls the use of non-ansi features.\n** CHANGE it (define it) if you want Lua to avoid the use of any\n** non-ansi feature or library.\n*/\n#if defined(__STRICT_ANSI__)\n#define LUA_ANSI\n#endif\n\n\n#if !defined(LUA_ANSI) && defined(_WIN32)\n#define LUA_WIN\n#endif\n\n#if defined(LUA_USE_LINUX)\n#define LUA_USE_POSIX\n#define LUA_USE_DLOPEN\t\t/* needs an extra library: -ldl */\n#define LUA_USE_READLINE\t/* needs some extra libraries */\n#endif\n\n#if defined(LUA_USE_MACOSX)\n#define LUA_USE_POSIX\n#define LUA_DL_DYLD\t\t/* does not need extra library */\n#endif\n\n\n\n/*\n@@ LUA_USE_POSIX includes all functionallity listed as X/Open System\n@* Interfaces Extension (XSI).\n** CHANGE it (define it) if your system is XSI compatible.\n*/\n#if defined(LUA_USE_POSIX)\n#define LUA_USE_MKSTEMP\n#define LUA_USE_ISATTY\n#define LUA_USE_POPEN\n#define LUA_USE_ULONGJMP\n#endif\n\n\n/*\n@@ LUA_PATH and LUA_CPATH are the names of the environment variables that\n@* Lua check to set its paths.\n@@ LUA_INIT is the name of the environment variable that Lua\n@* checks for initialization code.\n** CHANGE them if you want different names.\n*/\n#define LUA_PATH        \"LUA_PATH\"\n#define LUA_CPATH       \"LUA_CPATH\"\n#define LUA_INIT\t\"LUA_INIT\"\n\n\n/*\n@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for\n@* Lua libraries.\n@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for\n@* C libraries.\n** CHANGE them if your machine has a non-conventional directory\n** hierarchy or if you want to install your libraries in\n** non-conventional directories.\n*/\n#if defined(_WIN32)\n/*\n** In Windows, any exclamation mark ('!') in the path is replaced by the\n** path of the directory of the executable file of the current process.\n*/\n#define LUA_LDIR\t\"!\\\\lua\\\\\"\n#define LUA_CDIR\t\"!\\\\\"\n#define LUA_PATH_DEFAULT  \\\n\t\t\".\\\\?.lua;\"  LUA_LDIR\"?.lua;\"  LUA_LDIR\"?\\\\init.lua;\" \\\n\t\t             LUA_CDIR\"?.lua;\"  LUA_CDIR\"?\\\\init.lua\"\n#define LUA_CPATH_DEFAULT \\\n\t\".\\\\?.dll;\"  LUA_CDIR\"?.dll;\" LUA_CDIR\"loadall.dll\"\n\n#else\n#define LUA_ROOT\t\"/usr/local/\"\n#define LUA_LDIR\tLUA_ROOT \"share/lua/5.1/\"\n#define LUA_CDIR\tLUA_ROOT \"lib/lua/5.1/\"\n#define LUA_PATH_DEFAULT  \\\n\t\t\"./?.lua;\"  LUA_LDIR\"?.lua;\"  LUA_LDIR\"?/init.lua;\" \\\n\t\t            LUA_CDIR\"?.lua;\"  LUA_CDIR\"?/init.lua\"\n#define LUA_CPATH_DEFAULT \\\n\t\"./?.so;\"  LUA_CDIR\"?.so;\" LUA_CDIR\"loadall.so\"\n#endif\n\n\n/*\n@@ LUA_DIRSEP is the directory separator (for submodules).\n** CHANGE it if your machine does not use \"/\" as the directory separator\n** and is not Windows. (On Windows Lua automatically uses \"\\\".)\n*/\n#if defined(_WIN32)\n#define LUA_DIRSEP\t\"\\\\\"\n#else\n#define LUA_DIRSEP\t\"/\"\n#endif\n\n\n/*\n@@ LUA_PATHSEP is the character that separates templates in a path.\n@@ LUA_PATH_MARK is the string that marks the substitution points in a\n@* template.\n@@ LUA_EXECDIR in a Windows path is replaced by the executable's\n@* directory.\n@@ LUA_IGMARK is a mark to ignore all before it when bulding the\n@* luaopen_ function name.\n** CHANGE them if for some reason your system cannot use those\n** characters. (E.g., if one of those characters is a common character\n** in file/directory names.) Probably you do not need to change them.\n*/\n#define LUA_PATHSEP\t\";\"\n#define LUA_PATH_MARK\t\"?\"\n#define LUA_EXECDIR\t\"!\"\n#define LUA_IGMARK\t\"-\"\n\n\n/*\n@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.\n** CHANGE that if ptrdiff_t is not adequate on your machine. (On most\n** machines, ptrdiff_t gives a good choice between int or long.)\n*/\n#define LUA_INTEGER\tptrdiff_t\n\n\n/*\n@@ LUA_API is a mark for all core API functions.\n@@ LUALIB_API is a mark for all standard library functions.\n** CHANGE them if you need to define those functions in some special way.\n** For instance, if you want to create one Windows DLL with the core and\n** the libraries, you may want to use the following definition (define\n** LUA_BUILD_AS_DLL to get it).\n*/\n#if defined(LUA_BUILD_AS_DLL)\n\n#if defined(LUA_CORE) || defined(LUA_LIB)\n#define LUA_API __declspec(dllexport)\n#else\n#define LUA_API __declspec(dllimport)\n#endif\n\n#else\n\n#define LUA_API\t\textern\n\n#endif\n\n/* more often than not the libs go together with the core */\n#define LUALIB_API\tLUA_API\n\n\n/*\n@@ LUAI_FUNC is a mark for all extern functions that are not to be\n@* exported to outside modules.\n@@ LUAI_DATA is a mark for all extern (const) variables that are not to\n@* be exported to outside modules.\n** CHANGE them if you need to mark them in some special way. Elf/gcc\n** (versions 3.2 and later) mark them as \"hidden\" to optimize access\n** when Lua is compiled as a shared library.\n*/\n#if defined(luaall_c)\n#define LUAI_FUNC\tstatic\n#define LUAI_DATA\t/* empty */\n\n#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \\\n      defined(__ELF__)\n#define LUAI_FUNC\t__attribute__((visibility(\"hidden\"))) extern\n#define LUAI_DATA\tLUAI_FUNC\n\n#else\n#define LUAI_FUNC\textern\n#define LUAI_DATA\textern\n#endif\n\n\n\n/*\n@@ LUA_QL describes how error messages quote program elements.\n** CHANGE it if you want a different appearance.\n*/\n#define LUA_QL(x)\t\"'\" x \"'\"\n#define LUA_QS\t\tLUA_QL(\"%s\")\n\n\n/*\n@@ LUA_IDSIZE gives the maximum size for the description of the source\n@* of a function in debug information.\n** CHANGE it if you want a different size.\n*/\n#define LUA_IDSIZE\t60\n\n\n/*\n** {==================================================================\n** Stand-alone configuration\n** ===================================================================\n*/\n\n#if defined(lua_c) || defined(luaall_c)\n\n/*\n@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that\n@* is, whether we're running lua interactively).\n** CHANGE it if you have a better definition for non-POSIX/non-Windows\n** systems.\n*/\n#if defined(LUA_USE_ISATTY)\n#include <unistd.h>\n#define lua_stdin_is_tty()\tisatty(0)\n#elif defined(LUA_WIN)\n#include <io.h>\n#include <stdio.h>\n#define lua_stdin_is_tty()\t_isatty(_fileno(stdin))\n#else\n#define lua_stdin_is_tty()\t1  /* assume stdin is a tty */\n#endif\n\n\n/*\n@@ LUA_PROMPT is the default prompt used by stand-alone Lua.\n@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.\n** CHANGE them if you want different prompts. (You can also change the\n** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)\n*/\n#define LUA_PROMPT\t\t\"> \"\n#define LUA_PROMPT2\t\t\">> \"\n\n\n/*\n@@ LUA_PROGNAME is the default name for the stand-alone Lua program.\n** CHANGE it if your stand-alone interpreter has a different name and\n** your system is not able to detect that name automatically.\n*/\n#define LUA_PROGNAME\t\t\"lua\"\n\n\n/*\n@@ LUA_MAXINPUT is the maximum length for an input line in the\n@* stand-alone interpreter.\n** CHANGE it if you need longer lines.\n*/\n#define LUA_MAXINPUT\t512\n\n\n/*\n@@ lua_readline defines how to show a prompt and then read a line from\n@* the standard input.\n@@ lua_saveline defines how to \"save\" a read line in a \"history\".\n@@ lua_freeline defines how to free a line read by lua_readline.\n** CHANGE them if you want to improve this functionality (e.g., by using\n** GNU readline and history facilities).\n*/\n#if defined(LUA_USE_READLINE)\n#include <stdio.h>\n#include <readline/readline.h>\n#include <readline/history.h>\n#define lua_readline(L,b,p)\t((void)L, ((b)=readline(p)) != NULL)\n#define lua_saveline(L,idx) \\\n\tif (lua_strlen(L,idx) > 0)  /* non-empty line? */ \\\n\t  add_history(lua_tostring(L, idx));  /* add it to history */\n#define lua_freeline(L,b)\t((void)L, free(b))\n#else\n#define lua_readline(L,b,p)\t\\\n\t((void)L, fputs(p, stdout), fflush(stdout),  /* show prompt */ \\\n\tfgets(b, LUA_MAXINPUT, stdin) != NULL)  /* get line */\n#define lua_saveline(L,idx)\t{ (void)L; (void)idx; }\n#define lua_freeline(L,b)\t{ (void)L; (void)b; }\n#endif\n\n#endif\n\n/* }================================================================== */\n\n\n/*\n@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles\n@* as a percentage.\n** CHANGE it if you want the GC to run faster or slower (higher values\n** mean larger pauses which mean slower collection.) You can also change\n** this value dynamically.\n*/\n#define LUAI_GCPAUSE\t200  /* 200% (wait memory to double before next GC) */\n\n\n/*\n@@ LUAI_GCMUL defines the default speed of garbage collection relative to\n@* memory allocation as a percentage.\n** CHANGE it if you want to change the granularity of the garbage\n** collection. (Higher values mean coarser collections. 0 represents\n** infinity, where each step performs a full collection.) You can also\n** change this value dynamically.\n*/\n#define LUAI_GCMUL\t200 /* GC runs 'twice the speed' of memory allocation */\n\n\n\n/*\n@@ LUA_COMPAT_GETN controls compatibility with old getn behavior.\n** CHANGE it (define it) if you want exact compatibility with the\n** behavior of setn/getn in Lua 5.0.\n*/\n#undef LUA_COMPAT_GETN\n\n/*\n@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.\n** CHANGE it to undefined as soon as you do not need a global 'loadlib'\n** function (the function is still available as 'package.loadlib').\n*/\n#undef LUA_COMPAT_LOADLIB\n\n/*\n@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.\n** CHANGE it to undefined as soon as your programs use only '...' to\n** access vararg parameters (instead of the old 'arg' table).\n*/\n#define LUA_COMPAT_VARARG\n\n/*\n@@ LUA_COMPAT_MOD controls compatibility with old math.mod function.\n** CHANGE it to undefined as soon as your programs use 'math.fmod' or\n** the new '%' operator instead of 'math.mod'.\n*/\n#define LUA_COMPAT_MOD\n\n/*\n@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting\n@* facility.\n** CHANGE it to 2 if you want the old behaviour, or undefine it to turn\n** off the advisory error when nesting [[...]].\n*/\n#define LUA_COMPAT_LSTR\t\t1\n\n/*\n@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.\n** CHANGE it to undefined as soon as you rename 'string.gfind' to\n** 'string.gmatch'.\n*/\n#define LUA_COMPAT_GFIND\n\n/*\n@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'\n@* behavior.\n** CHANGE it to undefined as soon as you replace to 'luaL_register'\n** your uses of 'luaL_openlib'\n*/\n#define LUA_COMPAT_OPENLIB\n\n\n\n/*\n@@ luai_apicheck is the assert macro used by the Lua-C API.\n** CHANGE luai_apicheck if you want Lua to perform some checks in the\n** parameters it gets from API calls. This may slow down the interpreter\n** a bit, but may be quite useful when debugging C code that interfaces\n** with Lua. A useful redefinition is to use assert.h.\n*/\n#if defined(LUA_USE_APICHECK)\n#include <assert.h>\n#define luai_apicheck(L,o)\t{ (void)L; assert(o); }\n#else\n#define luai_apicheck(L,o)\t{ (void)L; }\n#endif\n\n\n/*\n@@ LUAI_BITSINT defines the number of bits in an int.\n** CHANGE here if Lua cannot automatically detect the number of bits of\n** your machine. Probably you do not need to change this.\n*/\n/* avoid overflows in comparison */\n#if INT_MAX-20 < 32760\n#define LUAI_BITSINT\t16\n#elif INT_MAX > 2147483640L\n/* int has at least 32 bits */\n#define LUAI_BITSINT\t32\n#else\n#error \"you must define LUA_BITSINT with number of bits in an integer\"\n#endif\n\n\n/*\n@@ LUAI_UINT32 is an unsigned integer with at least 32 bits.\n@@ LUAI_INT32 is an signed integer with at least 32 bits.\n@@ LUAI_UMEM is an unsigned integer big enough to count the total\n@* memory used by Lua.\n@@ LUAI_MEM is a signed integer big enough to count the total memory\n@* used by Lua.\n** CHANGE here if for some weird reason the default definitions are not\n** good enough for your machine. (The definitions in the 'else'\n** part always works, but may waste space on machines with 64-bit\n** longs.) Probably you do not need to change this.\n*/\n#if LUAI_BITSINT >= 32\n#define LUAI_UINT32\tunsigned int\n#define LUAI_INT32\tint\n#define LUAI_MAXINT32\tINT_MAX\n#define LUAI_UMEM\tsize_t\n#define LUAI_MEM\tptrdiff_t\n#else\n/* 16-bit ints */\n#define LUAI_UINT32\tunsigned long\n#define LUAI_INT32\tlong\n#define LUAI_MAXINT32\tLONG_MAX\n#define LUAI_UMEM\tunsigned long\n#define LUAI_MEM\tlong\n#endif\n\n\n/*\n@@ LUAI_MAXCALLS limits the number of nested calls.\n** CHANGE it if you need really deep recursive calls. This limit is\n** arbitrary; its only purpose is to stop infinite recursion before\n** exhausting memory.\n*/\n#define LUAI_MAXCALLS\t20000\n\n\n/*\n@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function\n@* can use.\n** CHANGE it if you need lots of (Lua) stack space for your C\n** functions. This limit is arbitrary; its only purpose is to stop C\n** functions to consume unlimited stack space. (must be smaller than\n** -LUA_REGISTRYINDEX)\n*/\n#define LUAI_MAXCSTACK\t8000\n\n\n\n/*\n** {==================================================================\n** CHANGE (to smaller values) the following definitions if your system\n** has a small C stack. (Or you may want to change them to larger\n** values if your system has a large C stack and these limits are\n** too rigid for you.) Some of these constants control the size of\n** stack-allocated arrays used by the compiler or the interpreter, while\n** others limit the maximum number of recursive calls that the compiler\n** or the interpreter can perform. Values too large may cause a C stack\n** overflow for some forms of deep constructs.\n** ===================================================================\n*/\n\n\n/*\n@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and\n@* syntactical nested non-terminals in a program.\n*/\n#define LUAI_MAXCCALLS\t\t200\n\n\n/*\n@@ LUAI_MAXVARS is the maximum number of local variables per function\n@* (must be smaller than 250).\n*/\n#define LUAI_MAXVARS\t\t200\n\n\n/*\n@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function\n@* (must be smaller than 250).\n*/\n#define LUAI_MAXUPVALUES\t60\n\n\n/*\n@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.\n*/\n#define LUAL_BUFFERSIZE\t\tBUFSIZ\n\n/* }================================================================== */\n\n\n\n\n/*\n** {==================================================================\n@@ LUA_NUMBER is the type of numbers in Lua.\n** CHANGE the following definitions only if you want to build Lua\n** with a number type different from double. You may also need to\n** change lua_number2int & lua_number2integer.\n** ===================================================================\n*/\n\n#define LUA_NUMBER_DOUBLE\n#define LUA_NUMBER\tdouble\n\n/*\n@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'\n@* over a number.\n*/\n#define LUAI_UACNUMBER\tdouble\n\n\n/*\n@@ LUA_NUMBER_SCAN is the format for reading numbers.\n@@ LUA_NUMBER_FMT is the format for writing numbers.\n@@ lua_number2str converts a number to a string.\n@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.\n@@ lua_str2number converts a string to a number.\n*/\n#define LUA_NUMBER_SCAN\t\t\"%lf\"\n#define LUA_NUMBER_FMT\t\t\"%.14g\"\n#define lua_number2str(s,n)\tsprintf((s), LUA_NUMBER_FMT, (n))\n#define LUAI_MAXNUMBER2STR\t32 /* 16 digits, sign, point, and \\0 */\n#define lua_str2number(s,p)\tstrtod((s), (p))\n\n\n/*\n@@ The luai_num* macros define the primitive operations over numbers.\n*/\n#if defined(LUA_CORE)\n#include <math.h>\n#define luai_numadd(a,b)\t((a)+(b))\n#define luai_numsub(a,b)\t((a)-(b))\n#define luai_nummul(a,b)\t((a)*(b))\n#define luai_numdiv(a,b)\t((a)/(b))\n#define luai_nummod(a,b)\t((a) - floor((a)/(b))*(b))\n#define luai_numpow(a,b)\t(pow(a,b))\n#define luai_numunm(a)\t\t(-(a))\n#define luai_numeq(a,b)\t\t((a)==(b))\n#define luai_numlt(a,b)\t\t((a)<(b))\n#define luai_numle(a,b)\t\t((a)<=(b))\n#define luai_numisnan(a)\t(!luai_numeq((a), (a)))\n#endif\n\n\n/*\n@@ lua_number2int is a macro to convert lua_Number to int.\n@@ lua_number2integer is a macro to convert lua_Number to lua_Integer.\n** CHANGE them if you know a faster way to convert a lua_Number to\n** int (with any rounding method and without throwing errors) in your\n** system. In Pentium machines, a naive typecast from double to int\n** in C is extremely slow, so any alternative is worth trying.\n*/\n\n/* On a Pentium, resort to a trick */\n#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \\\n    (defined(__i386) || defined (_M_IX86) || defined(__i386__))\n\n/* On a Microsoft compiler, use assembler */\n#if defined(_MSC_VER)\n\n#define lua_number2int(i,d)   __asm fld d   __asm fistp i\n#define lua_number2integer(i,n)\t\tlua_number2int(i, n)\n\n/* the next trick should work on any Pentium, but sometimes clashes\n   with a DirectX idiosyncrasy */\n#else\n\nunion luai_Cast { double l_d; long l_l; };\n#define lua_number2int(i,d) \\\n  { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }\n#define lua_number2integer(i,n)\t\tlua_number2int(i, n)\n\n#endif\n\n\n/* this option always works, but may be slow */\n#else\n#define lua_number2int(i,d)\t((i)=(int)(d))\n#define lua_number2integer(i,d)\t((i)=(lua_Integer)(d))\n\n#endif\n\n/* }================================================================== */\n\n\n/*\n@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.\n** CHANGE it if your system requires alignments larger than double. (For\n** instance, if your system supports long doubles and they must be\n** aligned in 16-byte boundaries, then you should add long double in the\n** union.) Probably you do not need to change this.\n*/\n#define LUAI_USER_ALIGNMENT_T\tunion { double u; void *s; long l; }\n\n\n/*\n@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling.\n** CHANGE them if you prefer to use longjmp/setjmp even with C++\n** or if want/don't to use _longjmp/_setjmp instead of regular\n** longjmp/setjmp. By default, Lua handles errors with exceptions when\n** compiling as C++ code, with _longjmp/_setjmp when asked to use them,\n** and with longjmp/setjmp otherwise.\n*/\n#if defined(__cplusplus)\n/* C++ exceptions */\n#define LUAI_THROW(L,c)\tthrow(c)\n#define LUAI_TRY(L,c,a)\ttry { a } catch(...) \\\n\t{ if ((c)->status == 0) (c)->status = -1; }\n#define luai_jmpbuf\tint  /* dummy variable */\n\n#elif defined(LUA_USE_ULONGJMP)\n/* in Unix, try _longjmp/_setjmp (more efficient) */\n#define LUAI_THROW(L,c)\t_longjmp((c)->b, 1)\n#define LUAI_TRY(L,c,a)\tif (_setjmp((c)->b) == 0) { a }\n#define luai_jmpbuf\tjmp_buf\n\n#else\n/* default handling with long jumps */\n#define LUAI_THROW(L,c)\tlongjmp((c)->b, 1)\n#define LUAI_TRY(L,c,a)\tif (setjmp((c)->b) == 0) { a }\n#define luai_jmpbuf\tjmp_buf\n\n#endif\n\n\n/*\n@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern\n@* can do during pattern-matching.\n** CHANGE it if you need more captures. This limit is arbitrary.\n*/\n#define LUA_MAXCAPTURES\t\t32\n\n\n/*\n@@ lua_tmpnam is the function that the OS library uses to create a\n@* temporary name.\n@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam.\n** CHANGE them if you have an alternative to tmpnam (which is considered\n** insecure) or if you want the original tmpnam anyway.  By default, Lua\n** uses tmpnam except when POSIX is available, where it uses mkstemp.\n*/\n#if defined(loslib_c) || defined(luaall_c)\n\n#if defined(LUA_USE_MKSTEMP)\n#include <unistd.h>\n#define LUA_TMPNAMBUFSIZE\t32\n#define lua_tmpnam(b,e)\t{ \\\n\tstrcpy(b, \"/tmp/lua_XXXXXX\"); \\\n\te = mkstemp(b); \\\n\tif (e != -1) close(e); \\\n\te = (e == -1); }\n\n#else\n#define LUA_TMPNAMBUFSIZE\tL_tmpnam\n#define lua_tmpnam(b,e)\t\t{ e = (tmpnam(b) == NULL); }\n#endif\n\n#endif\n\n\n/*\n@@ lua_popen spawns a new process connected to the current one through\n@* the file streams.\n** CHANGE it if you have a way to implement it in your system.\n*/\n#if defined(LUA_USE_POPEN)\n\n#define lua_popen(L,c,m)\t((void)L, fflush(NULL), popen(c,m))\n#define lua_pclose(L,file)\t((void)L, (pclose(file) != -1))\n\n#elif defined(LUA_WIN)\n\n#define lua_popen(L,c,m)\t((void)L, _popen(c,m))\n#define lua_pclose(L,file)\t((void)L, (_pclose(file) != -1))\n\n#else\n\n#define lua_popen(L,c,m)\t((void)((void)c, m),  \\\n\t\tluaL_error(L, LUA_QL(\"popen\") \" not supported\"), (FILE*)0)\n#define lua_pclose(L,file)\t\t((void)((void)L, file), 0)\n\n#endif\n\n/*\n@@ LUA_DL_* define which dynamic-library system Lua should use.\n** CHANGE here if Lua has problems choosing the appropriate\n** dynamic-library system for your platform (either Windows' DLL, Mac's\n** dyld, or Unix's dlopen). If your system is some kind of Unix, there\n** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for\n** it.  To use dlopen you also need to adapt the src/Makefile (probably\n** adding -ldl to the linker options), so Lua does not select it\n** automatically.  (When you change the makefile to add -ldl, you must\n** also add -DLUA_USE_DLOPEN.)\n** If you do not want any kind of dynamic library, undefine all these\n** options.\n** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD.\n*/\n#if defined(LUA_USE_DLOPEN)\n#define LUA_DL_DLOPEN\n#endif\n\n#if defined(LUA_WIN)\n#define LUA_DL_DLL\n#endif\n\n\n/*\n@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State\n@* (the data goes just *before* the lua_State pointer).\n** CHANGE (define) this if you really need that. This value must be\n** a multiple of the maximum alignment required for your machine.\n*/\n#define LUAI_EXTRASPACE\t\t0\n\n\n/*\n@@ luai_userstate* allow user-specific actions on threads.\n** CHANGE them if you defined LUAI_EXTRASPACE and need to do something\n** extra when a thread is created/deleted/resumed/yielded.\n*/\n#define luai_userstateopen(L)\t\t((void)L)\n#define luai_userstateclose(L)\t\t((void)L)\n#define luai_userstatethread(L,L1)\t((void)L)\n#define luai_userstatefree(L)\t\t((void)L)\n#define luai_userstateresume(L,n)\t((void)L)\n#define luai_userstateyield(L,n)\t((void)L)\n\n\n/*\n@@ LUA_INTFRMLEN is the length modifier for integer conversions\n@* in 'string.format'.\n@@ LUA_INTFRM_T is the integer type correspoding to the previous length\n@* modifier.\n** CHANGE them if your system supports long long or does not support long.\n*/\n\n#if defined(LUA_USELONGLONG)\n\n#define LUA_INTFRMLEN\t\t\"ll\"\n#define LUA_INTFRM_T\t\tlong long\n\n#else\n\n#define LUA_INTFRMLEN\t\t\"l\"\n#define LUA_INTFRM_T\t\tlong\n\n#endif\n\n\n\n/* =================================================================== */\n\n/*\n** Local configuration. You can use this space to add your redefinitions\n** without modifying the main part of the file.\n*/\n\n\n#endif\n\n"
  },
  {
    "path": "jni/lua/lualib.h",
    "content": "/*\n** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $\n** Lua standard libraries\n** See Copyright Notice in lua.h\n*/\n\n\n#ifndef lualib_h\n#define lualib_h\n\n#include \"lua.h\"\n\n\n/* Key to file-handle type */\n#define LUA_FILEHANDLE\t\t\"FILE*\"\n\n\n#define LUA_COLIBNAME\t\"coroutine\"\nLUALIB_API int (luaopen_base) (lua_State *L);\n\n#define LUA_TABLIBNAME\t\"table\"\nLUALIB_API int (luaopen_table) (lua_State *L);\n\n#define LUA_IOLIBNAME\t\"io\"\nLUALIB_API int (luaopen_io) (lua_State *L);\n\n#define LUA_OSLIBNAME\t\"os\"\nLUALIB_API int (luaopen_os) (lua_State *L);\n\n#define LUA_STRLIBNAME\t\"string\"\nLUALIB_API int (luaopen_string) (lua_State *L);\n\n#define LUA_MATHLIBNAME\t\"math\"\nLUALIB_API int (luaopen_math) (lua_State *L);\n\n#define LUA_DBLIBNAME\t\"debug\"\nLUALIB_API int (luaopen_debug) (lua_State *L);\n\n#define LUA_LOADLIBNAME\t\"package\"\nLUALIB_API int (luaopen_package) (lua_State *L);\n\n\n/* open all previous libraries */\nLUALIB_API void (luaL_openlibs) (lua_State *L); \n\n\n\n#ifndef lua_assert\n#define lua_assert(x)\t((void)0)\n#endif\n\n\n#endif\n"
  },
  {
    "path": "jni/lua/lundump.c",
    "content": "/*\n** $Id: lundump.c,v 2.7.1.4 2008/04/04 19:51:41 roberto Exp $\n** load precompiled Lua chunks\n** See Copyright Notice in lua.h\n*/\n\n#include <string.h>\n\n#define lundump_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"ldebug.h\"\n#include \"ldo.h\"\n#include \"lfunc.h\"\n#include \"lmem.h\"\n#include \"lobject.h\"\n#include \"lstring.h\"\n#include \"lundump.h\"\n#include \"lzio.h\"\n\ntypedef struct {\n lua_State* L;\n ZIO* Z;\n Mbuffer* b;\n const char* name;\n} LoadState;\n\n#ifdef LUAC_TRUST_BINARIES\n#define IF(c,s)\n#define error(S,s)\n#else\n#define IF(c,s)\t\tif (c) error(S,s)\n\nstatic void error(LoadState* S, const char* why)\n{\n luaO_pushfstring(S->L,\"%s: %s in precompiled chunk\",S->name,why);\n luaD_throw(S->L,LUA_ERRSYNTAX);\n}\n#endif\n\n#define LoadMem(S,b,n,size)\tLoadBlock(S,b,(n)*(size))\n#define\tLoadByte(S)\t\t(lu_byte)LoadChar(S)\n#define LoadVar(S,x)\t\tLoadMem(S,&x,1,sizeof(x))\n#define LoadVector(S,b,n,size)\tLoadMem(S,b,n,size)\n\nstatic void LoadBlock(LoadState* S, void* b, size_t size)\n{\n size_t r=luaZ_read(S->Z,b,size);\n IF (r!=0, \"unexpected end\");\n}\n\nstatic int LoadChar(LoadState* S)\n{\n char x;\n LoadVar(S,x);\n return x;\n}\n\nstatic int LoadInt(LoadState* S)\n{\n int x;\n LoadVar(S,x);\n IF (x<0, \"bad integer\");\n return x;\n}\n\nstatic lua_Number LoadNumber(LoadState* S)\n{\n lua_Number x;\n LoadVar(S,x);\n return x;\n}\n\nstatic TString* LoadString(LoadState* S)\n{\n size_t size;\n LoadVar(S,size);\n if (size==0)\n  return NULL;\n else\n {\n  char* s=luaZ_openspace(S->L,S->b,size);\n  LoadBlock(S,s,size);\n  return luaS_newlstr(S->L,s,size-1);\t\t/* remove trailing '\\0' */\n }\n}\n\nstatic void LoadCode(LoadState* S, Proto* f)\n{\n int n=LoadInt(S);\n f->code=luaM_newvector(S->L,n,Instruction);\n f->sizecode=n;\n LoadVector(S,f->code,n,sizeof(Instruction));\n}\n\nstatic Proto* LoadFunction(LoadState* S, TString* p);\n\nstatic void LoadConstants(LoadState* S, Proto* f)\n{\n int i,n;\n n=LoadInt(S);\n f->k=luaM_newvector(S->L,n,TValue);\n f->sizek=n;\n for (i=0; i<n; i++) setnilvalue(&f->k[i]);\n for (i=0; i<n; i++)\n {\n  TValue* o=&f->k[i];\n  int t=LoadChar(S);\n  switch (t)\n  {\n   case LUA_TNIL:\n   \tsetnilvalue(o);\n\tbreak;\n   case LUA_TBOOLEAN:\n   \tsetbvalue(o,LoadChar(S)!=0);\n\tbreak;\n   case LUA_TNUMBER:\n\tsetnvalue(o,LoadNumber(S));\n\tbreak;\n   case LUA_TSTRING:\n\tsetsvalue2n(S->L,o,LoadString(S));\n\tbreak;\n   default:\n\terror(S,\"bad constant\");\n\tbreak;\n  }\n }\n n=LoadInt(S);\n f->p=luaM_newvector(S->L,n,Proto*);\n f->sizep=n;\n for (i=0; i<n; i++) f->p[i]=NULL;\n for (i=0; i<n; i++) f->p[i]=LoadFunction(S,f->source);\n}\n\nstatic void LoadDebug(LoadState* S, Proto* f)\n{\n int i,n;\n n=LoadInt(S);\n f->lineinfo=luaM_newvector(S->L,n,int);\n f->sizelineinfo=n;\n LoadVector(S,f->lineinfo,n,sizeof(int));\n n=LoadInt(S);\n f->locvars=luaM_newvector(S->L,n,LocVar);\n f->sizelocvars=n;\n for (i=0; i<n; i++) f->locvars[i].varname=NULL;\n for (i=0; i<n; i++)\n {\n  f->locvars[i].varname=LoadString(S);\n  f->locvars[i].startpc=LoadInt(S);\n  f->locvars[i].endpc=LoadInt(S);\n }\n n=LoadInt(S);\n f->upvalues=luaM_newvector(S->L,n,TString*);\n f->sizeupvalues=n;\n for (i=0; i<n; i++) f->upvalues[i]=NULL;\n for (i=0; i<n; i++) f->upvalues[i]=LoadString(S);\n}\n\nstatic Proto* LoadFunction(LoadState* S, TString* p)\n{\n Proto* f;\n if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,\"code too deep\");\n f=luaF_newproto(S->L);\n setptvalue2s(S->L,S->L->top,f); incr_top(S->L);\n f->source=LoadString(S); if (f->source==NULL) f->source=p;\n f->linedefined=LoadInt(S);\n f->lastlinedefined=LoadInt(S);\n f->nups=LoadByte(S);\n f->numparams=LoadByte(S);\n f->is_vararg=LoadByte(S);\n f->maxstacksize=LoadByte(S);\n LoadCode(S,f);\n LoadConstants(S,f);\n LoadDebug(S,f);\n IF (!luaG_checkcode(f), \"bad code\");\n S->L->top--;\n S->L->nCcalls--;\n return f;\n}\n\nstatic void LoadHeader(LoadState* S)\n{\n char h[LUAC_HEADERSIZE];\n char s[LUAC_HEADERSIZE];\n luaU_header(h);\n LoadBlock(S,s,LUAC_HEADERSIZE);\n IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, \"bad header\");\n}\n\n/*\n** load precompiled chunk\n*/\nProto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name)\n{\n LoadState S;\n if (*name=='@' || *name=='=')\n  S.name=name+1;\n else if (*name==LUA_SIGNATURE[0])\n  S.name=\"binary string\";\n else\n  S.name=name;\n S.L=L;\n S.Z=Z;\n S.b=buff;\n LoadHeader(&S);\n return LoadFunction(&S,luaS_newliteral(L,\"=?\"));\n}\n\n/*\n* make header\n*/\nvoid luaU_header (char* h)\n{\n int x=1;\n memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1);\n h+=sizeof(LUA_SIGNATURE)-1;\n *h++=(char)LUAC_VERSION;\n *h++=(char)LUAC_FORMAT;\n *h++=(char)*(char*)&x;\t\t\t\t/* endianness */\n *h++=(char)sizeof(int);\n *h++=(char)sizeof(size_t);\n *h++=(char)sizeof(Instruction);\n *h++=(char)sizeof(lua_Number);\n *h++=(char)(((lua_Number)0.5)==0);\t\t/* is lua_Number integral? */\n}\n"
  },
  {
    "path": "jni/lua/lundump.h",
    "content": "/*\n** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $\n** load precompiled Lua chunks\n** See Copyright Notice in lua.h\n*/\n\n#ifndef lundump_h\n#define lundump_h\n\n#include \"lobject.h\"\n#include \"lzio.h\"\n\n/* load one chunk; from lundump.c */\nLUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name);\n\n/* make header; from lundump.c */\nLUAI_FUNC void luaU_header (char* h);\n\n/* dump one chunk; from ldump.c */\nLUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);\n\n#ifdef luac_c\n/* print one chunk; from print.c */\nLUAI_FUNC void luaU_print (const Proto* f, int full);\n#endif\n\n/* for header of binary files -- this is Lua 5.1 */\n#define LUAC_VERSION\t\t0x51\n\n/* for header of binary files -- this is the official format */\n#define LUAC_FORMAT\t\t0\n\n/* size of header of binary files */\n#define LUAC_HEADERSIZE\t\t12\n\n#endif\n"
  },
  {
    "path": "jni/lua/lvm.c",
    "content": "/*\n** $Id: lvm.c,v 2.63.1.5 2011/08/17 20:43:11 roberto Exp $\n** Lua virtual machine\n** See Copyright Notice in lua.h\n*/\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define lvm_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"ldebug.h\"\n#include \"ldo.h\"\n#include \"lfunc.h\"\n#include \"lgc.h\"\n#include \"lobject.h\"\n#include \"lopcodes.h\"\n#include \"lstate.h\"\n#include \"lstring.h\"\n#include \"ltable.h\"\n#include \"ltm.h\"\n#include \"lvm.h\"\n\n\n\n/* limit for table tag-method chains (to avoid loops) */\n#define MAXTAGLOOP\t100\n\n\nconst TValue *luaV_tonumber (const TValue *obj, TValue *n) {\n  lua_Number num;\n  if (ttisnumber(obj)) return obj;\n  if (ttisstring(obj) && luaO_str2d(svalue(obj), &num)) {\n    setnvalue(n, num);\n    return n;\n  }\n  else\n    return NULL;\n}\n\n\nint luaV_tostring (lua_State *L, StkId obj) {\n  if (!ttisnumber(obj))\n    return 0;\n  else {\n    char s[LUAI_MAXNUMBER2STR];\n    lua_Number n = nvalue(obj);\n    lua_number2str(s, n);\n    setsvalue2s(L, obj, luaS_new(L, s));\n    return 1;\n  }\n}\n\n\nstatic void traceexec (lua_State *L, const Instruction *pc) {\n  lu_byte mask = L->hookmask;\n  const Instruction *oldpc = L->savedpc;\n  L->savedpc = pc;\n  if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) {\n    resethookcount(L);\n    luaD_callhook(L, LUA_HOOKCOUNT, -1);\n  }\n  if (mask & LUA_MASKLINE) {\n    Proto *p = ci_func(L->ci)->l.p;\n    int npc = pcRel(pc, p);\n    int newline = getline(p, npc);\n    /* call linehook when enter a new function, when jump back (loop),\n       or when enter a new line */\n    if (npc == 0 || pc <= oldpc || newline != getline(p, pcRel(oldpc, p)))\n      luaD_callhook(L, LUA_HOOKLINE, newline);\n  }\n}\n\n\nstatic void callTMres (lua_State *L, StkId res, const TValue *f,\n                        const TValue *p1, const TValue *p2) {\n  ptrdiff_t result = savestack(L, res);\n  setobj2s(L, L->top, f);  /* push function */\n  setobj2s(L, L->top+1, p1);  /* 1st argument */\n  setobj2s(L, L->top+2, p2);  /* 2nd argument */\n  luaD_checkstack(L, 3);\n  L->top += 3;\n  luaD_call(L, L->top - 3, 1);\n  res = restorestack(L, result);\n  L->top--;\n  setobjs2s(L, res, L->top);\n}\n\n\n\nstatic void callTM (lua_State *L, const TValue *f, const TValue *p1,\n                    const TValue *p2, const TValue *p3) {\n  setobj2s(L, L->top, f);  /* push function */\n  setobj2s(L, L->top+1, p1);  /* 1st argument */\n  setobj2s(L, L->top+2, p2);  /* 2nd argument */\n  setobj2s(L, L->top+3, p3);  /* 3th argument */\n  luaD_checkstack(L, 4);\n  L->top += 4;\n  luaD_call(L, L->top - 4, 0);\n}\n\n\nvoid luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) {\n  int loop;\n  for (loop = 0; loop < MAXTAGLOOP; loop++) {\n    const TValue *tm;\n    if (ttistable(t)) {  /* `t' is a table? */\n      Table *h = hvalue(t);\n      const TValue *res = luaH_get(h, key); /* do a primitive get */\n      if (!ttisnil(res) ||  /* result is no nil? */\n          (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */\n        setobj2s(L, val, res);\n        return;\n      }\n      /* else will try the tag method */\n    }\n    else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX)))\n      luaG_typeerror(L, t, \"index\");\n    if (ttisfunction(tm)) {\n      callTMres(L, val, tm, t, key);\n      return;\n    }\n    t = tm;  /* else repeat with `tm' */ \n  }\n  luaG_runerror(L, \"loop in gettable\");\n}\n\n\nvoid luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {\n  int loop;\n  TValue temp;\n  for (loop = 0; loop < MAXTAGLOOP; loop++) {\n    const TValue *tm;\n    if (ttistable(t)) {  /* `t' is a table? */\n      Table *h = hvalue(t);\n      TValue *oldval = luaH_set(L, h, key); /* do a primitive set */\n      if (!ttisnil(oldval) ||  /* result is no nil? */\n          (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */\n        setobj2t(L, oldval, val);\n        h->flags = 0;\n        luaC_barriert(L, h, val);\n        return;\n      }\n      /* else will try the tag method */\n    }\n    else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX)))\n      luaG_typeerror(L, t, \"index\");\n    if (ttisfunction(tm)) {\n      callTM(L, tm, t, key, val);\n      return;\n    }\n    /* else repeat with `tm' */\n    setobj(L, &temp, tm);  /* avoid pointing inside table (may rehash) */\n    t = &temp;\n  }\n  luaG_runerror(L, \"loop in settable\");\n}\n\n\nstatic int call_binTM (lua_State *L, const TValue *p1, const TValue *p2,\n                       StkId res, TMS event) {\n  const TValue *tm = luaT_gettmbyobj(L, p1, event);  /* try first operand */\n  if (ttisnil(tm))\n    tm = luaT_gettmbyobj(L, p2, event);  /* try second operand */\n  if (ttisnil(tm)) return 0;\n  callTMres(L, res, tm, p1, p2);\n  return 1;\n}\n\n\nstatic const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2,\n                                  TMS event) {\n  const TValue *tm1 = fasttm(L, mt1, event);\n  const TValue *tm2;\n  if (tm1 == NULL) return NULL;  /* no metamethod */\n  if (mt1 == mt2) return tm1;  /* same metatables => same metamethods */\n  tm2 = fasttm(L, mt2, event);\n  if (tm2 == NULL) return NULL;  /* no metamethod */\n  if (luaO_rawequalObj(tm1, tm2))  /* same metamethods? */\n    return tm1;\n  return NULL;\n}\n\n\nstatic int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2,\n                         TMS event) {\n  const TValue *tm1 = luaT_gettmbyobj(L, p1, event);\n  const TValue *tm2;\n  if (ttisnil(tm1)) return -1;  /* no metamethod? */\n  tm2 = luaT_gettmbyobj(L, p2, event);\n  if (!luaO_rawequalObj(tm1, tm2))  /* different metamethods? */\n    return -1;\n  callTMres(L, L->top, tm1, p1, p2);\n  return !l_isfalse(L->top);\n}\n\n\nstatic int l_strcmp (const TString *ls, const TString *rs) {\n  const char *l = getstr(ls);\n  size_t ll = ls->tsv.len;\n  const char *r = getstr(rs);\n  size_t lr = rs->tsv.len;\n  for (;;) {\n    int temp = strcoll(l, r);\n    if (temp != 0) return temp;\n    else {  /* strings are equal up to a `\\0' */\n      size_t len = strlen(l);  /* index of first `\\0' in both strings */\n      if (len == lr)  /* r is finished? */\n        return (len == ll) ? 0 : 1;\n      else if (len == ll)  /* l is finished? */\n        return -1;  /* l is smaller than r (because r is not finished) */\n      /* both strings longer than `len'; go on comparing (after the `\\0') */\n      len++;\n      l += len; ll -= len; r += len; lr -= len;\n    }\n  }\n}\n\n\nint luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) {\n  int res;\n  if (ttype(l) != ttype(r))\n    return luaG_ordererror(L, l, r);\n  else if (ttisnumber(l))\n    return luai_numlt(nvalue(l), nvalue(r));\n  else if (ttisstring(l))\n    return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0;\n  else if ((res = call_orderTM(L, l, r, TM_LT)) != -1)\n    return res;\n  return luaG_ordererror(L, l, r);\n}\n\n\nstatic int lessequal (lua_State *L, const TValue *l, const TValue *r) {\n  int res;\n  if (ttype(l) != ttype(r))\n    return luaG_ordererror(L, l, r);\n  else if (ttisnumber(l))\n    return luai_numle(nvalue(l), nvalue(r));\n  else if (ttisstring(l))\n    return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0;\n  else if ((res = call_orderTM(L, l, r, TM_LE)) != -1)  /* first try `le' */\n    return res;\n  else if ((res = call_orderTM(L, r, l, TM_LT)) != -1)  /* else try `lt' */\n    return !res;\n  return luaG_ordererror(L, l, r);\n}\n\n\nint luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) {\n  const TValue *tm;\n  lua_assert(ttype(t1) == ttype(t2));\n  switch (ttype(t1)) {\n    case LUA_TNIL: return 1;\n    case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2));\n    case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2);  /* true must be 1 !! */\n    case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);\n    case LUA_TUSERDATA: {\n      if (uvalue(t1) == uvalue(t2)) return 1;\n      tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable,\n                         TM_EQ);\n      break;  /* will try TM */\n    }\n    case LUA_TTABLE: {\n      if (hvalue(t1) == hvalue(t2)) return 1;\n      tm = get_compTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ);\n      break;  /* will try TM */\n    }\n    default: return gcvalue(t1) == gcvalue(t2);\n  }\n  if (tm == NULL) return 0;  /* no TM? */\n  callTMres(L, L->top, tm, t1, t2);  /* call TM */\n  return !l_isfalse(L->top);\n}\n\n\nvoid luaV_concat (lua_State *L, int total, int last) {\n  do {\n    StkId top = L->base + last + 1;\n    int n = 2;  /* number of elements handled in this pass (at least 2) */\n    if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) {\n      if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT))\n        luaG_concaterror(L, top-2, top-1);\n    } else if (tsvalue(top-1)->len == 0)  /* second op is empty? */\n      (void)tostring(L, top - 2);  /* result is first op (as string) */\n    else {\n      /* at least two string values; get as many as possible */\n      size_t tl = tsvalue(top-1)->len;\n      char *buffer;\n      int i;\n      /* collect total length */\n      for (n = 1; n < total && tostring(L, top-n-1); n++) {\n        size_t l = tsvalue(top-n-1)->len;\n        if (l >= MAX_SIZET - tl) luaG_runerror(L, \"string length overflow\");\n        tl += l;\n      }\n      buffer = luaZ_openspace(L, &G(L)->buff, tl);\n      tl = 0;\n      for (i=n; i>0; i--) {  /* concat all strings */\n        size_t l = tsvalue(top-i)->len;\n        memcpy(buffer+tl, svalue(top-i), l);\n        tl += l;\n      }\n      setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl));\n    }\n    total -= n-1;  /* got `n' strings to create 1 new */\n    last -= n-1;\n  } while (total > 1);  /* repeat until only 1 result left */\n}\n\n\nstatic void Arith (lua_State *L, StkId ra, const TValue *rb,\n                   const TValue *rc, TMS op) {\n  TValue tempb, tempc;\n  const TValue *b, *c;\n  if ((b = luaV_tonumber(rb, &tempb)) != NULL &&\n      (c = luaV_tonumber(rc, &tempc)) != NULL) {\n    lua_Number nb = nvalue(b), nc = nvalue(c);\n    switch (op) {\n      case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break;\n      case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break;\n      case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break;\n      case TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)); break;\n      case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break;\n      case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break;\n      case TM_UNM: setnvalue(ra, luai_numunm(nb)); break;\n      default: lua_assert(0); break;\n    }\n  }\n  else if (!call_binTM(L, rb, rc, ra, op))\n    luaG_aritherror(L, rb, rc);\n}\n\n\n\n/*\n** some macros for common tasks in `luaV_execute'\n*/\n\n#define runtime_check(L, c)\t{ if (!(c)) break; }\n\n#define RA(i)\t(base+GETARG_A(i))\n/* to be used after possible stack reallocation */\n#define RB(i)\tcheck_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i))\n#define RC(i)\tcheck_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i))\n#define RKB(i)\tcheck_exp(getBMode(GET_OPCODE(i)) == OpArgK, \\\n\tISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i))\n#define RKC(i)\tcheck_exp(getCMode(GET_OPCODE(i)) == OpArgK, \\\n\tISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i))\n#define KBx(i)\tcheck_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i))\n\n\n#define dojump(L,pc,i)\t{(pc) += (i); luai_threadyield(L);}\n\n\n#define Protect(x)\t{ L->savedpc = pc; {x;}; base = L->base; }\n\n\n#define arith_op(op,tm) { \\\n        TValue *rb = RKB(i); \\\n        TValue *rc = RKC(i); \\\n        if (ttisnumber(rb) && ttisnumber(rc)) { \\\n          lua_Number nb = nvalue(rb), nc = nvalue(rc); \\\n          setnvalue(ra, op(nb, nc)); \\\n        } \\\n        else \\\n          Protect(Arith(L, ra, rb, rc, tm)); \\\n      }\n\n\n\nvoid luaV_execute (lua_State *L, int nexeccalls) {\n  LClosure *cl;\n  StkId base;\n  TValue *k;\n  const Instruction *pc;\n reentry:  /* entry point */\n  lua_assert(isLua(L->ci));\n  pc = L->savedpc;\n  cl = &clvalue(L->ci->func)->l;\n  base = L->base;\n  k = cl->p->k;\n  /* main loop of interpreter */\n  for (;;) {\n    const Instruction i = *pc++;\n    StkId ra;\n    if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) &&\n        (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) {\n      traceexec(L, pc);\n      if (L->status == LUA_YIELD) {  /* did hook yield? */\n        L->savedpc = pc - 1;\n        return;\n      }\n      base = L->base;\n    }\n    /* warning!! several calls may realloc the stack and invalidate `ra' */\n    ra = RA(i);\n    lua_assert(base == L->base && L->base == L->ci->base);\n    lua_assert(base <= L->top && L->top <= L->stack + L->stacksize);\n    lua_assert(L->top == L->ci->top || luaG_checkopenop(i));\n    switch (GET_OPCODE(i)) {\n      case OP_MOVE: {\n        setobjs2s(L, ra, RB(i));\n        continue;\n      }\n      case OP_LOADK: {\n        setobj2s(L, ra, KBx(i));\n        continue;\n      }\n      case OP_LOADBOOL: {\n        setbvalue(ra, GETARG_B(i));\n        if (GETARG_C(i)) pc++;  /* skip next instruction (if C) */\n        continue;\n      }\n      case OP_LOADNIL: {\n        TValue *rb = RB(i);\n        do {\n          setnilvalue(rb--);\n        } while (rb >= ra);\n        continue;\n      }\n      case OP_GETUPVAL: {\n        int b = GETARG_B(i);\n        setobj2s(L, ra, cl->upvals[b]->v);\n        continue;\n      }\n      case OP_GETGLOBAL: {\n        TValue g;\n        TValue *rb = KBx(i);\n        sethvalue(L, &g, cl->env);\n        lua_assert(ttisstring(rb));\n        Protect(luaV_gettable(L, &g, rb, ra));\n        continue;\n      }\n      case OP_GETTABLE: {\n        Protect(luaV_gettable(L, RB(i), RKC(i), ra));\n        continue;\n      }\n      case OP_SETGLOBAL: {\n        TValue g;\n        sethvalue(L, &g, cl->env);\n        lua_assert(ttisstring(KBx(i)));\n        Protect(luaV_settable(L, &g, KBx(i), ra));\n        continue;\n      }\n      case OP_SETUPVAL: {\n        UpVal *uv = cl->upvals[GETARG_B(i)];\n        setobj(L, uv->v, ra);\n        luaC_barrier(L, uv, ra);\n        continue;\n      }\n      case OP_SETTABLE: {\n        Protect(luaV_settable(L, ra, RKB(i), RKC(i)));\n        continue;\n      }\n      case OP_NEWTABLE: {\n        int b = GETARG_B(i);\n        int c = GETARG_C(i);\n        sethvalue(L, ra, luaH_new(L, luaO_fb2int(b), luaO_fb2int(c)));\n        Protect(luaC_checkGC(L));\n        continue;\n      }\n      case OP_SELF: {\n        StkId rb = RB(i);\n        setobjs2s(L, ra+1, rb);\n        Protect(luaV_gettable(L, rb, RKC(i), ra));\n        continue;\n      }\n      case OP_ADD: {\n        arith_op(luai_numadd, TM_ADD);\n        continue;\n      }\n      case OP_SUB: {\n        arith_op(luai_numsub, TM_SUB);\n        continue;\n      }\n      case OP_MUL: {\n        arith_op(luai_nummul, TM_MUL);\n        continue;\n      }\n      case OP_DIV: {\n        arith_op(luai_numdiv, TM_DIV);\n        continue;\n      }\n      case OP_MOD: {\n        arith_op(luai_nummod, TM_MOD);\n        continue;\n      }\n      case OP_POW: {\n        arith_op(luai_numpow, TM_POW);\n        continue;\n      }\n      case OP_UNM: {\n        TValue *rb = RB(i);\n        if (ttisnumber(rb)) {\n          lua_Number nb = nvalue(rb);\n          setnvalue(ra, luai_numunm(nb));\n        }\n        else {\n          Protect(Arith(L, ra, rb, rb, TM_UNM));\n        }\n        continue;\n      }\n      case OP_NOT: {\n        int res = l_isfalse(RB(i));  /* next assignment may change this value */\n        setbvalue(ra, res);\n        continue;\n      }\n      case OP_LEN: {\n        const TValue *rb = RB(i);\n        switch (ttype(rb)) {\n          case LUA_TTABLE: {\n            setnvalue(ra, cast_num(luaH_getn(hvalue(rb))));\n            break;\n          }\n          case LUA_TSTRING: {\n            setnvalue(ra, cast_num(tsvalue(rb)->len));\n            break;\n          }\n          default: {  /* try metamethod */\n            Protect(\n              if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN))\n                luaG_typeerror(L, rb, \"get length of\");\n            )\n          }\n        }\n        continue;\n      }\n      case OP_CONCAT: {\n        int b = GETARG_B(i);\n        int c = GETARG_C(i);\n        Protect(luaV_concat(L, c-b+1, c); luaC_checkGC(L));\n        setobjs2s(L, RA(i), base+b);\n        continue;\n      }\n      case OP_JMP: {\n        dojump(L, pc, GETARG_sBx(i));\n        continue;\n      }\n      case OP_EQ: {\n        TValue *rb = RKB(i);\n        TValue *rc = RKC(i);\n        Protect(\n          if (equalobj(L, rb, rc) == GETARG_A(i))\n            dojump(L, pc, GETARG_sBx(*pc));\n        )\n        pc++;\n        continue;\n      }\n      case OP_LT: {\n        Protect(\n          if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i))\n            dojump(L, pc, GETARG_sBx(*pc));\n        )\n        pc++;\n        continue;\n      }\n      case OP_LE: {\n        Protect(\n          if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i))\n            dojump(L, pc, GETARG_sBx(*pc));\n        )\n        pc++;\n        continue;\n      }\n      case OP_TEST: {\n        if (l_isfalse(ra) != GETARG_C(i))\n          dojump(L, pc, GETARG_sBx(*pc));\n        pc++;\n        continue;\n      }\n      case OP_TESTSET: {\n        TValue *rb = RB(i);\n        if (l_isfalse(rb) != GETARG_C(i)) {\n          setobjs2s(L, ra, rb);\n          dojump(L, pc, GETARG_sBx(*pc));\n        }\n        pc++;\n        continue;\n      }\n      case OP_CALL: {\n        int b = GETARG_B(i);\n        int nresults = GETARG_C(i) - 1;\n        if (b != 0) L->top = ra+b;  /* else previous instruction set top */\n        L->savedpc = pc;\n        switch (luaD_precall(L, ra, nresults)) {\n          case PCRLUA: {\n            nexeccalls++;\n            goto reentry;  /* restart luaV_execute over new Lua function */\n          }\n          case PCRC: {\n            /* it was a C function (`precall' called it); adjust results */\n            if (nresults >= 0) L->top = L->ci->top;\n            base = L->base;\n            continue;\n          }\n          default: {\n            return;  /* yield */\n          }\n        }\n      }\n      case OP_TAILCALL: {\n        int b = GETARG_B(i);\n        if (b != 0) L->top = ra+b;  /* else previous instruction set top */\n        L->savedpc = pc;\n        lua_assert(GETARG_C(i) - 1 == LUA_MULTRET);\n        switch (luaD_precall(L, ra, LUA_MULTRET)) {\n          case PCRLUA: {\n            /* tail call: put new frame in place of previous one */\n            CallInfo *ci = L->ci - 1;  /* previous frame */\n            int aux;\n            StkId func = ci->func;\n            StkId pfunc = (ci+1)->func;  /* previous function index */\n            if (L->openupval) luaF_close(L, ci->base);\n            L->base = ci->base = ci->func + ((ci+1)->base - pfunc);\n            for (aux = 0; pfunc+aux < L->top; aux++)  /* move frame down */\n              setobjs2s(L, func+aux, pfunc+aux);\n            ci->top = L->top = func+aux;  /* correct top */\n            lua_assert(L->top == L->base + clvalue(func)->l.p->maxstacksize);\n            ci->savedpc = L->savedpc;\n            ci->tailcalls++;  /* one more call lost */\n            L->ci--;  /* remove new frame */\n            goto reentry;\n          }\n          case PCRC: {  /* it was a C function (`precall' called it) */\n            base = L->base;\n            continue;\n          }\n          default: {\n            return;  /* yield */\n          }\n        }\n      }\n      case OP_RETURN: {\n        int b = GETARG_B(i);\n        if (b != 0) L->top = ra+b-1;\n        if (L->openupval) luaF_close(L, base);\n        L->savedpc = pc;\n        b = luaD_poscall(L, ra);\n        if (--nexeccalls == 0)  /* was previous function running `here'? */\n          return;  /* no: return */\n        else {  /* yes: continue its execution */\n          if (b) L->top = L->ci->top;\n          lua_assert(isLua(L->ci));\n          lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL);\n          goto reentry;\n        }\n      }\n      case OP_FORLOOP: {\n        lua_Number step = nvalue(ra+2);\n        lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */\n        lua_Number limit = nvalue(ra+1);\n        if (luai_numlt(0, step) ? luai_numle(idx, limit)\n                                : luai_numle(limit, idx)) {\n          dojump(L, pc, GETARG_sBx(i));  /* jump back */\n          setnvalue(ra, idx);  /* update internal index... */\n          setnvalue(ra+3, idx);  /* ...and external index */\n        }\n        continue;\n      }\n      case OP_FORPREP: {\n        const TValue *init = ra;\n        const TValue *plimit = ra+1;\n        const TValue *pstep = ra+2;\n        L->savedpc = pc;  /* next steps may throw errors */\n        if (!tonumber(init, ra))\n          luaG_runerror(L, LUA_QL(\"for\") \" initial value must be a number\");\n        else if (!tonumber(plimit, ra+1))\n          luaG_runerror(L, LUA_QL(\"for\") \" limit must be a number\");\n        else if (!tonumber(pstep, ra+2))\n          luaG_runerror(L, LUA_QL(\"for\") \" step must be a number\");\n        setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep)));\n        dojump(L, pc, GETARG_sBx(i));\n        continue;\n      }\n      case OP_TFORLOOP: {\n        StkId cb = ra + 3;  /* call base */\n        setobjs2s(L, cb+2, ra+2);\n        setobjs2s(L, cb+1, ra+1);\n        setobjs2s(L, cb, ra);\n        L->top = cb+3;  /* func. + 2 args (state and index) */\n        Protect(luaD_call(L, cb, GETARG_C(i)));\n        L->top = L->ci->top;\n        cb = RA(i) + 3;  /* previous call may change the stack */\n        if (!ttisnil(cb)) {  /* continue loop? */\n          setobjs2s(L, cb-1, cb);  /* save control variable */\n          dojump(L, pc, GETARG_sBx(*pc));  /* jump back */\n        }\n        pc++;\n        continue;\n      }\n      case OP_SETLIST: {\n        int n = GETARG_B(i);\n        int c = GETARG_C(i);\n        int last;\n        Table *h;\n        if (n == 0) {\n          n = cast_int(L->top - ra) - 1;\n          L->top = L->ci->top;\n        }\n        if (c == 0) c = cast_int(*pc++);\n        runtime_check(L, ttistable(ra));\n        h = hvalue(ra);\n        last = ((c-1)*LFIELDS_PER_FLUSH) + n;\n        if (last > h->sizearray)  /* needs more space? */\n          luaH_resizearray(L, h, last);  /* pre-alloc it at once */\n        for (; n > 0; n--) {\n          TValue *val = ra+n;\n          setobj2t(L, luaH_setnum(L, h, last--), val);\n          luaC_barriert(L, h, val);\n        }\n        continue;\n      }\n      case OP_CLOSE: {\n        luaF_close(L, ra);\n        continue;\n      }\n      case OP_CLOSURE: {\n        Proto *p;\n        Closure *ncl;\n        int nup, j;\n        p = cl->p->p[GETARG_Bx(i)];\n        nup = p->nups;\n        ncl = luaF_newLclosure(L, nup, cl->env);\n        ncl->l.p = p;\n        for (j=0; j<nup; j++, pc++) {\n          if (GET_OPCODE(*pc) == OP_GETUPVAL)\n            ncl->l.upvals[j] = cl->upvals[GETARG_B(*pc)];\n          else {\n            lua_assert(GET_OPCODE(*pc) == OP_MOVE);\n            ncl->l.upvals[j] = luaF_findupval(L, base + GETARG_B(*pc));\n          }\n        }\n        setclvalue(L, ra, ncl);\n        Protect(luaC_checkGC(L));\n        continue;\n      }\n      case OP_VARARG: {\n        int b = GETARG_B(i) - 1;\n        int j;\n        CallInfo *ci = L->ci;\n        int n = cast_int(ci->base - ci->func) - cl->p->numparams - 1;\n        if (b == LUA_MULTRET) {\n          Protect(luaD_checkstack(L, n));\n          ra = RA(i);  /* previous call may change the stack */\n          b = n;\n          L->top = ra + n;\n        }\n        for (j = 0; j < b; j++) {\n          if (j < n) {\n            setobjs2s(L, ra + j, ci->base - n + j);\n          }\n          else {\n            setnilvalue(ra + j);\n          }\n        }\n        continue;\n      }\n    }\n  }\n}\n\n"
  },
  {
    "path": "jni/lua/lvm.h",
    "content": "/*\n** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $\n** Lua virtual machine\n** See Copyright Notice in lua.h\n*/\n\n#ifndef lvm_h\n#define lvm_h\n\n\n#include \"ldo.h\"\n#include \"lobject.h\"\n#include \"ltm.h\"\n\n\n#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o)))\n\n#define tonumber(o,n)\t(ttype(o) == LUA_TNUMBER || \\\n                         (((o) = luaV_tonumber(o,n)) != NULL))\n\n#define equalobj(L,o1,o2) \\\n\t(ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2))\n\n\nLUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r);\nLUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2);\nLUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n);\nLUAI_FUNC int luaV_tostring (lua_State *L, StkId obj);\nLUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key,\n                                            StkId val);\nLUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key,\n                                            StkId val);\nLUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls);\nLUAI_FUNC void luaV_concat (lua_State *L, int total, int last);\n\n#endif\n"
  },
  {
    "path": "jni/lua/lzio.c",
    "content": "/*\n** $Id: lzio.c,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $\n** a generic input stream interface\n** See Copyright Notice in lua.h\n*/\n\n\n#include <string.h>\n\n#define lzio_c\n#define LUA_CORE\n\n#include \"lua.h\"\n\n#include \"llimits.h\"\n#include \"lmem.h\"\n#include \"lstate.h\"\n#include \"lzio.h\"\n\n\nint luaZ_fill (ZIO *z) {\n  size_t size;\n  lua_State *L = z->L;\n  const char *buff;\n  lua_unlock(L);\n  buff = z->reader(L, z->data, &size);\n  lua_lock(L);\n  if (buff == NULL || size == 0) return EOZ;\n  z->n = size - 1;\n  z->p = buff;\n  return char2int(*(z->p++));\n}\n\n\nint luaZ_lookahead (ZIO *z) {\n  if (z->n == 0) {\n    if (luaZ_fill(z) == EOZ)\n      return EOZ;\n    else {\n      z->n++;  /* luaZ_fill removed first byte; put back it */\n      z->p--;\n    }\n  }\n  return char2int(*z->p);\n}\n\n\nvoid luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) {\n  z->L = L;\n  z->reader = reader;\n  z->data = data;\n  z->n = 0;\n  z->p = NULL;\n}\n\n\n/* --------------------------------------------------------------- read --- */\nsize_t luaZ_read (ZIO *z, void *b, size_t n) {\n  while (n) {\n    size_t m;\n    if (luaZ_lookahead(z) == EOZ)\n      return n;  /* return number of missing bytes */\n    m = (n <= z->n) ? n : z->n;  /* min. between n and z->n */\n    memcpy(b, z->p, m);\n    z->n -= m;\n    z->p += m;\n    b = (char *)b + m;\n    n -= m;\n  }\n  return 0;\n}\n\n/* ------------------------------------------------------------------------ */\nchar *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) {\n  if (n > buff->buffsize) {\n    if (n < LUA_MINBUFFER) n = LUA_MINBUFFER;\n    luaZ_resizebuffer(L, buff, n);\n  }\n  return buff->buffer;\n}\n\n\n"
  },
  {
    "path": "jni/lua/lzio.h",
    "content": "/*\n** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $\n** Buffered streams\n** See Copyright Notice in lua.h\n*/\n\n\n#ifndef lzio_h\n#define lzio_h\n\n#include \"lua.h\"\n\n#include \"lmem.h\"\n\n\n#define EOZ\t(-1)\t\t\t/* end of stream */\n\ntypedef struct Zio ZIO;\n\n#define char2int(c)\tcast(int, cast(unsigned char, (c)))\n\n#define zgetc(z)  (((z)->n--)>0 ?  char2int(*(z)->p++) : luaZ_fill(z))\n\ntypedef struct Mbuffer {\n  char *buffer;\n  size_t n;\n  size_t buffsize;\n} Mbuffer;\n\n#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0)\n\n#define luaZ_buffer(buff)\t((buff)->buffer)\n#define luaZ_sizebuffer(buff)\t((buff)->buffsize)\n#define luaZ_bufflen(buff)\t((buff)->n)\n\n#define luaZ_resetbuffer(buff) ((buff)->n = 0)\n\n\n#define luaZ_resizebuffer(L, buff, size) \\\n\t(luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \\\n\t(buff)->buffsize = size)\n\n#define luaZ_freebuffer(L, buff)\tluaZ_resizebuffer(L, buff, 0)\n\n\nLUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n);\nLUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader,\n                                        void *data);\nLUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n);\t/* read next n bytes */\nLUAI_FUNC int luaZ_lookahead (ZIO *z);\n\n\n\n/* --------- Private Part ------------------ */\n\nstruct Zio {\n  size_t n;\t\t\t/* bytes still unread */\n  const char *p;\t\t/* current position in buffer */\n  lua_Reader reader;\n  void* data;\t\t\t/* additional data */\n  lua_State *L;\t\t\t/* Lua state (for reader) */\n};\n\n\nLUAI_FUNC int luaZ_fill (ZIO *z);\n\n#endif\n"
  },
  {
    "path": "lint.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<lint>\n    <issue id=\"NewApi\" severity=\"ignore\">\n        <ignore path=\"src/org/evilbinary/highliter/BaseActivity.java\" />\n    </issue>\n</lint>"
  },
  {
    "path": "local.properties",
    "content": "## This file is automatically generated by Android Studio.\n# Do not modify this file -- YOUR CHANGES WILL BE ERASED!\n#\n# This file must *NOT* be checked into Version Control Systems,\n# as it contains information specific to your local configuration.\n#\n# Location of the SDK. This is only used by Gradle.\n# For customization when using a Version Control System, please read the\n# header note.\n#Sat Dec 05 23:50:46 CST 2015\nsdk.dir=/Users/evil/Applications/adt-bundle-mac-x86_64-20140702/sdk\nndk.dir=/Users/evil/Applications/android-ndk-r10d\n"
  },
  {
    "path": "proguard-project.txt",
    "content": "# To enable ProGuard in your project, edit project.properties\n# to define the proguard.config property as described in that file.\n#\n# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in ${sdk.dir}/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the ProGuard\n# include property in project.properties.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "project.properties",
    "content": "# This file is automatically generated by Android Tools.\n# Do not modify this file -- YOUR CHANGES WILL BE ERASED!\n#\n# This file must be checked in Version Control Systems.\n#\n# To customize properties used by the Ant build system edit\n# \"ant.properties\", and override values to adapt the script to your\n# project structure.\n#\n# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):\n#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt\n\n# Project target.\ntarget=android-14\nandroid.library.reference.1=../appcompat_v7\n"
  },
  {
    "path": "res/layout/about.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"fill_parent\"\n    android:orientation=\"vertical\" >\n\n    <LinearLayout\n        android:id=\"@+id/linearLayout1\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"101dp\"\n        android:paddingBottom=\"10dip\"\n         >\n\n        <ImageView\n            android:id=\"@+id/imageView1\"\n            android:layout_width=\"100dp\"\n            android:layout_height=\"116dp\"\n            android:paddingLeft=\"40dip\"\n            android:paddingRight=\"20dp\"\n            android:src=\"@drawable/duck\" />\n\n        <LinearLayout\n            android:id=\"@+id/linearLayout2\"\n            android:layout_width=\"fill_parent\"\n            android:layout_height=\"wrap_content\"\n            android:orientation=\"vertical\" >\n\n            <TextView\n                android:id=\"@+id/field_app_name\"\n                android:layout_width=\"wrap_content\"\n                android:layout_height=\"match_parent\"\n                android:paddingTop=\"30dp\"\n                android:text=\"@string/app_name\"\n                android:textSize=\"24dip\" />\n\n            <TextView\n                android:id=\"@+id/field_version\"\n                android:layout_width=\"180dp\"\n                android:layout_height=\"22dip\"\n                  />\n        </LinearLayout>\n        \n    </LinearLayout>\n\n    <LinearLayout\n        android:id=\"@+id/linearLayout3\"\n        android:layout_width=\"fill_parent\"\n        android:layout_height=\"wrap_content\"\n        android:orientation=\"vertical\"\n        android:paddingBottom=\"10dip\"\n        android:paddingLeft=\"30dip\"\n        android:paddingTop=\"10dip\" >\n\n        <TextView\n            android:id=\"@+id/textView1\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"@string/label_author\"\n            android:textSize=\"16dip\" >\n        </TextView>\n\n        <TextView\n            android:id=\"@+id/textView2\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:paddingLeft=\"15dip\"\n            android:text=\"@string/myname\"\n            android:textSize=\"14dip\" >\n        </TextView>\n\n        <TextView\n            android:id=\"@+id/textView3\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:paddingTop=\"10dip\"\n            android:text=\"@string/label_email\"\n            android:textSize=\"16dip\" >\n        </TextView>\n\n        <TextView\n            android:id=\"@+id/aboutTextView3\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:autoLink=\"all\"\n            android:linksClickable=\"true\"\n            android:paddingLeft=\"15dip\"\n            android:text=\"@string/myemail\"\n            android:textSize=\"14dip\" >\n        </TextView>\n\n        <TextView\n            \n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:paddingTop=\"10dip\"\n            android:text=\"@string/label_homepage\"\n            android:textSize=\"16dip\" >\n        </TextView>\n\n        <TextView\n            android:id=\"@+id/aboutTextView5\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:autoLink=\"all\"\n            android:linksClickable=\"true\"\n            android:paddingLeft=\"15dip\"\n            android:text=\"@string/myhomepage\"\n            android:textSize=\"14dip\" >\n        </TextView>\n\n        \n         <TextView\n            \n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:paddingTop=\"10dip\"\n            android:text=\"@string/label_qq_group\"\n            android:textSize=\"16dip\" >\n        </TextView>\n        \n        <TextView\n            android:id=\"@+id/textView5\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:paddingTop=\"10dip\"\n            android:linksClickable=\"true\"\n            android:paddingLeft=\"15dip\"\n            android:text=\"@string/qq_group\"\n            android:textSize=\"14dip\" >\n        </TextView>\n\n\n        <TextView\n            android:id=\"@+id/textView6\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            android:paddingTop=\"10dip\"\n            android:text=\"@string/label_license\"\n            android:textSize=\"16dip\" >\n        </TextView>\n        \n         <TextView\n             android:layout_width=\"match_parent\"\n             android:layout_height=\"wrap_content\"\n             android:paddingLeft=\"15dip\"\n             android:paddingRight=\"15dip\"\n             android:text=\"@string/field_license\"\n             android:textSize=\"12dip\" >\n\n        </TextView>\n\n\n    </LinearLayout>\n\n</LinearLayout>"
  },
  {
    "path": "res/layout/activity_main.xml",
    "content": "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:paddingBottom=\"@dimen/activity_vertical_margin\"\n    android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n    android:paddingRight=\"@dimen/activity_horizontal_margin\"\n    android:paddingTop=\"@dimen/activity_vertical_margin\"\n    tools:context=\"org.evilbinary.app.MainActivity\" >\n\n    <TextView\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"@string/hello_world\" />\n\n</RelativeLayout>\n"
  },
  {
    "path": "res/menu/main.xml",
    "content": "<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    tools:context=\"org.evilbinary.highliter.MainActivity\" >\n\n    <item\n        android:id=\"@+id/action_settings\"\n        android:orderInCategory=\"100\"\n        android:title=\"@string/action_settings\"\n        app:showAsAction=\"never\"/>\n\n</menu>\n"
  },
  {
    "path": "res/menu/mymenu.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\" >\n\n    <item\n       android:icon=\"@drawable/iconfont_yuyan\" \n        android:id=\"@+id/action_lang\"\n        android:title=\" 语言选择\"\n        app:showAsAction=\"always|withText\">\n        <menu>\n            <group android:checkableBehavior=\"single\" >\n                <item\n                    android:id=\"@+id/c\"\n                    android:title=\"c/c++\"/>\n                <item\n                    android:id=\"@+id/lisp\"\n                    android:title=\"lisp\"/>\n                <item\n                    android:id=\"@+id/python\"\n                    android:title=\"python\"/>\n                \n                \n                <item android:id=\"@+id/abap4\" android:title=\"abap4\"/>\n<item android:id=\"@+id/abc\" android:title=\"abc\"/>\n<item android:id=\"@+id/abnf\" android:title=\"abnf\"/>\n<item android:id=\"@+id/actionscript\" android:title=\"actionscript\"/>\n<item android:id=\"@+id/ada\" android:title=\"ada\"/>\n<item android:id=\"@+id/agda\" android:title=\"agda\"/>\n<item android:id=\"@+id/algol\" android:title=\"algol\"/>\n<item android:id=\"@+id/ampl\" android:title=\"ampl\"/>\n<item android:id=\"@+id/amtrix\" android:title=\"amtrix\"/>\n<item android:id=\"@+id/applescript\" android:title=\"applescript\"/>\n<item android:id=\"@+id/arc\" android:title=\"arc\"/>\n<item android:id=\"@+id/arm\" android:title=\"arm\"/>\n<item android:id=\"@+id/as400cl\" android:title=\"as400cl\"/>\n<item android:id=\"@+id/ascend\" android:title=\"ascend\"/>\n<item android:id=\"@+id/asp\" android:title=\"asp\"/>\n<item android:id=\"@+id/aspect\" android:title=\"aspect\"/>\n<item android:id=\"@+id/assembler\" android:title=\"assembler\"/>\n<item android:id=\"@+id/ats\" android:title=\"ats\"/>\n<item android:id=\"@+id/autohotkey\" android:title=\"autohotkey\"/>\n<item android:id=\"@+id/autoit\" android:title=\"autoit\"/>\n<item android:id=\"@+id/avenue\" android:title=\"avenue\"/>\n<item android:id=\"@+id/awk\" android:title=\"awk\"/>\n<item android:id=\"@+id/bat\" android:title=\"bat\"/>\n<item android:id=\"@+id/bbcode\" android:title=\"bbcode\"/>\n<item android:id=\"@+id/bcpl\" android:title=\"bcpl\"/>\n<item android:id=\"@+id/bibtex\" android:title=\"bibtex\"/>\n<item android:id=\"@+id/biferno\" android:title=\"biferno\"/>\n<item android:id=\"@+id/bison\" android:title=\"bison\"/>\n<item android:id=\"@+id/blitzbasic\" android:title=\"blitzbasic\"/>\n<item android:id=\"@+id/bms\" android:title=\"bms\"/>\n<item android:id=\"@+id/bnf\" android:title=\"bnf\"/>\n<item android:id=\"@+id/boo\" android:title=\"boo\"/>\n<item android:id=\"@+id/ceylon\" android:title=\"ceylon\"/>\n<item android:id=\"@+id/charmm\" android:title=\"charmm\"/>\n<item android:id=\"@+id/chill\" android:title=\"chill\"/>\n<item android:id=\"@+id/clean\" android:title=\"clean\"/>\n<item android:id=\"@+id/clearbasic\" android:title=\"clearbasic\"/>\n<item android:id=\"@+id/clipper\" android:title=\"clipper\"/>\n<item android:id=\"@+id/clojure\" android:title=\"clojure\"/>\n<item android:id=\"@+id/clp\" android:title=\"clp\"/>\n<item android:id=\"@+id/cobol\" android:title=\"cobol\"/>\n<item android:id=\"@+id/coldfusion\" android:title=\"coldfusion\"/>\n<item android:id=\"@+id/conf\" android:title=\"conf\"/>\n<item android:id=\"@+id/crk\" android:title=\"crk\"/>\n<item android:id=\"@+id/csharp\" android:title=\"csharp\"/>\n<item android:id=\"@+id/css\" android:title=\"css\"/>\n<item android:id=\"@+id/d\" android:title=\"d\"/>\n<item android:id=\"@+id/dart\" android:title=\"dart\"/>\n<item android:id=\"@+id/diff\" android:title=\"diff\"/>\n<item android:id=\"@+id/dylan\" android:title=\"dylan\"/>\n<item android:id=\"@+id/ebnf\" android:title=\"ebnf\"/>\n<item android:id=\"@+id/eiffel\" android:title=\"eiffel\"/>\n<item android:id=\"@+id/erlang\" android:title=\"erlang\"/>\n<item android:id=\"@+id/euphoria\" android:title=\"euphoria\"/>\n<item android:id=\"@+id/express\" android:title=\"express\"/>\n<item android:id=\"@+id/fame\" android:title=\"fame\"/>\n<item android:id=\"@+id/felix\" android:title=\"felix\"/>\n<item android:id=\"@+id/fortran77\" android:title=\"fortran77\"/>\n<item android:id=\"@+id/fortran90\" android:title=\"fortran90\"/>\n<item android:id=\"@+id/frink\" android:title=\"frink\"/>\n<item android:id=\"@+id/fsharp\" android:title=\"fsharp\"/>\n<item android:id=\"@+id/fx\" android:title=\"fx\"/>\n<item android:id=\"@+id/gambas\" android:title=\"gambas\"/>\n<item android:id=\"@+id/gdb\" android:title=\"gdb\"/>\n<item android:id=\"@+id/go\" android:title=\"go\"/>\n<item android:id=\"@+id/graphviz\" android:title=\"graphviz\"/>\n<item android:id=\"@+id/haskell\" android:title=\"haskell\"/>\n<item android:id=\"@+id/haxe\" android:title=\"haxe\"/>\n<item android:id=\"@+id/hcl\" android:title=\"hcl\"/>\n<item android:id=\"@+id/html\" android:title=\"html\"/>\n<item android:id=\"@+id/httpd\" android:title=\"httpd\"/>\n<item android:id=\"@+id/icon\" android:title=\"icon\"/>\n<item android:id=\"@+id/idl\" android:title=\"idl\"/>\n<item android:id=\"@+id/idlang\" android:title=\"idlang\"/>\n<item android:id=\"@+id/inc_luatex\" android:title=\"inc_luatex\"/>\n<item android:id=\"@+id/informix\" android:title=\"informix\"/>\n<item android:id=\"@+id/ini\" android:title=\"ini\"/>\n<item android:id=\"@+id/innosetup\" android:title=\"innosetup\"/>\n<item android:id=\"@+id/interlis\" android:title=\"interlis\"/>\n<item android:id=\"@+id/io\" android:title=\"io\"/>\n<item android:id=\"@+id/jasmin\" android:title=\"jasmin\"/>\n<item android:id=\"@+id/java\" android:title=\"java\"/>\n<item android:id=\"@+id/js\" android:title=\"js\"/>\n<item android:id=\"@+id/jsp\" android:title=\"jsp\"/>\n<item android:id=\"@+id/ldif\" android:title=\"ldif\"/>\n<item android:id=\"@+id/less\" android:title=\"less\"/>\n<item android:id=\"@+id/lhs\" android:title=\"lhs\"/>\n<item android:id=\"@+id/lilypond\" android:title=\"lilypond\"/>\n<item android:id=\"@+id/limbo\" android:title=\"limbo\"/>\n<item android:id=\"@+id/lindenscript\" android:title=\"lindenscript\"/>\n<item android:id=\"@+id/logtalk\" android:title=\"logtalk\"/>\n<item android:id=\"@+id/lotos\" android:title=\"lotos\"/>\n<item android:id=\"@+id/lotus\" android:title=\"lotus\"/>\n<item android:id=\"@+id/lua\" android:title=\"lua\"/>\n<item android:id=\"@+id/luban\" android:title=\"luban\"/>\n<item android:id=\"@+id/make\" android:title=\"make\"/>\n<item android:id=\"@+id/maple\" android:title=\"maple\"/>\n<item android:id=\"@+id/matlab\" android:title=\"matlab\"/>\n<item android:id=\"@+id/maya\" android:title=\"maya\"/>\n<item android:id=\"@+id/mercury\" android:title=\"mercury\"/>\n<item android:id=\"@+id/miranda\" android:title=\"miranda\"/>\n<item android:id=\"@+id/mod2\" android:title=\"mod2\"/>\n<item android:id=\"@+id/mod3\" android:title=\"mod3\"/>\n<item android:id=\"@+id/modelica\" android:title=\"modelica\"/>\n<item android:id=\"@+id/moon\" android:title=\"moon\"/>\n<item android:id=\"@+id/ms\" android:title=\"ms\"/>\n<item android:id=\"@+id/mssql\" android:title=\"mssql\"/>\n<item android:id=\"@+id/mxml\" android:title=\"mxml\"/>\n<item android:id=\"@+id/n3\" android:title=\"n3\"/>\n<item android:id=\"@+id/nasal\" android:title=\"nasal\"/>\n<item android:id=\"@+id/nbc\" android:title=\"nbc\"/>\n<item android:id=\"@+id/nemerle\" android:title=\"nemerle\"/>\n<item android:id=\"@+id/netrexx\" android:title=\"netrexx\"/>\n<item android:id=\"@+id/nice\" android:title=\"nice\"/>\n<item android:id=\"@+id/nsis\" android:title=\"nsis\"/>\n<item android:id=\"@+id/nxc\" android:title=\"nxc\"/>\n<item android:id=\"@+id/oberon\" android:title=\"oberon\"/>\n<item android:id=\"@+id/objc\" android:title=\"objc\"/>\n<item android:id=\"@+id/ocaml\" android:title=\"ocaml\"/>\n<item android:id=\"@+id/octave\" android:title=\"octave\"/>\n<item android:id=\"@+id/oorexx\" android:title=\"oorexx\"/>\n<item android:id=\"@+id/os\" android:title=\"os\"/>\n<item android:id=\"@+id/oz\" android:title=\"oz\"/>\n<item android:id=\"@+id/paradox\" android:title=\"paradox\"/>\n<item android:id=\"@+id/pas\" android:title=\"pas\"/>\n<item android:id=\"@+id/pdf\" android:title=\"pdf\"/>\n<item android:id=\"@+id/perl\" android:title=\"perl\"/>\n<item android:id=\"@+id/php\" android:title=\"php\"/>\n<item android:id=\"@+id/pike\" android:title=\"pike\"/>\n<item android:id=\"@+id/pl1\" android:title=\"pl1\"/>\n<item android:id=\"@+id/plperl\" android:title=\"plperl\"/>\n<item android:id=\"@+id/plpython\" android:title=\"plpython\"/>\n<item android:id=\"@+id/pltcl\" android:title=\"pltcl\"/>\n<item android:id=\"@+id/pov\" android:title=\"pov\"/>\n<item android:id=\"@+id/pro\" android:title=\"pro\"/>\n<item android:id=\"@+id/progress\" android:title=\"progress\"/>\n<item android:id=\"@+id/ps\" android:title=\"ps\"/>\n<item android:id=\"@+id/ps1\" android:title=\"ps1\"/>\n<item android:id=\"@+id/psl\" android:title=\"psl\"/>\n<item android:id=\"@+id/pure\" android:title=\"pure\"/>\n<item android:id=\"@+id/pyrex\" android:title=\"pyrex\"/>\n<item android:id=\"@+id/q\" android:title=\"q\"/>\n<item android:id=\"@+id/qmake\" android:title=\"qmake\"/>\n<item android:id=\"@+id/qml\" android:title=\"qml\"/>\n<item android:id=\"@+id/qu\" android:title=\"qu\"/>\n<item android:id=\"@+id/r\" android:title=\"r\"/>\n<item android:id=\"@+id/rebol\" android:title=\"rebol\"/>\n<item android:id=\"@+id/rexx\" android:title=\"rexx\"/>\n<item android:id=\"@+id/rnc\" android:title=\"rnc\"/>\n<item android:id=\"@+id/rpg\" android:title=\"rpg\"/>\n<item android:id=\"@+id/rpl\" android:title=\"rpl\"/>\n<item android:id=\"@+id/rs\" android:title=\"rs\"/>\n<item android:id=\"@+id/ruby\" android:title=\"ruby\"/>\n<item android:id=\"@+id/s\" android:title=\"s\"/>\n<item android:id=\"@+id/sas\" android:title=\"sas\"/>\n<item android:id=\"@+id/scala\" android:title=\"scala\"/>\n<item android:id=\"@+id/scilab\" android:title=\"scilab\"/>\n<item android:id=\"@+id/scss\" android:title=\"scss\"/>\n<item android:id=\"@+id/sh\" android:title=\"sh\"/>\n<item android:id=\"@+id/small\" android:title=\"small\"/>\n<item android:id=\"@+id/smalltalk\" android:title=\"smalltalk\"/>\n<item android:id=\"@+id/sml\" android:title=\"sml\"/>\n<item android:id=\"@+id/snmp\" android:title=\"snmp\"/>\n<item android:id=\"@+id/snobol\" android:title=\"snobol\"/>\n<item android:id=\"@+id/spec\" android:title=\"spec\"/>\n<item android:id=\"@+id/spn\" android:title=\"spn\"/>\n<item android:id=\"@+id/sql\" android:title=\"sql\"/>\n<item android:id=\"@+id/squirrel\" android:title=\"squirrel\"/>\n<item android:id=\"@+id/styl\" android:title=\"styl\"/>\n<item android:id=\"@+id/swift\" android:title=\"swift\"/>\n<item android:id=\"@+id/sybase\" android:title=\"sybase\"/>\n<item android:id=\"@+id/tcl\" android:title=\"tcl\"/>\n<item android:id=\"@+id/tcsh\" android:title=\"tcsh\"/>\n<item android:id=\"@+id/tex\" android:title=\"tex\"/>\n<item android:id=\"@+id/ts\" android:title=\"ts\"/>\n<item android:id=\"@+id/tsql\" android:title=\"tsql\"/>\n<item android:id=\"@+id/ttcn3\" android:title=\"ttcn3\"/>\n<item android:id=\"@+id/txt\" android:title=\"txt\"/>\n<item android:id=\"@+id/upc\" android:title=\"upc\"/>\n<item android:id=\"@+id/vala\" android:title=\"vala\"/>\n<item android:id=\"@+id/vb\" android:title=\"vb\"/>\n<item android:id=\"@+id/verilog\" android:title=\"verilog\"/>\n<item android:id=\"@+id/vhd\" android:title=\"vhd\"/>\n<item android:id=\"@+id/xml\" android:title=\"xml\"/>\n<item android:id=\"@+id/xpp\" android:title=\"xpp\"/>\n<item android:id=\"@+id/yaiff\" android:title=\"yaiff\"/>\n<item android:id=\"@+id/yang\" android:title=\"yang\"/>\n<item android:id=\"@+id/znn\" android:title=\"znn\"/>\n\n            </group>\n        </menu>\n    </item>\n    <item\n        android:id=\"@+id/action_theme\"\n        android:title=\" 主题选择\"\n        android:icon=\"@drawable/iconfont_theme\"\n        app:showAsAction=\"always|withText\">\n        <menu>\n            <group android:checkableBehavior=\"single\" >\n                 <item\n                    android:id=\"@+id/molokai\"\n                    android:title=\"molokai\"/>\n                <item\n                    android:id=\"@+id/fine_blue\"\n                    android:title=\"fine blue\"/>\n                <item\n                    android:id=\"@+id/vampire\"\n                    android:title=\"vampire\"/>\n                <item\n                    android:id=\"@+id/solarized_light\"\n                    android:title=\"solarized-light\"/>\n                \n                \n                <item android:id=\"@+id/acid\" android:title=\"acid\"/>\n<item android:id=\"@+id/aiseered\" android:title=\"aiseered\"/>\n<item android:id=\"@+id/andes\" android:title=\"andes\"/>\n<item android:id=\"@+id/anotherdark\" android:title=\"anotherdark\"/>\n<item android:id=\"@+id/autumn\" android:title=\"autumn\"/>\n<item android:id=\"@+id/baycomb\" android:title=\"baycomb\"/>\n<item android:id=\"@+id/bclear\" android:title=\"bclear\"/>\n<item android:id=\"@+id/biogoo\" android:title=\"biogoo\"/>\n<item android:id=\"@+id/bipolar\" android:title=\"bipolar\"/>\n<item android:id=\"@+id/blacknblue\" android:title=\"blacknblue\"/>\n<item android:id=\"@+id/bluegreen\" android:title=\"bluegreen\"/>\n<item android:id=\"@+id/breeze\" android:title=\"breeze\"/>\n<item android:id=\"@+id/bright\" android:title=\"bright\"/>\n<item android:id=\"@+id/camo\" android:title=\"camo\"/>\n<item android:id=\"@+id/candy\" android:title=\"candy\"/>\n<item android:id=\"@+id/clarity\" android:title=\"clarity\"/>\n<item android:id=\"@+id/dante\" android:title=\"dante\"/>\n<item android:id=\"@+id/darkblue\" android:title=\"darkblue\"/>\n<item android:id=\"@+id/darkbone\" android:title=\"darkbone\"/>\n<item android:id=\"@+id/darkness\" android:title=\"darkness\"/>\n<item android:id=\"@+id/darkslategray\" android:title=\"darkslategray\"/>\n<item android:id=\"@+id/darkspectrum\" android:title=\"darkspectrum\"/>\n<item android:id=\"@+id/denim\" android:title=\"denim\"/>\n<item android:id=\"@+id/dusk\" android:title=\"dusk\"/>\n<item android:id=\"@+id/earendel\" android:title=\"earendel\"/>\n<item android:id=\"@+id/easter\" android:title=\"easter\"/>\n<item android:id=\"@+id/edit_anjuta\" android:title=\"edit-anjuta\"/>\n<item android:id=\"@+id/edit_eclipse\" android:title=\"edit-eclipse\"/>\n<item android:id=\"@+id/edit_emacs\" android:title=\"edit-emacs\"/>\n<item android:id=\"@+id/edit_flashdevelop\" android:title=\"edit-flashdevelop\"/>\n<item android:id=\"@+id/edit_gedit\" android:title=\"edit-gedit\"/>\n<item android:id=\"@+id/edit_jedit\" android:title=\"edit-jedit\"/>\n<item android:id=\"@+id/edit_kwrite\" android:title=\"edit-kwrite\"/>\n<item android:id=\"@+id/edit_matlab\" android:title=\"edit-matlab\"/>\n<item android:id=\"@+id/edit_msvs2008\" android:title=\"edit-msvs2008\"/>\n<item android:id=\"@+id/edit_nedit\" android:title=\"edit-nedit\"/>\n<item android:id=\"@+id/edit_vim_dark\" android:title=\"edit-vim-dark\"/>\n<item android:id=\"@+id/edit_vim\" android:title=\"edit-vim\"/>\n<item android:id=\"@+id/edit_xcode\" android:title=\"edit-xcode\"/>\n<item android:id=\"@+id/ekvoli\" android:title=\"ekvoli\"/>\n<item android:id=\"@+id/freya\" android:title=\"freya\"/>\n<item android:id=\"@+id/fruit\" android:title=\"fruit\"/>\n<item android:id=\"@+id/golden\" android:title=\"golden\"/>\n<item android:id=\"@+id/greenlcd\" android:title=\"greenlcd\"/>\n<item android:id=\"@+id/kellys\" android:title=\"kellys\"/>\n<item android:id=\"@+id/leo\" android:title=\"leo\"/>\n<item android:id=\"@+id/lucretia\" android:title=\"lucretia\"/>\n<item android:id=\"@+id/manxome\" android:title=\"manxome\"/>\n<item android:id=\"@+id/maroloccio\" android:title=\"maroloccio\"/>\n<item android:id=\"@+id/matrix\" android:title=\"matrix\"/>\n<item android:id=\"@+id/moe\" android:title=\"moe\"/>\n<item android:id=\"@+id/moria\" android:title=\"moria\"/>\n<item android:id=\"@+id/navajo_night\" android:title=\"navajo-night\"/>\n<item android:id=\"@+id/navy\" android:title=\"navy\"/>\n<item android:id=\"@+id/neon\" android:title=\"neon\"/>\n<item android:id=\"@+id/night\" android:title=\"night\"/>\n<item android:id=\"@+id/nightshimmer\" android:title=\"nightshimmer\"/>\n<item android:id=\"@+id/nuvola\" android:title=\"nuvola\"/>\n<item android:id=\"@+id/olive\" android:title=\"olive\"/>\n<item android:id=\"@+id/orion\" android:title=\"orion\"/>\n<item android:id=\"@+id/oxygenated\" android:title=\"oxygenated\"/>\n<item android:id=\"@+id/pablo\" android:title=\"pablo\"/>\n<item android:id=\"@+id/peaksea\" android:title=\"peaksea\"/>\n<item android:id=\"@+id/print\" android:title=\"print\"/>\n<item android:id=\"@+id/rand01\" android:title=\"rand01\"/>\n<item android:id=\"@+id/rdark\" android:title=\"rdark\"/>\n<item android:id=\"@+id/relaxedgreen\" android:title=\"relaxedgreen\"/>\n<item android:id=\"@+id/rootwater\" android:title=\"rootwater\"/>\n<item android:id=\"@+id/seashell\" android:title=\"seashell\"/>\n<item android:id=\"@+id/solarized_dark\" android:title=\"solarized-dark\"/>\n<item android:id=\"@+id/tabula\" android:title=\"tabula\"/>\n<item android:id=\"@+id/tcsoft\" android:title=\"tcsoft\"/>\n<item android:id=\"@+id/the\" android:title=\"the\"/>\n<item android:id=\"@+id/whitengrey\" android:title=\"whitengrey\"/>\n<item android:id=\"@+id/xoria256\" android:title=\"xoria256\"/>\n<item android:id=\"@+id/zellner\" android:title=\"zellner\"/>\n<item android:id=\"@+id/zenburn\" android:title=\"zenburn\"/>\n<item android:id=\"@+id/zmrok\" android:title=\"zmrok\"/>\n\n            </group>\n        </menu>\n    </item>\n    <item\n        android:id=\"@+id/action_font\"\n        android:icon=\"@drawable/iconfont_zitibianji\"\n        android:showAsAction=\"always|withText\"\n        android:title=\"文字大小\"\n        app:showAsAction=\"always|withText\">\n        <menu>\n            <group android:checkableBehavior=\"single\" >\n                 <item\n                    android:id=\"@+id/font_default\"\n                    android:title=\"默认大小\"/>\n                 \n                <item\n                    android:id=\"@+id/font10\"\n                    android:title=\"10\"/>\n                <item\n                    android:id=\"@+id/font12\"\n                    android:title=\"12\"/>\n                <item\n                    android:id=\"@+id/font14\"\n                    android:title=\"14\"/>\n                <item\n                    android:id=\"@+id/font16\"\n                    android:title=\"16\"/>\n                <item\n                    android:id=\"@+id/font18\"\n                    android:title=\"18\"/>\n            </group>\n        </menu>\n    </item>\n    <item\n        android:id=\"@+id/action_about\"\n        android:title=\"关于\">\n    </item>\n\n</menu>"
  },
  {
    "path": "res/values/dimens.xml",
    "content": "<resources>\n\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"activity_horizontal_margin\">16dp</dimen>\n    <dimen name=\"activity_vertical_margin\">16dp</dimen>\n\n</resources>\n"
  },
  {
    "path": "res/values/strings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <string name=\"app_name\">HighliterTextEditor</string>\n    <string name=\"hello_world\">Hello world!</string>\n    <string name=\"action_settings\">Settings</string>\n    <string name=\"extract\">正在解压</string>\n    <string name=\"extract_finish\">解压结束</string>\n    <string name=\"extract_error\">解压失败</string>\n\n     <string name=\"label_version\">版本</string>\n    <string name=\"label_author\">作者</string>\n    <string name=\"label_email\">Email</string>\n    <string name=\"label_homepage\">主页</string>\n    <string name=\"label_license\">授权</string>\n    <string name=\"label_qq_group\">QQ群</string>\n    <string name=\"field_license\">版本所有 (C) 2015-2020  evilbinary\\n\nCL编译器为自由软件；您可依据自由软件基金会所发表的GNU通用公共授权条款规定，就本程序再为散布与／或修改；无论您依据的是本授权的第三版或（您自行选择的）任一日后发行的版本。\nCL编译器是基于使用目的而加以散布，然而不负任何担保责任；亦无对适售性或特定目的适用性所为的默示性担保。详情请参照GNU通用公共授权 http://www.gnu.org/licenses。</string>\n    <string name=\"about\">关于</string>\n    <string name=\"myname\">BSD依依鸭</string>\n    <string name=\"qq_group\">Lisp兴趣小组 239401374</string>\n    <string name=\"myemail\">rootntsd@gmail.com</string>\n    <string name=\"myhomepage\">http://evilbinary.org/</string>\n    \n</resources>"
  },
  {
    "path": "res/values/styles.xml",
    "content": "<resources>\n\n    <!--\n        Base application theme, dependent on API level. This theme is replaced\n        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.\n    -->\n    <style name=\"AppBaseTheme\" parent=\"Theme.AppCompat.Light\">\n        <!--\n            Theme customizations available in newer API levels can go in\n            res/values-vXX/styles.xml, while customizations related to\n            backward-compatibility can go here.\n        -->\n    </style>\n\n    <!-- Application theme. -->\n    <style name=\"AppTheme\" parent=\"AppBaseTheme\">\n        <!-- All customizations that are NOT specific to a particular API-level can go here. -->\n    </style>\n\n</resources>\n"
  },
  {
    "path": "res/values-v11/styles.xml",
    "content": "<resources>\n\n    <!--\n        Base application theme for API 11+. This theme completely replaces\n        AppBaseTheme from res/values/styles.xml on API 11+ devices.\n    -->\n    <style name=\"AppBaseTheme\" parent=\"Theme.AppCompat.Light\">\n        <!-- API 11 theme customizations can go here. -->\n    </style>\n\n</resources>\n"
  },
  {
    "path": "res/values-v14/styles.xml",
    "content": "<resources>\n\n    <!--\n        Base application theme for API 14+. This theme completely replaces\n        AppBaseTheme from BOTH res/values/styles.xml and\n        res/values-v11/styles.xml on API 14+ devices.\n    -->\n    <style name=\"AppBaseTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\">\n        <!-- API 14 theme customizations can go here. -->\n    </style>\n\n</resources>\n"
  },
  {
    "path": "res/values-w820dp/dimens.xml",
    "content": "<resources>\n\n    <!--\n         Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively).\n    -->\n    <dimen name=\"activity_horizontal_margin\">64dp</dimen>\n\n</resources>\n"
  },
  {
    "path": "src/org/evilbinary/app/MainActivity.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.app;\n\nimport android.app.Dialog;\nimport android.os.Bundle;\nimport android.support.v7.app.ActionBar;\nimport android.support.v7.app.ActionBarActivity;\nimport android.view.Menu;\nimport android.view.MenuItem;\nimport android.widget.LinearLayout;\n\nimport org.evilbinary.highliter.HighlightEditText;\nimport org.evilbinary.highliter.R;\nimport org.evilbinary.managers.Configure;\nimport org.evilbinary.managers.ConfigureManager;\nimport org.evilbinary.utils.FileUtil;\n\nimport java.io.IOException;\n\n//import android.app.Activity;\n\npublic class MainActivity extends ActionBarActivity {\n\n    private ConfigureManager mConfigureManager;\n    private HighlightEditText mHighlightEdit;\n    private Configure mConf;\n    private String mTextcode;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        // setContentView(R.layout.activity_main);\n        ActionBar actionBar = this.getSupportActionBar();\n\n        mConfigureManager = new ConfigureManager(this);\n        mConfigureManager.exractDefaultConfigure();\n        mConf = mConfigureManager.getDefaultConfigure();\n        mConf.mTheme = \"fine_blue\";// solarized-light vampire\n        mConf.mLanguage = \"lisp\";\n//\t\tmConf.mSettings.TEXT_SIZE=20;\n//\t\tmConf.mSettings.SHOW_LINE_NUMBERS = false;\n//\t\tmConf.mSettings.SHOW_LINE_HIGHLIGHT = false;\n//\t\tmConf.mSettings.FLING_TO_SCROLL = false;\n\n        try {\n            String text = FileUtil.readFromAssetsFile(this, \"test.html\");\n            mTextcode = FileUtil.readFromAssetsFile(this, \"lib.lisp\");\n\n            final LinearLayout linearLayout = new LinearLayout(this);\n            linearLayout.setOrientation(LinearLayout.VERTICAL);\n\n            mHighlightEdit = new HighlightEditText(this, mConf);\n            mHighlightEdit.setSource(mTextcode);\n            linearLayout.addView(mHighlightEdit);\n//\t\t\tEditText editText = new EditText(this);\n//\t\t\teditText.setText(mTextcode);\n//\t\t\tlinearLayout.addView(editText);\n\n            setContentView(linearLayout);\n        } catch (IOException e) {\n            // TODO Auto-generated catch block\n            e.printStackTrace();\n        }\n    }\n\n    @Override\n    public boolean onCreateOptionsMenu(Menu menu) {\n        // Inflate the menu; this adds items to the action bar if it is present.\n        getMenuInflater().inflate(R.menu.mymenu, menu);\n        return true;\n    }\n\n    @Override\n    public boolean onOptionsItemSelected(MenuItem item) {\n        // Handle action bar item clicks here. The action bar will\n        // automatically handle clicks on the Home/Up button, so long\n        // as you specify a parent activity in AndroidManifest.xml.\n        int id = item.getItemId();\n        if (id == R.id.action_settings || id == R.id.action_lang || id == R.id.action_theme || id == R.id.action_font) {\n            return true;\n        }\n\n\n        switch (id) {\n            case R.id.font10:\n                mConf.mSettings.TEXT_SIZE = 10 * 2;\n                break;\n            case R.id.font12:\n                mConf.mSettings.TEXT_SIZE = 12 * 2;\n                break;\n            case R.id.font14:\n                mConf.mSettings.TEXT_SIZE = 14 * 2;\n                break;\n            case R.id.font16:\n                mConf.mSettings.TEXT_SIZE = 16 * 2;\n                break;\n            case R.id.font18:\n                mConf.mSettings.TEXT_SIZE = 18 * 2;\n                break;\n            case R.id.font_default:\n                mConf.mSettings.TEXT_SIZE = mConf.mFontSize;\n                break;\n\n            case R.id.c:\n                mConf.mLanguage = \"c\";\n                break;\n            case R.id.python:\n                mConf.mLanguage = \"python\";\n                break;\n            case R.id.lisp:\n                mConf.mLanguage = \"lisp\";\n                break;\n\n            case R.id.molokai:\n                mConf.mTheme = \"molokai\";\n                break;\n            case R.id.fine_blue:\n                mConf.mTheme = \"fine_blue\";\n                break;\n            case R.id.vampire:\n                mConf.mTheme = \"vampire\";\n                break;\n            case R.id.solarized_light:\n                mConf.mTheme = \"solarized-light\";\n                break;\n\n            case R.id.abap4:\n                mConf.mLanguage = \"abap4\";\n                break;\n            case R.id.abc:\n                mConf.mLanguage = \"abc\";\n                break;\n            case R.id.abnf:\n                mConf.mLanguage = \"abnf\";\n                break;\n            case R.id.actionscript:\n                mConf.mLanguage = \"actionscript\";\n                break;\n            case R.id.ada:\n                mConf.mLanguage = \"ada\";\n                break;\n            case R.id.agda:\n                mConf.mLanguage = \"agda\";\n                break;\n            case R.id.algol:\n                mConf.mLanguage = \"algol\";\n                break;\n            case R.id.ampl:\n                mConf.mLanguage = \"ampl\";\n                break;\n            case R.id.amtrix:\n                mConf.mLanguage = \"amtrix\";\n                break;\n            case R.id.applescript:\n                mConf.mLanguage = \"applescript\";\n                break;\n            case R.id.arc:\n                mConf.mLanguage = \"arc\";\n                break;\n            case R.id.arm:\n                mConf.mLanguage = \"arm\";\n                break;\n            case R.id.as400cl:\n                mConf.mLanguage = \"as400cl\";\n                break;\n            case R.id.ascend:\n                mConf.mLanguage = \"ascend\";\n                break;\n            case R.id.asp:\n                mConf.mLanguage = \"asp\";\n                break;\n            case R.id.aspect:\n                mConf.mLanguage = \"aspect\";\n                break;\n            case R.id.assembler:\n                mConf.mLanguage = \"assembler\";\n                break;\n            case R.id.ats:\n                mConf.mLanguage = \"ats\";\n                break;\n            case R.id.autohotkey:\n                mConf.mLanguage = \"autohotkey\";\n                break;\n            case R.id.autoit:\n                mConf.mLanguage = \"autoit\";\n                break;\n            case R.id.avenue:\n                mConf.mLanguage = \"avenue\";\n                break;\n            case R.id.awk:\n                mConf.mLanguage = \"awk\";\n                break;\n            case R.id.bat:\n                mConf.mLanguage = \"bat\";\n                break;\n            case R.id.bbcode:\n                mConf.mLanguage = \"bbcode\";\n                break;\n            case R.id.bcpl:\n                mConf.mLanguage = \"bcpl\";\n                break;\n            case R.id.bibtex:\n                mConf.mLanguage = \"bibtex\";\n                break;\n            case R.id.biferno:\n                mConf.mLanguage = \"biferno\";\n                break;\n            case R.id.bison:\n                mConf.mLanguage = \"bison\";\n                break;\n            case R.id.blitzbasic:\n                mConf.mLanguage = \"blitzbasic\";\n                break;\n            case R.id.bms:\n                mConf.mLanguage = \"bms\";\n                break;\n            case R.id.bnf:\n                mConf.mLanguage = \"bnf\";\n                break;\n            case R.id.boo:\n                mConf.mLanguage = \"boo\";\n                break;\n            case R.id.ceylon:\n                mConf.mLanguage = \"ceylon\";\n                break;\n            case R.id.charmm:\n                mConf.mLanguage = \"charmm\";\n                break;\n            case R.id.chill:\n                mConf.mLanguage = \"chill\";\n                break;\n            case R.id.clean:\n                mConf.mLanguage = \"clean\";\n                break;\n            case R.id.clearbasic:\n                mConf.mLanguage = \"clearbasic\";\n                break;\n            case R.id.clipper:\n                mConf.mLanguage = \"clipper\";\n                break;\n            case R.id.clojure:\n                mConf.mLanguage = \"clojure\";\n                break;\n            case R.id.clp:\n                mConf.mLanguage = \"clp\";\n                break;\n            case R.id.cobol:\n                mConf.mLanguage = \"cobol\";\n                break;\n            case R.id.coldfusion:\n                mConf.mLanguage = \"coldfusion\";\n                break;\n            case R.id.conf:\n                mConf.mLanguage = \"conf\";\n                break;\n            case R.id.crk:\n                mConf.mLanguage = \"crk\";\n                break;\n            case R.id.csharp:\n                mConf.mLanguage = \"csharp\";\n                break;\n            case R.id.css:\n                mConf.mLanguage = \"css\";\n                break;\n            case R.id.d:\n                mConf.mLanguage = \"d\";\n                break;\n            case R.id.dart:\n                mConf.mLanguage = \"dart\";\n                break;\n            case R.id.diff:\n                mConf.mLanguage = \"diff\";\n                break;\n            case R.id.dylan:\n                mConf.mLanguage = \"dylan\";\n                break;\n            case R.id.ebnf:\n                mConf.mLanguage = \"ebnf\";\n                break;\n            case R.id.eiffel:\n                mConf.mLanguage = \"eiffel\";\n                break;\n            case R.id.erlang:\n                mConf.mLanguage = \"erlang\";\n                break;\n            case R.id.euphoria:\n                mConf.mLanguage = \"euphoria\";\n                break;\n            case R.id.express:\n                mConf.mLanguage = \"express\";\n                break;\n            case R.id.fame:\n                mConf.mLanguage = \"fame\";\n                break;\n            case R.id.felix:\n                mConf.mLanguage = \"felix\";\n                break;\n            case R.id.fortran77:\n                mConf.mLanguage = \"fortran77\";\n                break;\n            case R.id.fortran90:\n                mConf.mLanguage = \"fortran90\";\n                break;\n            case R.id.frink:\n                mConf.mLanguage = \"frink\";\n                break;\n            case R.id.fsharp:\n                mConf.mLanguage = \"fsharp\";\n                break;\n            case R.id.fx:\n                mConf.mLanguage = \"fx\";\n                break;\n            case R.id.gambas:\n                mConf.mLanguage = \"gambas\";\n                break;\n            case R.id.gdb:\n                mConf.mLanguage = \"gdb\";\n                break;\n            case R.id.go:\n                mConf.mLanguage = \"go\";\n                break;\n            case R.id.graphviz:\n                mConf.mLanguage = \"graphviz\";\n                break;\n            case R.id.haskell:\n                mConf.mLanguage = \"haskell\";\n                break;\n            case R.id.haxe:\n                mConf.mLanguage = \"haxe\";\n                break;\n            case R.id.hcl:\n                mConf.mLanguage = \"hcl\";\n                break;\n            case R.id.html:\n                mConf.mLanguage = \"html\";\n                break;\n            case R.id.httpd:\n                mConf.mLanguage = \"httpd\";\n                break;\n            case R.id.icon:\n                mConf.mLanguage = \"icon\";\n                break;\n            case R.id.idl:\n                mConf.mLanguage = \"idl\";\n                break;\n            case R.id.idlang:\n                mConf.mLanguage = \"idlang\";\n                break;\n            case R.id.inc_luatex:\n                mConf.mLanguage = \"inc_luatex\";\n                break;\n            case R.id.informix:\n                mConf.mLanguage = \"informix\";\n                break;\n            case R.id.ini:\n                mConf.mLanguage = \"ini\";\n                break;\n            case R.id.innosetup:\n                mConf.mLanguage = \"innosetup\";\n                break;\n            case R.id.interlis:\n                mConf.mLanguage = \"interlis\";\n                break;\n            case R.id.io:\n                mConf.mLanguage = \"io\";\n                break;\n            case R.id.jasmin:\n                mConf.mLanguage = \"jasmin\";\n                break;\n            case R.id.java:\n                mConf.mLanguage = \"java\";\n                break;\n            case R.id.js:\n                mConf.mLanguage = \"js\";\n                break;\n            case R.id.jsp:\n                mConf.mLanguage = \"jsp\";\n                break;\n            case R.id.ldif:\n                mConf.mLanguage = \"ldif\";\n                break;\n            case R.id.less:\n                mConf.mLanguage = \"less\";\n                break;\n            case R.id.lhs:\n                mConf.mLanguage = \"lhs\";\n                break;\n            case R.id.lilypond:\n                mConf.mLanguage = \"lilypond\";\n                break;\n            case R.id.limbo:\n                mConf.mLanguage = \"limbo\";\n                break;\n            case R.id.lindenscript:\n                mConf.mLanguage = \"lindenscript\";\n                break;\n            case R.id.logtalk:\n                mConf.mLanguage = \"logtalk\";\n                break;\n            case R.id.lotos:\n                mConf.mLanguage = \"lotos\";\n                break;\n            case R.id.lotus:\n                mConf.mLanguage = \"lotus\";\n                break;\n            case R.id.lua:\n                mConf.mLanguage = \"lua\";\n                break;\n            case R.id.luban:\n                mConf.mLanguage = \"luban\";\n                break;\n            case R.id.make:\n                mConf.mLanguage = \"make\";\n                break;\n            case R.id.maple:\n                mConf.mLanguage = \"maple\";\n                break;\n            case R.id.matlab:\n                mConf.mLanguage = \"matlab\";\n                break;\n            case R.id.maya:\n                mConf.mLanguage = \"maya\";\n                break;\n            case R.id.mercury:\n                mConf.mLanguage = \"mercury\";\n                break;\n            case R.id.miranda:\n                mConf.mLanguage = \"miranda\";\n                break;\n            case R.id.mod2:\n                mConf.mLanguage = \"mod2\";\n                break;\n            case R.id.mod3:\n                mConf.mLanguage = \"mod3\";\n                break;\n            case R.id.modelica:\n                mConf.mLanguage = \"modelica\";\n                break;\n            case R.id.moon:\n                mConf.mLanguage = \"moon\";\n                break;\n            case R.id.ms:\n                mConf.mLanguage = \"ms\";\n                break;\n            case R.id.mssql:\n                mConf.mLanguage = \"mssql\";\n                break;\n            case R.id.mxml:\n                mConf.mLanguage = \"mxml\";\n                break;\n            case R.id.n3:\n                mConf.mLanguage = \"n3\";\n                break;\n            case R.id.nasal:\n                mConf.mLanguage = \"nasal\";\n                break;\n            case R.id.nbc:\n                mConf.mLanguage = \"nbc\";\n                break;\n            case R.id.nemerle:\n                mConf.mLanguage = \"nemerle\";\n                break;\n            case R.id.netrexx:\n                mConf.mLanguage = \"netrexx\";\n                break;\n            case R.id.nice:\n                mConf.mLanguage = \"nice\";\n                break;\n            case R.id.nsis:\n                mConf.mLanguage = \"nsis\";\n                break;\n            case R.id.nxc:\n                mConf.mLanguage = \"nxc\";\n                break;\n            case R.id.oberon:\n                mConf.mLanguage = \"oberon\";\n                break;\n            case R.id.objc:\n                mConf.mLanguage = \"objc\";\n                break;\n            case R.id.ocaml:\n                mConf.mLanguage = \"ocaml\";\n                break;\n            case R.id.octave:\n                mConf.mLanguage = \"octave\";\n                break;\n            case R.id.oorexx:\n                mConf.mLanguage = \"oorexx\";\n                break;\n            case R.id.os:\n                mConf.mLanguage = \"os\";\n                break;\n            case R.id.oz:\n                mConf.mLanguage = \"oz\";\n                break;\n            case R.id.paradox:\n                mConf.mLanguage = \"paradox\";\n                break;\n            case R.id.pas:\n                mConf.mLanguage = \"pas\";\n                break;\n            case R.id.pdf:\n                mConf.mLanguage = \"pdf\";\n                break;\n            case R.id.perl:\n                mConf.mLanguage = \"perl\";\n                break;\n            case R.id.php:\n                mConf.mLanguage = \"php\";\n                break;\n            case R.id.pike:\n                mConf.mLanguage = \"pike\";\n                break;\n            case R.id.pl1:\n                mConf.mLanguage = \"pl1\";\n                break;\n            case R.id.plperl:\n                mConf.mLanguage = \"plperl\";\n                break;\n            case R.id.plpython:\n                mConf.mLanguage = \"plpython\";\n                break;\n            case R.id.pltcl:\n                mConf.mLanguage = \"pltcl\";\n                break;\n            case R.id.pov:\n                mConf.mLanguage = \"pov\";\n                break;\n            case R.id.pro:\n                mConf.mLanguage = \"pro\";\n                break;\n            case R.id.progress:\n                mConf.mLanguage = \"progress\";\n                break;\n            case R.id.ps:\n                mConf.mLanguage = \"ps\";\n                break;\n            case R.id.ps1:\n                mConf.mLanguage = \"ps1\";\n                break;\n            case R.id.psl:\n                mConf.mLanguage = \"psl\";\n                break;\n            case R.id.pure:\n                mConf.mLanguage = \"pure\";\n                break;\n            case R.id.pyrex:\n                mConf.mLanguage = \"pyrex\";\n                break;\n            case R.id.q:\n                mConf.mLanguage = \"q\";\n                break;\n            case R.id.qmake:\n                mConf.mLanguage = \"qmake\";\n                break;\n            case R.id.qml:\n                mConf.mLanguage = \"qml\";\n                break;\n            case R.id.qu:\n                mConf.mLanguage = \"qu\";\n                break;\n            case R.id.r:\n                mConf.mLanguage = \"r\";\n                break;\n            case R.id.rebol:\n                mConf.mLanguage = \"rebol\";\n                break;\n            case R.id.rexx:\n                mConf.mLanguage = \"rexx\";\n                break;\n            case R.id.rnc:\n                mConf.mLanguage = \"rnc\";\n                break;\n            case R.id.rpg:\n                mConf.mLanguage = \"rpg\";\n                break;\n            case R.id.rpl:\n                mConf.mLanguage = \"rpl\";\n                break;\n            case R.id.rs:\n                mConf.mLanguage = \"rs\";\n                break;\n            case R.id.ruby:\n                mConf.mLanguage = \"ruby\";\n                break;\n            case R.id.s:\n                mConf.mLanguage = \"s\";\n                break;\n            case R.id.sas:\n                mConf.mLanguage = \"sas\";\n                break;\n            case R.id.scala:\n                mConf.mLanguage = \"scala\";\n                break;\n            case R.id.scilab:\n                mConf.mLanguage = \"scilab\";\n                break;\n            case R.id.scss:\n                mConf.mLanguage = \"scss\";\n                break;\n            case R.id.sh:\n                mConf.mLanguage = \"sh\";\n                break;\n            case R.id.small:\n                mConf.mLanguage = \"small\";\n                break;\n            case R.id.smalltalk:\n                mConf.mLanguage = \"smalltalk\";\n                break;\n            case R.id.sml:\n                mConf.mLanguage = \"sml\";\n                break;\n            case R.id.snmp:\n                mConf.mLanguage = \"snmp\";\n                break;\n            case R.id.snobol:\n                mConf.mLanguage = \"snobol\";\n                break;\n            case R.id.spec:\n                mConf.mLanguage = \"spec\";\n                break;\n            case R.id.spn:\n                mConf.mLanguage = \"spn\";\n                break;\n            case R.id.sql:\n                mConf.mLanguage = \"sql\";\n                break;\n            case R.id.squirrel:\n                mConf.mLanguage = \"squirrel\";\n                break;\n            case R.id.styl:\n                mConf.mLanguage = \"styl\";\n                break;\n            case R.id.swift:\n                mConf.mLanguage = \"swift\";\n                break;\n            case R.id.sybase:\n                mConf.mLanguage = \"sybase\";\n                break;\n            case R.id.tcl:\n                mConf.mLanguage = \"tcl\";\n                break;\n            case R.id.tcsh:\n                mConf.mLanguage = \"tcsh\";\n                break;\n            case R.id.tex:\n                mConf.mLanguage = \"tex\";\n                break;\n            case R.id.ts:\n                mConf.mLanguage = \"ts\";\n                break;\n            case R.id.tsql:\n                mConf.mLanguage = \"tsql\";\n                break;\n            case R.id.ttcn3:\n                mConf.mLanguage = \"ttcn3\";\n                break;\n            case R.id.txt:\n                mConf.mLanguage = \"txt\";\n                break;\n            case R.id.upc:\n                mConf.mLanguage = \"upc\";\n                break;\n            case R.id.vala:\n                mConf.mLanguage = \"vala\";\n                break;\n            case R.id.vb:\n                mConf.mLanguage = \"vb\";\n                break;\n            case R.id.verilog:\n                mConf.mLanguage = \"verilog\";\n                break;\n            case R.id.vhd:\n                mConf.mLanguage = \"vhd\";\n                break;\n            case R.id.xml:\n                mConf.mLanguage = \"xml\";\n                break;\n            case R.id.xpp:\n                mConf.mLanguage = \"xpp\";\n                break;\n            case R.id.yaiff:\n                mConf.mLanguage = \"yaiff\";\n                break;\n            case R.id.yang:\n                mConf.mLanguage = \"yang\";\n                break;\n            case R.id.znn:\n                mConf.mLanguage = \"znn\";\n                break;\n\n            case R.id.acid:\n                mConf.mTheme = \"acid\";\n                break;\n            case R.id.aiseered:\n                mConf.mTheme = \"aiseered\";\n                break;\n            case R.id.andes:\n                mConf.mTheme = \"andes\";\n                break;\n            case R.id.anotherdark:\n                mConf.mTheme = \"anotherdark\";\n                break;\n            case R.id.autumn:\n                mConf.mTheme = \"autumn\";\n                break;\n            case R.id.baycomb:\n                mConf.mTheme = \"baycomb\";\n                break;\n            case R.id.bclear:\n                mConf.mTheme = \"bclear\";\n                break;\n            case R.id.biogoo:\n                mConf.mTheme = \"biogoo\";\n                break;\n            case R.id.bipolar:\n                mConf.mTheme = \"bipolar\";\n                break;\n            case R.id.blacknblue:\n                mConf.mTheme = \"blacknblue\";\n                break;\n            case R.id.bluegreen:\n                mConf.mTheme = \"bluegreen\";\n                break;\n            case R.id.breeze:\n                mConf.mTheme = \"breeze\";\n                break;\n            case R.id.bright:\n                mConf.mTheme = \"bright\";\n                break;\n            case R.id.camo:\n                mConf.mTheme = \"camo\";\n                break;\n            case R.id.candy:\n                mConf.mTheme = \"candy\";\n                break;\n            case R.id.clarity:\n                mConf.mTheme = \"clarity\";\n                break;\n            case R.id.dante:\n                mConf.mTheme = \"dante\";\n                break;\n            case R.id.darkblue:\n                mConf.mTheme = \"darkblue\";\n                break;\n            case R.id.darkbone:\n                mConf.mTheme = \"darkbone\";\n                break;\n            case R.id.darkness:\n                mConf.mTheme = \"darkness\";\n                break;\n            case R.id.darkslategray:\n                mConf.mTheme = \"darkslategray\";\n                break;\n            case R.id.darkspectrum:\n                mConf.mTheme = \"darkspectrum\";\n                break;\n            case R.id.denim:\n                mConf.mTheme = \"denim\";\n                break;\n            case R.id.dusk:\n                mConf.mTheme = \"dusk\";\n                break;\n            case R.id.earendel:\n                mConf.mTheme = \"earendel\";\n                break;\n            case R.id.easter:\n                mConf.mTheme = \"easter\";\n                break;\n            case R.id.edit_anjuta:\n                mConf.mTheme = \"edit-anjuta\";\n                break;\n            case R.id.edit_eclipse:\n                mConf.mTheme = \"edit-eclipse\";\n                break;\n            case R.id.edit_emacs:\n                mConf.mTheme = \"edit-emacs\";\n                break;\n            case R.id.edit_flashdevelop:\n                mConf.mTheme = \"edit-flashdevelop\";\n                break;\n            case R.id.edit_gedit:\n                mConf.mTheme = \"edit-gedit\";\n                break;\n            case R.id.edit_jedit:\n                mConf.mTheme = \"edit-jedit\";\n                break;\n            case R.id.edit_kwrite:\n                mConf.mTheme = \"edit-kwrite\";\n                break;\n            case R.id.edit_matlab:\n                mConf.mTheme = \"edit-matlab\";\n                break;\n            case R.id.edit_msvs2008:\n                mConf.mTheme = \"edit-msvs2008\";\n                break;\n            case R.id.edit_nedit:\n                mConf.mTheme = \"edit-nedit\";\n                break;\n            case R.id.edit_vim_dark:\n                mConf.mTheme = \"edit-vim-dark\";\n                break;\n            case R.id.edit_vim:\n                mConf.mTheme = \"edit-vim\";\n                break;\n            case R.id.edit_xcode:\n                mConf.mTheme = \"edit-xcode\";\n                break;\n            case R.id.ekvoli:\n                mConf.mTheme = \"ekvoli\";\n                break;\n            case R.id.freya:\n                mConf.mTheme = \"freya\";\n                break;\n            case R.id.fruit:\n                mConf.mTheme = \"fruit\";\n                break;\n            case R.id.golden:\n                mConf.mTheme = \"golden\";\n                break;\n            case R.id.greenlcd:\n                mConf.mTheme = \"greenlcd\";\n                break;\n            case R.id.kellys:\n                mConf.mTheme = \"kellys\";\n                break;\n            case R.id.leo:\n                mConf.mTheme = \"leo\";\n                break;\n            case R.id.lucretia:\n                mConf.mTheme = \"lucretia\";\n                break;\n            case R.id.manxome:\n                mConf.mTheme = \"manxome\";\n                break;\n            case R.id.maroloccio:\n                mConf.mTheme = \"maroloccio\";\n                break;\n            case R.id.matrix:\n                mConf.mTheme = \"matrix\";\n                break;\n            case R.id.moe:\n                mConf.mTheme = \"moe\";\n                break;\n            case R.id.moria:\n                mConf.mTheme = \"moria\";\n                break;\n            case R.id.navajo_night:\n                mConf.mTheme = \"navajo-night\";\n                break;\n            case R.id.navy:\n                mConf.mTheme = \"navy\";\n                break;\n            case R.id.neon:\n                mConf.mTheme = \"neon\";\n                break;\n            case R.id.night:\n                mConf.mTheme = \"night\";\n                break;\n            case R.id.nightshimmer:\n                mConf.mTheme = \"nightshimmer\";\n                break;\n            case R.id.nuvola:\n                mConf.mTheme = \"nuvola\";\n                break;\n            case R.id.olive:\n                mConf.mTheme = \"olive\";\n                break;\n            case R.id.orion:\n                mConf.mTheme = \"orion\";\n                break;\n            case R.id.oxygenated:\n                mConf.mTheme = \"oxygenated\";\n                break;\n            case R.id.pablo:\n                mConf.mTheme = \"pablo\";\n                break;\n            case R.id.peaksea:\n                mConf.mTheme = \"peaksea\";\n                break;\n            case R.id.print:\n                mConf.mTheme = \"print\";\n                break;\n            case R.id.rand01:\n                mConf.mTheme = \"rand01\";\n                break;\n            case R.id.rdark:\n                mConf.mTheme = \"rdark\";\n                break;\n            case R.id.relaxedgreen:\n                mConf.mTheme = \"relaxedgreen\";\n                break;\n            case R.id.rootwater:\n                mConf.mTheme = \"rootwater\";\n                break;\n            case R.id.seashell:\n                mConf.mTheme = \"seashell\";\n                break;\n            case R.id.solarized_dark:\n                mConf.mTheme = \"solarized-dark\";\n                break;\n            case R.id.tabula:\n                mConf.mTheme = \"tabula\";\n                break;\n            case R.id.tcsoft:\n                mConf.mTheme = \"tcsoft\";\n                break;\n            case R.id.the:\n                mConf.mTheme = \"the\";\n                break;\n            case R.id.whitengrey:\n                mConf.mTheme = \"whitengrey\";\n                break;\n            case R.id.xoria256:\n                mConf.mTheme = \"xoria256\";\n                break;\n            case R.id.zellner:\n                mConf.mTheme = \"zellner\";\n                break;\n            case R.id.zenburn:\n                mConf.mTheme = \"zenburn\";\n                break;\n            case R.id.zmrok:\n                mConf.mTheme = \"zmrok\";\n                break;\n\n            case R.id.action_about:\n                Dialog dialog1 = new Dialog(this);\n                dialog1.setContentView(R.layout.about);\n                dialog1.setTitle(\"关于\");\n                dialog1.show();\n                break;\n            default:\n                break;\n        }\n\n        if (item.isCheckable()) {\n            item.setChecked(true);\n        }\n\n        mHighlightEdit.loadFromConfigure(mConf);\n        mHighlightEdit.setSource(mTextcode);\n\n\n        return super.onOptionsItemSelected(item);\n    }\n}\n"
  },
  {
    "path": "src/org/evilbinary/highliter/CodeTextWatcher.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.highliter;\n\nimport android.text.Editable;\nimport android.text.TextWatcher;\n\nimport org.evilbinary.highliter.parsers.MyTagToSpannedConverter;\nimport org.evilbinary.highliter.parsers.SyntaxHighlight;\nimport org.evilbinary.utils.Logger;\n\npublic class CodeTextWatcher implements TextWatcher {\n\n    private SyntaxHighlight mHi;\n    private HighlightEditText mText;\n    private MyTagToSpannedConverter mConverter;\n\n    public CodeTextWatcher(SyntaxHighlight hi, HighlightEditText text, MyTagToSpannedConverter converter) {\n        mHi = hi;\n        mText = text;\n        mConverter = converter;\n    }\n\n    @Override\n    public void afterTextChanged(Editable text) {\n        // Logger.d(\"afterTextChanged:\");\n    }\n\n    @Override\n    public void beforeTextChanged(CharSequence sub, int start, int before, int after) {\n        // Logger.d(\"beforeTextChanged\");\n        Logger.d(\"onTextChanged\");\n        int end = mText.getSelectionStart();\n        int begin = end;\n        boolean tagOn = false;\n        Logger.d(start + \",\" + before + \",\" + after);\n\n        while (begin >= 1) {\n            String str = sub.subSequence(begin - 1, begin).toString();\n            if (!tagOn && (str.equals(\" \") || str.equals(mConverter.getLineSeparator()))) {\n                break;\n            } else if (str.equals(\"\\\"\")) {\n                if (tagOn) {\n                    begin--;\n                    tagOn = false;\n                }\n            } else if (str.equals(\"/\")) {\n                begin--;\n                if (begin >= 1) {\n                    String s = sub.subSequence(begin - 1, begin).toString();\n                    if (s.equals(\"*\")) {\n                        tagOn = true;\n                    }\n                }\n            } else if (str.equals(\"*\")) {\n                begin--;\n                if (begin >= 1) {\n                    String s = sub.subSequence(begin - 1, begin).toString();\n                    if (s.equals(\"/\")) {\n                        tagOn = false;\n                    }\n                }\n            }\n            begin--;\n        }\n//\t\tSystem.out.println(\"begin-end2=\"+begin + \",\" + end);\n\n        if (begin >= 0 && begin < end) {\n            CharSequence str = sub.subSequence(begin, end);\n//\t\t\t System.out.println(begin + \" \" + end + \" str:\" + str);\n            if (str != null && !str.equals(\"\")) {\n                String result = mHi.pase(str.toString());\n//\t\t\t\t System.out.println(\"@@@@@@@@@@@@@:\" + result);\n//                Spanned spanText = mConverter.convert(result);\n//                mText.render(spanText, begin);\n            }\n        }\n    }\n\n    @Override\n    public void onTextChanged(CharSequence sub, int start, int before, int after) {\n\n\n    }\n}\n"
  },
  {
    "path": "src/org/evilbinary/highliter/Constants.java",
    "content": "package org.evilbinary.highliter;\n\nimport java.io.File;\n\nimport android.os.Environment;\n\n/**\n * @author x.gouchet\n * \n */\npublic interface Constants {\n\n\t/** Tag for the log ( = {@value} ) */\n\tpublic static final String TAG = \"TED\";\n\n\tpublic static final String ACTION_WIDGET_OPEN = \"org.evilbinary.ACTION_TED_WIDGET_OPEN\";\n\n\t/** Fonts folder */\n\tpublic static final String FONT_FOLDER_NAME = \"fonts\";\n\t/** Font file */\n\tpublic static final String FONT_FILE_NAME = \"ted_font.ttf\";\n\n\t/** clears the current text ( = {@value} ) */\n\tpublic static final int MENU_ID_NEW = 0;\n\t/** Saves the file ( = {@value} ) */\n\tpublic static final int MENU_ID_SAVE = 1;\n\t/** Savesas a new file ( = {@value} ) */\n\tpublic static final int MENU_ID_SAVE_AS = 2;\n\t/** open an existing file */\n\tpublic static final int MENU_ID_OPEN = 3;\n\t/** open an existing file ( = {@value} ) */\n\tpublic static final int MENU_ID_OPEN_RECENT = 4;\n\t/** open the settings ( = {@value} ) */\n\tpublic static final int MENU_ID_SETTINGS = 5;\n\t/** open the about page ( = {@value} ) */\n\tpublic static final int MENU_ID_ABOUT = 6;\n\t/** Search a string in the file ( = {@value} ) */\n\tpublic static final int MENU_ID_SEARCH = 7;\n\t/** undo last change ( = {@value} ) */\n\tpublic static final int MENU_ID_UNDO = 8;\n\t/** redo last change ( = {@value} ) */\n\tpublic static final int MENU_ID_REDO = 9;\n\t/** Quit the app ( = {@value} ) */\n\tpublic static final int MENU_ID_QUIT = 666;\n\n\t/** File of the external storage data */\n\tpublic static final File STORAGE = Environment\n\t\t\t.getExternalStorageDirectory();\n\t/** Path to the external storage data */\n\tpublic static final String STORAGE_PATH = STORAGE.getAbsolutePath();\n\t/** name of the backup file */\n\tpublic static final String BACKUP_FILE_NAME = \"temp.bak\";\n\n\t/** name of the shared preferences for this app ( = {@value} ) */\n\tpublic static final String PREFERENCES_NAME = \"fr.xgouchet.texteditor\";\n\t/** Preference tag to retrieve the recent files ( = {@value} ) */\n\tpublic static final String PREFERENCE_RECENTS = \"recent_files\";\n\t/** Preference tag to retrieve the recent files ( = {@value} ) */\n\tpublic static final String PREFERENCE_MAX_RECENTS = \"max_recent_files\";\n\t/** Preference tag to retrieve the show line number ( = {@value} ) */\n\tpublic static final String PREFERENCE_SHOW_LINE_NUMBERS = \"show_line_numbers\";\n\t/** Preference tag to retrieve the wordwrap ( = {@value} ) */\n\tpublic static final String PREFERENCE_WORDWRAP = \"auto_break_lines\";\n\t/** Preference tag to retrieve the searchwrap ( = {@value} ) */\n\tpublic static final String PREFERENCE_SEARCHWRAP = \"search_wrap\";\n\t/** Preference tag to retrieve the search match case ( = {@value} ) */\n\tpublic static final String PREFERENCE_SEARCH_MATCH_CASE = \"search_match_case\";\n\t/** Preference tag to retrieve the Syntax Highlight ( = {@value} ) */\n\tpublic static final String PREFERENCE_HIGHLIGHT = \"highlight_syntax\";\n\t/** Preference tag to retrieve the Text Size ( = {@value} ) */\n\tpublic static final String PREFERENCE_TEXT_SIZE = \"text_size\";\n\t/** Preference tag to retrieve the End of lines pref ( = {@value} ) */\n\tpublic static final String PREFERENCE_END_OF_LINES = \"end_of_lines\";\n\t/** Preference tag to retrieve the Encoding pref ( = {@value} ) */\n\tpublic static final String PREFERENCE_ENCODING = \"encoding\";\n\t/** Preference tag to retrieve the Auto mode ( = {@value} ) */\n\tpublic static final String PREFERENCE_AUTO_SAVE = \"force_auto_save\";\n\t/** Preference tag to retrieve the Auto mode ( = {@value} ) */\n\tpublic static final String PREFERENCE_AUTO_SAVE_OVERWRITE = \"auto_save_overwrite\";\n\t/** Preference tag to retrieve the Color Theme ( = {@value} ) */\n\tpublic static final String PREFERENCE_COLOR_THEME = \"color_theme\";\n\t/** Preference tag to retrieve the fling to scroll ( = {@value} ) */\n\tpublic static final String PREFERENCE_FLING_TO_SCROLL = \"fling_to_scroll\";\n\t/** Preference tag to retrieve if undo history is allowed ( = {@value} ) */\n\tpublic static final String PREFERENCE_ALLOW_UNDO = \"allow_undo\";\n\t/** Preference tag to retrieve the max undo stack ( = {@value} ) */\n\tpublic static final String PREFERENCE_MAX_UNDO_STACK = \"max_undo_stack\";\n\t/** Preference tag to retrieve the back button as undo ( = {@value} ) */\n\tpublic static final String PREFERENCE_BACK_BUTTON_AS_UNDO = \"back_button_as_undo\";\n\t/** Preference tag to retrieve the use home page ( = {@value} ) */\n\tpublic static final String PREFERENCE_USE_HOME_PAGE = \"use_home_page\";\n\t/** Preference tag to retrieve the home page path ( = {@value} ) */\n\tpublic static final String PREFERENCE_HOME_PAGE_PATH = \"home_page_path\";\n\t/** Preference tag to select the font ( = {@value} ) */\n\tpublic static final String PREFERENCE_SELECT_FONT = \"select_font\";\n\t/** Preference tag to the text font ( = {@value} ) */\n\tpublic static final String PREFERENCE_FONT = \"text_font\";\n\n\t/** minimum text size */\n\tpublic static final int TEXT_SIZE_MIN = 9;\n\t/** maximum text size */\n\tpublic static final int TEXT_SIZE_MAX = 40;\n\n\t/** End of line setting for Linux files ( = {@value} ) */\n\tpublic static final int EOL_LINUX = 0;\n\t/** End of line setting for Windows files ( = {@value} ) */\n\tpublic static final int EOL_WINDOWS = 1;\n\t/** End of line setting for Mac files ( = {@value} ) */\n\tpublic static final int EOL_MAC = 2;\n\n\t/** Encoding : 7 bit ASCII ( = {@value} ) */\n\tpublic static final String ENC_ASCII = \"US-ASCII\";\n\t/** Encoding : ISO Latin Alphabet, aka ISO-LATIN-1 ( = {@value} ) */\n\tpublic static final String ENC_LATIN = \"ISO-8859-1\";\n\t/** Encoding : 8 bit UCS Transformation Format ( = {@value} ) */\n\tpublic static final String ENC_UTF8 = \"UTF-8\";\n\n\t/** color theme default : black on white ( = {@value} ) */\n\tpublic static final int COLOR_CLASSIC = 0;\n\t/** color theme negative : white on black ( = {@value} ) */\n\tpublic static final int COLOR_NEGATIVE = 1;\n\t/** color theme matrix : green on dark green ( = {@value} ) */\n\tpublic static final int COLOR_MATRIX = 2;\n\t/** color theme sky : darkblue on skyblue ( = {@value} ) */\n\tpublic static final int COLOR_SKY = 3;\n\t/** color theme dracula : red on black ( = {@value} ) */\n\tpublic static final int COLOR_DRACULA = 4;\n\n\t/** Request code for Save As Activity */\n\tpublic static final int REQUEST_SAVE_AS = 107;\n\t/** Request code for Open Activity */\n\tpublic static final int REQUEST_OPEN = 108;\n\t/** Request code for Home Page Activity */\n\tpublic static final int REQUEST_HOME_PAGE = 109;\n\t/** Request code for Font Activity */\n\tpublic static final int REQUEST_FONT = 110;\n\n\t/** extra when browsing for file */\n\tpublic static final String EXTRA_REQUEST_CODE = \"request_code\";\n\t/** Extra to force read only from widget */\n\tpublic static final String EXTRA_FORCE_READ_ONLY = \"force_read_only\";\n\n\t/** an error result */\n\tpublic static final int RESULT_ERROR = 1;\n}\n"
  },
  {
    "path": "src/org/evilbinary/highliter/HighlightEditText.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.highliter;\n\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.graphics.Paint;\nimport android.graphics.Point;\nimport android.graphics.Rect;\nimport android.graphics.Typeface;\nimport android.text.SpannableStringBuilder;\nimport android.text.Spanned;\nimport android.text.method.ScrollingMovementMethod;\nimport android.text.style.CharacterStyle;\nimport android.view.GestureDetector;\nimport android.view.GestureDetector.OnGestureListener;\nimport android.view.KeyEvent;\nimport android.view.MotionEvent;\nimport android.view.View;\nimport android.view.View.OnKeyListener;\nimport android.view.inputmethod.InputMethodManager;\nimport android.widget.EditText;\nimport android.widget.Scroller;\n\nimport org.evilbinary.highliter.parsers.MyTagToSpannedConverter;\nimport org.evilbinary.highliter.parsers.SyntaxHighlight;\nimport org.evilbinary.managers.Configure;\n\npublic class HighlightEditText extends EditText implements Constants, OnKeyListener, OnGestureListener {\n\n    private MyTagToSpannedConverter mConverter;\n    private SyntaxHighlight mMaker;\n    private CodeTextWatcher mWatcher;\n\n    /**\n     * The line numbers paint\n     */\n    protected Paint mPaintNumbers;\n    /**\n     * The line numbers paint\n     */\n    protected Paint mPaintHighlight;\n    /**\n     * the offset value in dp\n     */\n    protected int mPaddingDP = 6;\n    /**\n     * the padding scaled\n     */\n    protected int mPadding, mLinePadding;\n    /**\n     * the scale for desnity pixels\n     */\n    protected float mScale;\n\n    /**\n     * the scroller instance\n     */\n    protected Scroller mTedScroller;\n    /**\n     * the velocity tracker\n     */\n    protected GestureDetector mGestureDetector;\n    /**\n     * the Max size of the view\n     */\n    protected Point mMaxSize;\n\n    /**\n     * the highlighted line index\n     */\n    protected int mHighlightedLine;\n    protected int mHighlightStart;\n\n    protected Rect mDrawingRect, mLineBounds;\n\n    protected Configure mConfigure;\n\n    public HighlightEditText(Context context, Configure conf) {\n        super(context);\n        mConfigure = conf;\n\n        mPaintNumbers = new Paint();\n        mPaintNumbers.setTypeface(Typeface.MONOSPACE);\n        mPaintNumbers.setAntiAlias(true);\n\n        mPaintHighlight = new Paint();\n        mScale = getResources().getDisplayMetrics().density;\n        mPadding = (int) (mPaddingDP * mScale);\n\n        mHighlightedLine = mHighlightStart = -1;\n\n        mDrawingRect = new Rect();\n        mLineBounds = new Rect();\n\n        mMaker = new SyntaxHighlight(mConfigure);\n        mGestureDetector = new GestureDetector(getContext(), this);\n        mConverter = new MyTagToSpannedConverter(this.getContext(), mMaker);\n\n        mWatcher = new CodeTextWatcher(mMaker, this, mConverter);\n        //this.addTextChangedListener(mWatcher);\n        this.setOnKeyListener(this);\n\n        loadFromConfigure(conf);\n    }\n\n    public void loadFromConfigure(Configure configure) {\n        mConfigure = configure;\n        mMaker.loadConfigure(mConfigure);\n        mConverter.loadCss(mConfigure.mDataPath + \"/\" + mConfigure.mHighlightCss);\n\n        updateSettings();\n        if (mConverter != null) {\n            if (mConverter.getForeground() != null)\n                this.setTextColor(mConverter.getForeground());\n            if (mConverter.getBackground() != null)\n                this.setBackgroundColor(mConverter.getBackground());\n        }\n\n    }\n\n    public Configure getConfigure() {\n        return mConfigure;\n    }\n\n\n    public void setSource(String source) {\n        try {\n            if (source != null && !source.equals(\"\")) {\n                setText(source);\n                mConverter.convert(this);\n            }\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    public void render(Spanned spanText, int begin) {\n        try {\n            if (spanText != null) {\n                SpannableStringBuilder spannableStringBuilder = (SpannableStringBuilder) this.getText();\n\n\n\n                CharacterStyle[] allSpans = spanText.getSpans(0, spanText.length(), CharacterStyle.class);\n\n                //Logger.d(\"allSpans size:\" + allSpans.length);\n                if (allSpans.length == 0) {\n                    allSpans = spannableStringBuilder.getSpans(begin, begin + spanText.length(), CharacterStyle.class);\n                    for (CharacterStyle span : allSpans) {\n                        spannableStringBuilder.removeSpan(span);\n                    }\n                } else {\n                    for (CharacterStyle span : allSpans) {\n                        int spanStart = spanText.getSpanStart(span);\n                        int spanEnd = spanText.getSpanEnd(span);\n                        int flag = spanText.getSpanFlags(span);\n\n                        spannableStringBuilder.setSpan(CharacterStyle.wrap(span), begin + spanStart, begin + spanEnd, flag);\n\n                    }\n                }\n\n            }\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n    @Override\n    protected void onDraw(Canvas canvas) {\n\n        super.onDraw(canvas);\n\n        int count, lineX, baseline;\n        count = getLineCount();\n        if (mConfigure.mSettings.SHOW_LINE_NUMBERS) {\n            int padding = (int) (Math.floor(Math.log10(count)) + 1);\n            padding = (int) ((padding * mPaintNumbers.getTextSize()) + mPadding + (mConfigure.mSettings.TEXT_SIZE\n                    * mScale * 0.5));\n            if (mLinePadding != padding) {\n                mLinePadding = padding;\n                setPadding(mLinePadding, mPadding, mPadding, mPadding);\n            }\n        }\n\n        // get the drawing boundaries\n        getDrawingRect(mDrawingRect);\n\n        // display current line\n        computeLineHighlight();\n\n        // draw line numbers\n        lineX = (int) (mDrawingRect.left + mLinePadding - (mConfigure.mSettings.TEXT_SIZE * mScale * 0.5));\n        int min = 0;\n        int max = count;\n        getLineBounds(0, mLineBounds);\n        int startBottom = mLineBounds.bottom;\n        int startTop = mLineBounds.top;\n        getLineBounds(count - 1, mLineBounds);\n        int endBottom = mLineBounds.bottom;\n        int endTop = mLineBounds.top;\n        if (count > 1 && endBottom > startBottom && endTop > startTop) {\n            min = Math.max(min, ((mDrawingRect.top - startBottom) * (count - 1)) / (endBottom - startBottom));\n            max = Math.min(max, ((mDrawingRect.bottom - startTop) * (count - 1)) / (endTop - startTop) + 1);\n        }\n        for (int i = min; i < max; i++) {\n            baseline = getLineBounds(i, mLineBounds);\n            if ((mMaxSize != null) && (mMaxSize.x < mLineBounds.right)) {\n                mMaxSize.x = mLineBounds.right;\n            }\n            if ((i == mHighlightedLine) && (!mConfigure.mSettings.WORDWRAP) && mConfigure.mSettings.SHOW_LINE_HIGHLIGHT) {\n                canvas.drawRect(mLineBounds, mPaintHighlight);\n            }\n\n            if (mConfigure.mSettings.SHOW_LINE_NUMBERS) {\n                canvas.drawText(\"\" + (i + 1), mDrawingRect.left + mPadding, baseline, mPaintNumbers);\n            }\n            if (mConfigure.mSettings.SHOW_LINE_NUMBERS) {\n                canvas.drawLine(lineX, mDrawingRect.top, lineX, mDrawingRect.bottom, mPaintNumbers);\n            }\n        }\n        getLineBounds(count - 1, mLineBounds);\n        if (mMaxSize != null) {\n            mMaxSize.y = mLineBounds.bottom;\n            mMaxSize.x = Math.max(mMaxSize.x + mPadding - mDrawingRect.width(), 0);\n            mMaxSize.y = Math.max(mMaxSize.y + mPadding - mDrawingRect.height(), 0);\n        }\n\n    }\n\n    protected void computeLineHighlight() {\n        int i, line, selStart;\n        String text;\n        if (!isEnabled()) {\n            mHighlightedLine = -1;\n            return;\n        }\n        selStart = getSelectionStart();\n        if (mHighlightStart != selStart) {\n            text = getText().toString();\n            line = i = 0;\n            while (i < selStart) {\n                i = text.indexOf(mConfigure.mLineSeparator, i);\n                if (i < 0) {\n                    break;\n                }\n                if (i < selStart) {\n                    ++line;\n                }\n                ++i;\n            }\n            mHighlightedLine = line;\n        }\n    }\n\n    private void updateSettings() {\n\n        if (isInEditMode() || mConfigure == null || mPaintNumbers == null || mPaintHighlight == null) {\n            return;\n        }\n\n        setTypeface(mConfigure.mSettings.getTypeface(getContext()));\n\n        // wordwrap\n        setHorizontallyScrolling(!mConfigure.mSettings.WORDWRAP);\n        if (!mConfigure.mSettings.WORDWRAP)// 卡顿问题\n            setMovementMethod(ScrollingMovementMethod.getInstance());\n\n        // setTextColor(Color.BLACK);\n        mPaintHighlight.setColor(mConfigure.mLineHighlightColor);\n        mPaintNumbers.setColor(mConfigure.mLineNumberColor);\n        mPaintHighlight.setAlpha(mConfigure.mLineHighlightAlpha);\n\n        // text size\n        setTextSize(mConfigure.mSettings.TEXT_SIZE);\n        mPaintNumbers.setTextSize(mConfigure.mSettings.TEXT_SIZE * mScale * 0.85f);\n\n        // refresh view\n        postInvalidate();\n        refreshDrawableState();\n\n        // use Fling when scrolling settings ?\n        if (mConfigure.mSettings.FLING_TO_SCROLL) {\n            mTedScroller = new Scroller(getContext());\n            mMaxSize = new Point();\n        } else {\n            mTedScroller = null;\n            mMaxSize = null;\n        }\n\n        // padding\n        mLinePadding = mPadding;\n        int count = getLineCount();\n        if (mConfigure.mSettings.SHOW_LINE_NUMBERS) {\n            mLinePadding = (int) (Math.floor(Math.log10(count)) + 1);\n            mLinePadding = (int) ((mLinePadding * mPaintNumbers.getTextSize()) + mPadding + (mConfigure.mSettings.TEXT_SIZE\n                    * mScale * 0.5));\n            setPadding(mLinePadding, mPadding, mPadding, mPadding);\n        } else {\n            setPadding(mPadding, mPadding, mPadding, mPadding);\n        }\n    }\n\n    @Override\n    public boolean onDown(MotionEvent arg0) {\n        // TODO Auto-generated method stub\n        return true;\n    }\n\n    public void computeScroll() {\n\n        if (mTedScroller != null) {\n            if (mTedScroller.computeScrollOffset()) {\n                scrollTo(mTedScroller.getCurrX(), mTedScroller.getCurrY());\n            }\n        } else {\n            super.computeScroll();\n        }\n    }\n\n    public boolean onTouchEvent(MotionEvent event) {\n\n        super.onTouchEvent(event);\n        if (mGestureDetector != null) {\n            return mGestureDetector.onTouchEvent(event);\n        }\n\n        return true;\n    }\n\n    @Override\n    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {\n        if (!mConfigure.mSettings.FLING_TO_SCROLL) {\n            return true;\n        }\n\n        if (mTedScroller != null) {\n            mTedScroller.fling(getScrollX(), getScrollY(), -(int) velocityX, -(int) velocityY, 0, mMaxSize.x, 0,\n                    mMaxSize.y);\n        }\n        return true;\n    }\n\n    @Override\n    public void onLongPress(MotionEvent arg0) {\n        // TODO Auto-generated method stub\n\n    }\n\n    @Override\n    public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2, float arg3) {\n        // TODO Auto-generated method stub\n        return true;\n    }\n\n    @Override\n    public void onShowPress(MotionEvent arg0) {\n        // TODO Auto-generated method stub\n\n    }\n\n    @Override\n    public boolean onSingleTapUp(MotionEvent arg0) {\n        // TODO Auto-generated method stub\n\n        if (isEnabled()) {\n            ((InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(this,\n                    InputMethodManager.SHOW_IMPLICIT);\n        }\n        return true;\n    }\n\n    @Override\n    public boolean onKey(View v, int keyCode, KeyEvent keyEvent) {\n//        Logger.d(\"onKey:\"+keyEvent.getKeyCode());\n        return false;\n    }\n\n}\n"
  },
  {
    "path": "src/org/evilbinary/highliter/parsers/MyTagToSpannedConverter.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.highliter.parsers;\n\nimport android.content.Context;\nimport android.graphics.Color;\nimport android.text.Spannable;\nimport android.text.SpannableStringBuilder;\nimport android.text.style.AbsoluteSizeSpan;\nimport android.text.style.BackgroundColorSpan;\nimport android.text.style.ForegroundColorSpan;\nimport android.widget.EditText;\n\nimport com.steadystate.css.parser.CSSOMParser;\nimport com.steadystate.css.parser.SACParserCSS3;\n\nimport org.evilbinary.highliter.spans.SpanStyle;\nimport org.evilbinary.utils.PxAndDp;\nimport org.w3c.dom.css.CSSImportRule;\nimport org.w3c.dom.css.CSSPrimitiveValue;\nimport org.w3c.dom.css.CSSRule;\nimport org.w3c.dom.css.CSSRuleList;\nimport org.w3c.dom.css.CSSStyleDeclaration;\nimport org.w3c.dom.css.CSSStyleRule;\nimport org.w3c.dom.css.CSSStyleSheet;\n\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.HashMap;\nimport java.util.List;\n\npublic class MyTagToSpannedConverter {\n\n    private SpannableStringBuilder mSpannableStringBuilder;\n\n    private HashMap<String, SpanStyle> mStyles;\n    private Context mContext;\n    private String mSp;\n\n    private String mCurTag;\n    private String title;\n    private SyntaxHighlight mSyntaxHighlight;\n\n    public MyTagToSpannedConverter(Context context, SyntaxHighlight syntaxHighlight) {\n        mSpannableStringBuilder = new SpannableStringBuilder();\n        mStyles = new HashMap<String, SpanStyle>();\n        mContext = context;\n        mSp = System.getProperty(\"line.separator\");\n        mSyntaxHighlight = syntaxHighlight;\n\n    }\n\n    public String getLineSeparator() {\n        return mSp;\n    }\n\n    public void convert(EditText editText) {\n        try {\n\n            mSyntaxHighlight.pase(editText.getText().toString());\n            List<Token> tokenList = mSyntaxHighlight.getTokenList();\n            SpannableStringBuilder spannableStringBuilder = (SpannableStringBuilder) editText.getText();\n\n            int start = 0;\n            for (Token token : tokenList) {\n                int len = token.string.length();\n                SpanStyle style = mStyles.get(token.style);\n                if (style != null) {\n                    style.applyStyle(spannableStringBuilder, start, start + len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);\n                }\n                start += len;\n            }\n\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n\n    //加载css\n    public void loadCss(String filePath) {\n        paseCss(filePath);\n    }\n\n    private void paseCss(String filePath) {\n        paseCss(new File(filePath));\n    }\n\n    private void paseCss(File file) {\n        try {\n            InputStream is = new FileInputStream(file);\n            paseCss(is);\n        } catch (FileNotFoundException e) {\n            e.printStackTrace();\n        }\n    }\n\n    private void paseCss(InputStream is) {\n        InputStreamReader ir = new InputStreamReader(is);\n        org.w3c.css.sac.InputSource source = new org.w3c.css.sac.InputSource(ir);\n\n        CSSOMParser parser = new CSSOMParser(new SACParserCSS3());\n        try {\n            CSSStyleSheet sheet = parser.parseStyleSheet(source, null, null);\n            CSSRuleList cssrules = sheet.getCssRules();\n            for (int i = 0; i < cssrules.getLength(); i++) {\n                CSSRule rule = cssrules.item(i);\n                if (rule instanceof CSSStyleRule) {\n                    CSSStyleRule cssrule = (CSSStyleRule) rule;\n//\t\t\t\t\tSystem.out.println(\"cssrule.getCssText:\" + cssrule.getCssText());\n//\t\t\t\t\tSystem.out.println(\"\tcssrule.getSelectorText:\" + cssrule.getSelectorText());\n                    CSSStyleDeclaration styles = cssrule.getStyle();\n\n                    SpanStyle spanStyles = new SpanStyle();\n                    for (int j = 0, n = styles.getLength(); j < n; j++) {\n                        String propName = styles.item(j);\n                        if (\"color\".equalsIgnoreCase(propName)) {\n                            int color = toColor((CSSPrimitiveValue) styles.getPropertyCSSValue(propName));\n                            ForegroundColorSpan span = new ForegroundColorSpan(color);\n                            spanStyles.addStyle(span, propName + \" rgb:\" + color, styles);\n                        } else if (\"background-color\".equalsIgnoreCase(propName)) {\n                            int color = toColor((CSSPrimitiveValue) styles.getPropertyCSSValue(propName));\n                            BackgroundColorSpan span = new BackgroundColorSpan(color);\n                            spanStyles.addStyle(span, propName, styles);\n                        } else if (\"font-size\".equalsIgnoreCase(propName)) {\n                            CSSPrimitiveValue val = (CSSPrimitiveValue) styles.getPropertyCSSValue(propName);\n                            int sizePx = (int) val.getFloatValue(CSSPrimitiveValue.CSS_NUMBER);\n//\t\t\t\t\t\t\tSystem.out.println(\" sizePx====:\" + sizePx);\n                            int sizeDp = PxAndDp.px2dip(this.mContext, sizePx);\n                            AbsoluteSizeSpan span = new AbsoluteSizeSpan(sizeDp, true);\n                            spanStyles.addStyle(span, propName, styles);\n                        }\n\n                    }\n//                    System.out.println(\"style:\"+cssrule.getSelectorText().replace(\"*.\",\"\"));\n\n                    mStyles.put(cssrule.getSelectorText().replace(\"*.\",\"\").replace(\".\",\" \"), spanStyles);\n                } else if (rule instanceof CSSImportRule) {\n                    CSSImportRule cssrule = (CSSImportRule) rule;\n                    System.out.println(cssrule.getHref());\n                }\n            }\n\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n\n    private int toColor(org.w3c.dom.css.RGBColor color) {\n        int red = (int) color.getRed().getFloatValue(CSSPrimitiveValue.CSS_NUMBER);\n        int green = (int) color.getGreen().getFloatValue(CSSPrimitiveValue.CSS_NUMBER);\n        int blue = (int) color.getBlue().getFloatValue(CSSPrimitiveValue.CSS_NUMBER);\n        int c = Color.rgb(red, green, blue);\n        return c;\n    }\n\n    private int toColor(CSSPrimitiveValue val) {\n        return toColor(val.getRGBColorValue());\n    }\n\n    public Integer getBackground() {\n        SpanStyle s = mStyles.get(\"body hl\");\n        if (s != null) {\n            CSSStyleDeclaration style = s.getCssStyle();\n            CSSPrimitiveValue val = (CSSPrimitiveValue) style.getPropertyCSSValue(\"background-color\");\n            Integer c = toColor(val);\n            return c;\n        }\n        return null;\n\n    }\n\n    public Integer getForeground() {\n        SpanStyle s = mStyles.get(\"pre hl\");\n        if (s != null) {\n            CSSStyleDeclaration style = s.getCssStyle();\n            CSSPrimitiveValue val = (CSSPrimitiveValue) style.getPropertyCSSValue(\"color\");\n            Integer c = toColor(val);\n            return c;\n        }\n        return null;\n    }\n\n    public String getTitle() {\n        return title;\n    }\n\n    public void setTitle(String title) {\n        this.title = title;\n    }\n\n\n}\n"
  },
  {
    "path": "src/org/evilbinary/highliter/parsers/SyntaxHighlight.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.highliter.parsers;\n\nimport org.evilbinary.managers.Configure;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class SyntaxHighlight {\n    static {\n        System.loadLibrary(\"lua\");\n        System.loadLibrary(\"highlight\");\n    }\n\n    private String mArgs = \"hilighlight\";\n    private String mDelim = \":\";\n\n    private List<Token> tokenList = new ArrayList<Token>(100);\n\n    public SyntaxHighlight(Configure conf) {\n        initArgs(conf);\n    }\n\n    private void initArgs(Configure conf) {\n        addArg(\"-D\" + conf.mDataPath);\n        addArg(\"-d\" + conf.mDataPath);\n        if (conf.mLanguage != null && !conf.mLanguage.equals(\"\"))\n            addArg(\"--syntax=\" + conf.mLanguage);\n        addArg(\"-f\");\n        addArg(\"--print-style\");// first gencssfile\n        if (conf.mTheme != null && !conf.mTheme.equals(\"\"))\n            addArg(\"-s\" + conf.mTheme);\n        if (conf.mHighlightCss != null && !conf.mHighlightCss.equals(\"\"))\n            addArg(\"-c\" + conf.mHighlightCss);\n\n        if (conf.mFont != null && !conf.mFont.equals(\"\"))\n            addArg(\"--font=\" + conf.mFont);\n        if (conf.mFontSize != 0)\n            addArg(\"--font-size=\" + conf.mFontSize);\n        if (conf.mEncoding != null && !conf.mEncoding.equals(\"\"))\n            addArg(\"--encoding=\" + conf.mEncoding);\n        addArg(\"-Oobject\");\n        init(mArgs);\n    }\n\n    public void loadConfigure(Configure conf) {\n        initArgs(conf);\n    }\n\n    private void addArg(String arg) {\n        mArgs += mDelim + arg;\n    }\n\n    public void addToken(int state, String string, String style) {\n        //System.out.println(\"addToken:\"+state+\" \"+string+\" \"+style );\n        Token token = new Token();\n        token.state = state;\n        token.string = string;\n        token.style = style;\n        tokenList.add(token);\n    }\n\n    public List<Token> getTokenList() {\n        return tokenList;\n    }\n\n    private native int init(String args);\n\n    public native String pase(String codeBlock);\n\n    public native String getTheme(String name);\n\n}\n"
  },
  {
    "path": "src/org/evilbinary/highliter/parsers/Token.java",
    "content": "package org.evilbinary.highliter.parsers;\n\n/**\n * 作者:evilbinary on 3/7/16.\n * 邮箱:rootdebug@163.com\n */\npublic class Token {\n    public String string;\n    public String style;\n    public int state;\n}\n"
  },
  {
    "path": "src/org/evilbinary/highliter/spans/ImageClickableSpan.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.highliter.spans;\n\nimport android.text.style.ClickableSpan;\nimport android.view.View;\n\npublic class ImageClickableSpan extends ClickableSpan {\n    private String imageUrl;\n\n    public void setImageUrl(String imageUrl) {\n        this.imageUrl = imageUrl;\n    }\n\n    @Override\n    public void onClick(View view) {\n\n    }\n}\n"
  },
  {
    "path": "src/org/evilbinary/highliter/spans/SafeURLSpan.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.highliter.spans;\n\nimport android.content.ActivityNotFoundException;\nimport android.text.style.URLSpan;\nimport android.view.View;\n\npublic class SafeURLSpan extends URLSpan {\n \n    public SafeURLSpan(String url) {\n        super(url);\n     }\n\n    @Override\n    public void onClick(View widget) {\n        try {\n            super.onClick(widget);\n        } catch (ActivityNotFoundException exc) {\n           \n        }\n    }\n}\n"
  },
  {
    "path": "src/org/evilbinary/highliter/spans/SpanStyle.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.highliter.spans;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.w3c.dom.css.CSSStyleDeclaration;\n\nimport android.graphics.Color;\nimport android.text.SpannableStringBuilder;\nimport android.text.style.CharacterStyle;\nimport android.text.style.ForegroundColorSpan;\n\npublic class SpanStyle {\n\tprivate List<CharacterStyle> styles;\n\tprivate String tag;\n\tprivate CSSStyleDeclaration cssStyle;\n\n\tpublic SpanStyle() {\n\t\tstyles = new ArrayList<CharacterStyle>();\n\t}\n\n\tpublic void applyStyle(SpannableStringBuilder text, int start, int end, int flags) {\n//\t\t System.out.println(\"styles size:\" + styles.size());\n\t\tfor (int i = 0; i < styles.size(); i++) {\n \t\t\ttext.setSpan(CharacterStyle.wrap(styles.get(i)), start, end, flags);\n// \t\t\ttext.setSpan(new ForegroundColorSpan(Color.GREEN), start, end, flags);\n\t\t}\n\t}\n\n\tpublic int getSize() {\n\t\treturn styles.size();\n\t}\n\n\tpublic void addStyle(CharacterStyle style) {\n\t\tstyles.add(style);\n\t}\n\n\tpublic void addStyle(CharacterStyle style, String tag, CSSStyleDeclaration cssStyle) {\n\t\tstyles.add(style);\n\t\tthis.tag = tag;\n\t\tthis.cssStyle = cssStyle;\n\t}\n\n\tpublic CSSStyleDeclaration getCssStyle() {\n\t\treturn this.cssStyle;\n\t}\n\n}\n"
  },
  {
    "path": "src/org/evilbinary/highliter/spans/VideoClickableSpan.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.highliter.spans;\nimport android.text.style.ClickableSpan;\nimport android.view.View;\n\n\npublic class VideoClickableSpan extends ClickableSpan {\n    private String videoUrl;\n\n    public void setVideoUrl(String videoUrl) {\n        this.videoUrl = videoUrl;\n    }\n\n    @Override\n    public void onClick(View widget) {\n\n    }\n}\n"
  },
  {
    "path": "src/org/evilbinary/highliter/spans/VideoSpan.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.highliter.spans;\n\nimport android.content.Context;\nimport android.graphics.Bitmap;\nimport android.graphics.drawable.Drawable;\nimport android.net.Uri;\nimport android.text.style.ImageSpan;\n\npublic class VideoSpan extends ImageSpan {\n    @Deprecated\n    public VideoSpan(Bitmap b) {\n        super(b);\n    }\n\n    @Deprecated\n    public VideoSpan(Bitmap b, int verticalAlignment) {\n        super(b, verticalAlignment);\n    }\n\n    public VideoSpan(Context context, Bitmap b) {\n        super(context, b);\n    }\n\n    public VideoSpan(Context context, Bitmap b, int verticalAlignment) {\n        super(context, b, verticalAlignment);\n    }\n\n    public VideoSpan(Drawable d) {\n        super(d);\n    }\n\n    public VideoSpan(Drawable d, int verticalAlignment) {\n        super(d, verticalAlignment);\n    }\n\n    public VideoSpan(Drawable d, String source) {\n        super(d, source);\n    }\n\n    public VideoSpan(Drawable d, String source, int verticalAlignment) {\n        super(d, source, verticalAlignment);\n    }\n\n    public VideoSpan(Context context, Uri uri) {\n        super(context, uri);\n    }\n\n    public VideoSpan(Context context, Uri uri, int verticalAlignment) {\n        super(context, uri, verticalAlignment);\n    }\n\n    public VideoSpan(Context context, int resourceId) {\n        super(context, resourceId);\n    }\n\n    public VideoSpan(Context context, int resourceId, int verticalAlignment) {\n        super(context, resourceId, verticalAlignment);\n    }\n}"
  },
  {
    "path": "src/org/evilbinary/managers/Configure.java",
    "content": "package org.evilbinary.managers;\n\nimport org.evilbinary.utils.DirUtil;\n\nimport android.content.Context;\nimport android.graphics.Color;\n\n\npublic class Configure {\n\tpublic Settings mSettings;\n\tpublic  String mLineSeparator ;\n\tpublic String mDataPath;\n\tpublic String mHighlightCss;\n\tpublic String mLanguage;\n\tpublic String mTheme;\n\tpublic String mEncoding;\n\tpublic int mFontSize;\n\tpublic String mFont;\n\tpublic String mPlugin;\n\tpublic int mLineNumberColor;\n\tpublic int mLineHighlightColor;\n\tpublic int mLineHighlightAlpha;\n\n\tpublic Configure(Context context){\n\t\tmSettings=new Settings();\n\t\tmLineSeparator= System.getProperty(\"line.separator\");\n\t\tmDataPath=DirUtil.getFilesDir(context);\n\t\tmHighlightCss=\"highlight.css\";\n\t\tmLanguage=\"c\";\n\t\tmTheme=\"molokai\";\n\t\tmFontSize=mSettings.TEXT_SIZE;\n\t\tmLineHighlightColor=Color.BLACK;\n\t\tmLineNumberColor=Color.GRAY;\n\t\tmLineHighlightAlpha=48;\n\t\t\n\t}\n}\n"
  },
  {
    "path": "src/org/evilbinary/managers/ConfigureManager.java",
    "content": "package org.evilbinary.managers;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.HashMap;\nimport java.util.zip.ZipException;\n\nimport org.evilbinary.highliter.R;\nimport org.evilbinary.utils.DirUtil;\nimport org.evilbinary.utils.Logger;\nimport org.evilbinary.utils.ZipUtil;\n\nimport android.content.Context;\nimport android.content.res.AssetManager;\nimport android.os.Handler;\nimport android.os.Looper;\nimport android.os.Message;\nimport android.widget.Toast;\n\npublic class ConfigureManager {\n\tprivate String mConfigDir;\n\tprivate Context mContext;\n\tprivate Handler mHandler;\n\t\n\t\n\tprivate HashMap<String,Configure> mConfigures;\n\t\n\tprivate final static int SHOW_TIPS = 1;\n\tprivate final static String CONF_DEFAULT=\"default\";\n\n\tpublic ConfigureManager(Context context) {\n\t\tmConfigures=new HashMap<String,Configure>();\n\t\tmContext = context;\n\t\tmConfigDir = DirUtil.getFilesDir(context);\n\t\tmHandler = new Handler() {\n\t\t\tpublic void handleMessage(Message msg) {\n\t\t\t\tswitch (msg.what) {\n\t\t\t\tcase SHOW_TIPS:\n\t\t\t\t\tshowTips(msg.obj.toString());\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tsuper.handleMessage(msg);\n\t\t\t}\n\t\t};\n\n\t}\n\t\n\tpublic Configure getDefaultConfigure(){\n\t\tConfigure conf=mConfigures.get(CONF_DEFAULT);\n\t\tif(conf==null){\n\t\t\tconf=new Configure(mContext);\n\t\t\tmConfigures.put(CONF_DEFAULT, conf);\n\t\t}\n\t\treturn conf;\n\t}\n\tpublic Configure createConfigure(String name){\n\t\tConfigure conf=new Configure(mContext);\n\t\tmConfigures.put(name, conf);\n\t\treturn conf;\n\t}\n\tpublic Configure getConfigure(String name){\n\t\tConfigure conf=mConfigures.get(name);\n\t\treturn conf;\n\t}\n\t\n\t\n\tpublic void exractDefaultConfigure() {\n\t\tnew Thread() {\n\t\t\tpublic void run() {\n\t\t\t\tLooper.prepare();\n\t\t\t\textractZipFile(\"langDefs\");\n\t\t\t\textractZipFile(\"themes\");\n\t\t\t\textractZipFile(\"plugins\");\n\t\t\t\tLooper.loop();\n\t\t\t}\n\t\t}.start();\n\t}\n\tpublic void exractAssertZipFile(String file) {\n\t\textractZipFile(file);\n\t}\n\tpublic String getConfigureDir(){\n\t\treturn mConfigDir;\n\t}\n\tpublic String setConfigureDir(){\n\t\treturn mConfigDir;\n\t}\n\t\n\t\n\t\n\n\tprivate String getString(int id) {\n\t\treturn mContext.getString(id);\n\t}\n\n\tprivate AssetManager getAssets() {\n\t\treturn mContext.getAssets();\n\t}\n\n\tprivate Context getApplicationContext() {\n\t\treturn mContext.getApplicationContext();\n\t}\n\n\tprivate void extractZipFile(String name) {\n\t\tString zipFileDir = mConfigDir + \"/\" + name;\n\t\tFile file = new File(zipFileDir);\n\t\tif (!file.exists()) {\n\t\t\ttry {\n\t\t\t\tString src = name + \".zip\";\n\t\t\t\tInputStream is = getAssets().open(src);\n\t\t\t\tsendTips(getString(R.string.extract) + \" \" + name);\n\t\t\t\textract(src, mConfigDir);\n\t\t\t\tsendTips(getString(R.string.extract_finish) + \" \" + name);\n\t\t\t} catch (Exception e) {\n\t\t\t\tLogger.e(e);\n\t\t\t}\n\t\t} else {\n\t\t\tLogger.i(\"Dir \" + zipFileDir + \" exist will not extract.\");\n\t\t}\n\t}\n\n\tprivate void extract(String src, String des) {\n\n\t\ttry {\n\t\t\tLogger.i(\"Begin extract \" + src + \" to \" + des + \".\");\n\t\t\tInputStream is = this.getAssets().open(src);\n\t\t\tZipUtil.upZipFile(is, des);\n\t\t\tLogger.i(\"Extract \" + src + \" to \" + des + \" finished.\");\n\n\t\t} catch (ZipException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tLogger.e(e);\n\t\t\tshowTips(R.string.extract_error, e.getMessage());\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\tLogger.e(e);\n\t\t\tshowTips(R.string.extract_error, e.getMessage());\n\t\t} catch (Exception e) {\n\t\t\tLogger.e(e);\n\t\t\tshowTips(R.string.extract_error, e.getMessage());\n\t\t} catch (Error e) {\n\t\t\tLogger.e(e);\n\t\t\tshowTips(R.string.extract_error, e.getMessage());\n\t\t} catch (Throwable e) {\n\t\t\tLogger.e(e);\n\t\t\tshowTips(R.string.extract_error, e.getMessage());\n\t\t}\n\t}\n\n\tprivate void showTips(String msg) {\n\t\tToast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();\n\t}\n\n\tprivate void showTips(int id, String msg) {\n\t\tToast.makeText(getApplicationContext(), getString(id) + \" \" + msg, Toast.LENGTH_SHORT).show();\n\t}\n\n\tprivate void sendTips(String content) {\n\t\tMessage msg = Message.obtain();\n\t\tmsg.obj = content;\n\t\tmsg.what = SHOW_TIPS;\n\t\tmHandler.sendMessage(msg);\n\t}\n\n}\n"
  },
  {
    "path": "src/org/evilbinary/managers/EmoticonsManager.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.managers;\nimport android.text.TextUtils;\n\n\nimport java.util.Map;\nimport java.util.TreeMap;\n\nimport org.evilbinary.highliter.R;\n\npublic class EmoticonsManager {\n    public static class EmoticonInfo {\n        public final int resId;\n        public final String resFileName;\n\n        private EmoticonInfo(int resId, String resFileName) {\n            this.resId = resId;\n            this.resFileName = resFileName;\n        }\n    }\n\n    private static final Map<String, EmoticonInfo> sEmoticons = new TreeMap<String, EmoticonInfo>();\n\n    static {\n        sEmoticons.put(\":amazed:\",\n                new EmoticonInfo(R.drawable.emo_amazed, \"emo_amazed.png\"));\n        sEmoticons.put(\":angel:\",\n                new EmoticonInfo(R.drawable.emo_angel, \"emo_angel.png\"));\n        sEmoticons.put(\":angry:\",\n                new EmoticonInfo(R.drawable.emo_angry, \"emo_angry.png\"));\n        sEmoticons.put(\":beaten:\",\n                new EmoticonInfo(R.drawable.emo_beaten, \"emo_beaten.png\"));\n        sEmoticons.put(\":bored:\",\n                new EmoticonInfo(R.drawable.emo_bored, \"emo_bored.png\"));\n        sEmoticons.put(\":clown:\",\n                new EmoticonInfo(R.drawable.emo_clown, \"emo_clown.png\"));\n        sEmoticons.put(\":confused:\",\n                new EmoticonInfo(R.drawable.emo_confused, \"emo_confused.png\"));\n        sEmoticons.put(\":cool:\",\n                new EmoticonInfo(R.drawable.emo_cool, \"emo_cool.png\"));\n        sEmoticons.put(\":cry:\",\n                new EmoticonInfo(R.drawable.emo_cry, \"emo_cry.png\"));\n        sEmoticons.put(\":devil:\",\n                new EmoticonInfo(R.drawable.emo_devil, \"emo_devil.png\"));\n        sEmoticons.put(\":doubtful:\",\n                new EmoticonInfo(R.drawable.emo_doubtful, \"emo_doubtful.png\"));\n        sEmoticons.put(\":emo:\",\n                new EmoticonInfo(R.drawable.emo_emo, \"emo_emo.png\"));\n        sEmoticons.put(\":frozen:\",\n                new EmoticonInfo(R.drawable.emo_frozen, \"emo_frozen.png\"));\n        sEmoticons.put(\":grin:\",\n                new EmoticonInfo(R.drawable.emo_grin, \"emo_grin.png\"));\n        sEmoticons.put(\":indian:\",\n                new EmoticonInfo(R.drawable.emo_indian, \"emo_indian.png\"));\n        sEmoticons.put(\":karate:\",\n                new EmoticonInfo(R.drawable.emo_karate, \"emo_karate.png\"));\n        sEmoticons.put(\":kiss:\",\n                new EmoticonInfo(R.drawable.emo_kiss, \"emo_kiss.png\"));\n        sEmoticons.put(\":laugh:\",\n                new EmoticonInfo(R.drawable.emo_laugh, \"emo_laugh.png\"));\n        sEmoticons.put(\":love:\",\n                new EmoticonInfo(R.drawable.emo_love, \"emo_love.png\"));\n        sEmoticons.put(\":millionaire:\",\n                new EmoticonInfo(R.drawable.emo_millionaire, \"emo_millionaire.png\"));\n        sEmoticons.put(\":nerd:\",\n                new EmoticonInfo(R.drawable.emo_nerd, \"emo_nerd.png\"));\n        sEmoticons.put(\":ninja:\",\n                new EmoticonInfo(R.drawable.emo_ninja, \"emo_ninja.png\"));\n        sEmoticons.put(\":party:\",\n                new EmoticonInfo(R.drawable.emo_party, \"emo_party.png\"));\n        sEmoticons.put(\":pirate:\",\n                new EmoticonInfo(R.drawable.emo_pirate, \"emo_pirate.png\"));\n        sEmoticons.put(\":punk:\",\n                new EmoticonInfo(R.drawable.emo_punk, \"emo_punk.png\"));\n        sEmoticons.put(\":sad:\",\n                new EmoticonInfo(R.drawable.emo_sad, \"emo_sad.png\"));\n        sEmoticons.put(\":santa:\",\n                new EmoticonInfo(R.drawable.emo_santa, \"emo_santa.png\"));\n        sEmoticons.put(\":shy:\",\n                new EmoticonInfo(R.drawable.emo_shy, \"emo_shy.png\"));\n        sEmoticons.put(\":sick:\",\n                new EmoticonInfo(R.drawable.emo_sick, \"emo_sick.png\"));\n        sEmoticons.put(\":smile:\",\n                new EmoticonInfo(R.drawable.emo_smile, \"emo_smile.png\"));\n        sEmoticons.put(\":speechless:\",\n                new EmoticonInfo(R.drawable.emo_speechless, \"emo_speechless.png\"));\n        sEmoticons.put(\":sweating:\",\n                new EmoticonInfo(R.drawable.emo_sweating, \"emo_sweating.png\"));\n        sEmoticons.put(\":tongue:\",\n                new EmoticonInfo(R.drawable.emo_tongue, \"emo_tongue.png\"));\n        sEmoticons.put(\":vampire:\",\n                new EmoticonInfo(R.drawable.emo_vampire, \"emo_vampire.png\"));\n        sEmoticons.put(\":wacky:\",\n                new EmoticonInfo(R.drawable.emo_wacky, \"emo_wacky.png\"));\n        sEmoticons.put(\":wink:\",\n                new EmoticonInfo(R.drawable.emo_wink, \"emo_wink.png\"));\n    }\n    EmoticonsManager() {\n    }\n\n    public EmoticonInfo getEmoticonInfo(String emoticonPath) {\n        if (TextUtils.isEmpty(emoticonPath) || emoticonPath.equals(\"false\")\n                || !sEmoticons.containsKey(emoticonPath)) {\n            return null;\n        }\n        return sEmoticons.get(emoticonPath);\n    }\n}\n"
  },
  {
    "path": "src/org/evilbinary/managers/Settings.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.managers;\n\nimport java.io.File;\n\nimport org.evilbinary.highliter.Constants;\n\nimport android.content.Context;\nimport android.content.SharedPreferences;\nimport android.content.SharedPreferences.Editor;\nimport android.graphics.Typeface;\n\npublic class Settings implements Constants {\n\n\t/** Number of recent files to remember */\n\tpublic int MAX_RECENT_FILES = 10;\n\n\t/** Show the lines numbers */\n\tpublic boolean SHOW_LINE_NUMBERS = true;\n\t\n\tpublic boolean SHOW_LINE_HIGHLIGHT = true;\n\n\t\n\t/** automatic break line to fit one page */\n\tpublic boolean WORDWRAP = false;\n\t/** color setting */\n\tpublic int COLOR = COLOR_CLASSIC;\n\n\t/** when search reaches the end of a file, search wrap */\n\tpublic boolean SEARCHWRAP = false;\n\t/** only search for matchin case */\n\tpublic boolean SEARCHMATCHCASE = false;\n\n\t/** Text size setting */\n\tpublic int TEXT_SIZE = 12;\n\n\t/** Default end of line */\n\tpublic int DEFAULT_END_OF_LINE = EOL_LINUX;\n\t/** End Of Line style */\n\tpublic int END_OF_LINE = EOL_LINUX;\n\t/** Encoding */\n\tpublic String ENCODING = ENC_UTF8;\n\n\t/** Let auto save on quit be triggered */\n\tpublic boolean FORCE_AUTO_SAVE = false;\n\tpublic boolean AUTO_SAVE_OVERWRITE = false;\n\n\t/** enable fling to scroll */\n\tpublic boolean FLING_TO_SCROLL = false;\n\n\t/** Use Undo instead of quit ? */\n\tpublic boolean UNDO = true;\n\t/** Undo stack capacity */\n\tpublic int UNDO_MAX_STACK = 25;\n\t/** Use back button as undo */\n\tpublic boolean BACK_BTN_AS_UNDO = false;\n\n\t/** Use a Home Page */\n\tpublic boolean USE_HOME_PAGE = false;\n\t/** Home Page Path */\n\tpublic String HOME_PAGE_PATH = \"\";\n\n\t/**\n\t * @return the end of line characters according to the current settings\n\t */\n\tpublic String getEndOfLine() {\n\t\tswitch (END_OF_LINE) {\n\t\tcase EOL_MAC: // Mac OS\n\t\t\treturn \"\\r\";\n\t\tcase EOL_WINDOWS: // Windows\n\t\t\treturn \"\\r\\n\";\n\t\tcase EOL_LINUX: // Linux / Android\n\t\tdefault:\n\t\t\treturn \"\\n\";\n\t\t}\n\t}\n\n\t/**\n\t * Update the settings from the given {@link SharedPreferences}\n\t * \n\t * @param settings\n\t *            the settings to read from\n\t */\n\tpublic void updateFromPreferences(SharedPreferences settings) {\n\n\t\tMAX_RECENT_FILES = getStringPreferenceAsInteger(settings, PREFERENCE_MAX_RECENTS, \"10\");\n\t\tSHOW_LINE_NUMBERS = settings.getBoolean(PREFERENCE_SHOW_LINE_NUMBERS, true);\n\t\tWORDWRAP = settings.getBoolean(PREFERENCE_WORDWRAP, false);\n\t\tTEXT_SIZE = getStringPreferenceAsInteger(settings, PREFERENCE_TEXT_SIZE, \"12\");\n\t\tDEFAULT_END_OF_LINE = getStringPreferenceAsInteger(settings, PREFERENCE_END_OF_LINES, (\"\" + EOL_LINUX));\n\t\tFORCE_AUTO_SAVE = settings.getBoolean(PREFERENCE_AUTO_SAVE, false);\n\t\tAUTO_SAVE_OVERWRITE = settings.getBoolean(PREFERENCE_AUTO_SAVE_OVERWRITE, false);\n\t\tCOLOR = getStringPreferenceAsInteger(settings, PREFERENCE_COLOR_THEME, (\"\" + COLOR_CLASSIC));\n\t\tSEARCHWRAP = settings.getBoolean(PREFERENCE_SEARCHWRAP, false);\n\t\tSEARCHMATCHCASE = settings.getBoolean(PREFERENCE_SEARCH_MATCH_CASE, false);\n\t\tENCODING = settings.getString(PREFERENCE_ENCODING, ENC_UTF8);\n\t\tFLING_TO_SCROLL = settings.getBoolean(PREFERENCE_FLING_TO_SCROLL, true);\n\n\t\tBACK_BTN_AS_UNDO = settings.getBoolean(PREFERENCE_BACK_BUTTON_AS_UNDO, false);\n\t\tUNDO = settings.getBoolean(PREFERENCE_ALLOW_UNDO, true);\n\t\tUNDO_MAX_STACK = getStringPreferenceAsInteger(settings, PREFERENCE_MAX_UNDO_STACK, \"25\");\n\n\t\tUSE_HOME_PAGE = settings.getBoolean(PREFERENCE_USE_HOME_PAGE, false);\n\t\tHOME_PAGE_PATH = settings.getString(PREFERENCE_HOME_PAGE_PATH, \"\");\n\n\t\t// RecentFiles.loadRecentFiles(settings.getString(PREFERENCE_RECENTS,\n\t\t// \"\"));\n\t}\n\n\t/**\n\t * Reads a preference stored as a string and returns the numeric value\n\t * \n\t * @param prefs\n\t *            the prefernce to read from\n\t * @param key\n\t *            the key\n\t * @param def\n\t *            the default value\n\t * @return the value as an int\n\t */\n\tprotected int getStringPreferenceAsInteger(SharedPreferences prefs, String key, String def) {\n\t\tString strVal;\n\t\tint intVal;\n\n\t\tstrVal = null;\n\t\ttry {\n\t\t\tstrVal = prefs.getString(key, def);\n\t\t} catch (Exception e) {\n\t\t\tstrVal = def;\n\t\t}\n\n\t\ttry {\n\t\t\tintVal = Integer.parseInt(strVal);\n\t\t} catch (NumberFormatException e) {\n\t\t\tintVal = 0;\n\t\t}\n\n\t\treturn intVal;\n\t}\n\n\t/**\n\t * Save the Home page settings\n\t * \n\t * @param settings\n\t *            the settings to write to\n\t */\n\tpublic void saveHomePage(SharedPreferences settings) {\n\t\tEditor editor = settings.edit();\n\t\teditor.putString(PREFERENCE_HOME_PAGE_PATH, HOME_PAGE_PATH);\n\t\teditor.commit();\n\n\t}\n\n\tpublic File getFontFile(Context ctx) {\n\t\treturn new File(ctx.getDir(FONT_FOLDER_NAME, Context.MODE_PRIVATE), FONT_FILE_NAME);\n\t}\n\n\tpublic Typeface getTypeface(Context ctx) {\n\t\tFile fontFile = getFontFile(ctx);\n\t\tTypeface res = Typeface.MONOSPACE;\n\t\tif (fontFile.exists() && fontFile.canRead()) {\n\t\t\tres = Typeface.createFromFile(getFontFile(ctx));\n\t\t}\n\t\treturn res;\n\t}\n}\n"
  },
  {
    "path": "src/org/evilbinary/utils/BlockFile.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.utils;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.RandomAccessFile;\nimport java.nio.MappedByteBuffer;\nimport java.nio.channels.FileChannel;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Iterator;\nimport java.util.List;\n\npublic class BlockFile<T> implements Iterable<List<T>> {\n\n\tprivate int BUFFER_SIZE = 1024;// 缓冲区大小为1k\n\tprivate long CHUNK_SIZE = 0x300000;\n\tprivate Iterator<File> files;\n\n\tprivate long chunkPos = 0;\n\tprivate MappedByteBuffer buffer;\n\tprivate FileChannel channel;\n\n\tpublic BlockFile(File... files) {\n\t\tthis(Arrays.asList(files));\n\t}\n\n\tpublic BlockFile(List<File> files) {\n\t\tthis.files = files.iterator();\n\t}\n\n\tpublic Iterator<List<T>> iterator() {\n\t\treturn new Iterator<List<T>>() {\n\t\t\tprivate List<T> entries;\n\t\t\tprivate long chunkPos = 0;\n\t\t\tprivate MappedByteBuffer buffer;\n\t\t\tprivate FileChannel channel;\n\n\t\t\t@Override\n\t\t\tpublic boolean hasNext() {\n\t\t\t\tif (buffer == null || !buffer.hasRemaining()) {\n\t\t\t\t\tbuffer = nextBuffer(chunkPos);\n\t\t\t\t\tif (buffer == null) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tT result = null;\n\t\t\t\twhile ((result =(T) buffer ) != null) {\n\t\t\t\t\tif (entries == null) {\n\t\t\t\t\t\tentries = new ArrayList<T>();\n\t\t\t\t\t}\n\t\t\t\t\tentries.add(result);\n\t\t\t\t}\n\t\t\t\t// set next MappedByteBuffer chunk\n\t\t\t\tchunkPos += buffer.position();\n\t\t\t\tbuffer = null;\n\t\t\t\tif (entries != null) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\t// Closeables.closeQuietly(channel);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate MappedByteBuffer nextBuffer(long position) {\n\t\t\t\ttry {\n\t\t\t\t\tif (channel == null || channel.size() == position) {\n\t\t\t\t\t\tif (channel != null) {\n\t\t\t\t\t\t\t// Closeables.closeQuietly(channel);\n\t\t\t\t\t\t\tchannel = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (files.hasNext()) {\n\t\t\t\t\t\t\tFile file = files.next();\n\t\t\t\t\t\t\tchannel = new RandomAccessFile(file, \"r\")\n\t\t\t\t\t\t\t\t\t.getChannel();\n\t\t\t\t\t\t\tchunkPos = 0;\n\t\t\t\t\t\t\tposition = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlong chunkSize = CHUNK_SIZE;\n\t\t\t\t\tif (channel.size() - position < chunkSize) {\n\t\t\t\t\t\tchunkSize = channel.size() - position;\n\t\t\t\t\t}\n\t\t\t\t\treturn channel.map(FileChannel.MapMode.READ_ONLY, chunkPos,\n\t\t\t\t\t\t\tchunkSize);\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t// Closeables.closeQuietly(channel);\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic List<T> next() {\n\t\t\t\tList<T> res = entries;\n\t\t\t\tentries = null;\n\t\t\t\treturn res;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void remove() {\n\t\t\t\tthrow new UnsupportedOperationException();\n\t\t\t}\n\t\t};\n\n\t}\n}\n"
  },
  {
    "path": "src/org/evilbinary/utils/DirUtil.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.utils;\n\nimport java.io.File;\n\nimport android.content.Context;\nimport android.os.Environment;\n\npublic class DirUtil {\n\t\n\tpublic static String filesDir;\n\tpublic static String systemDir;\n\t\n\tpublic static void getEnvironmentDirectories() {\n\t\tLogger.i(\"getRootDirectory(): \"\n\t\t\t\t+ Environment.getRootDirectory().toString());\n\t\tLogger.i(\"getDataDirectory(): \"\n\t\t\t\t+ Environment.getDataDirectory().toString());\n\t\tLogger.i(\"getDownloadCacheDirectory(): \"\n\t\t\t\t+ Environment.getDownloadCacheDirectory().toString());\n\t\tLogger.i(\"getExternalStorageDirectory(): \"\n\t\t\t\t+ Environment.getExternalStorageDirectory().toString());\n\n\t\tLogger.i(\"getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES): \"\n\t\t\t\t+ Environment.getExternalStoragePublicDirectory(\n\t\t\t\t\t\tEnvironment.DIRECTORY_PICTURES).toString());\n\t\t// Logger.i(\n\t\t// \"isExternalStorageEmulated(): \"\n\t\t// + Environment.isExternalStorageEmulated());\n\t\t//\n\t\t// Logger.i(\n\t\t// \"isExternalStorageRemovable(): \"\n\t\t// + Environment.isExternalStorageRemovable());\n\t}\n\n\tpublic static void getApplicationDirectories(Context context) {\n\t\t\n\t\tLogger.i(\"context.getFilesDir(): \" + context.getFilesDir().toString());\n\t\tLogger.i(\"context.getCacheDir(): \" + context.getCacheDir().toString());\n\n\t\t// methods below will return null if the permissions denied\n\t\tLogger.i(\n\n\t\t\"context.getExternalFilesDir(Environment.DIRECTORY_MOVIES): \"\n\t\t\t\t+ context.getExternalFilesDir(Environment.DIRECTORY_MOVIES));\n\n\t\tLogger.i(\"context.getExternalCacheDir(): \"\n\t\t\t\t+ context.getExternalCacheDir());\n\t}\n\tpublic static String getFilesDir(Context context){\n\t\treturn context.getFilesDir().toString();\n\t}\n\tpublic static String getDir(Context context){\n\t\treturn context.getFilesDir().getParent().toString();\n\t}\n\tpublic static String getCacheDir(Context context){\n\t\treturn context.getCacheDir().toString();\n\t}\n\tpublic static String getExternalFilesDir(Context context){\n\t\treturn context.getExternalFilesDir(Environment.DIRECTORY_MOVIES).toString();\n\t}\n\tpublic static String getExternalCacheDir(Context context){\n\t\treturn context.getExternalCacheDir().toString();\n\t}\n\tpublic static File getExternalStorageDirectory(){\n\t\treturn Environment.getExternalStorageDirectory();\n\t}\n\t\n\t \n\n}\n"
  },
  {
    "path": "src/org/evilbinary/utils/FileUtil.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\npackage org.evilbinary.utils;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.OutputStreamWriter;\nimport java.io.UnsupportedEncodingException;\nimport java.lang.reflect.Method;\nimport java.nio.charset.Charset;\nimport java.text.DecimalFormat;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\n\n\nimport android.content.Context;\nimport android.content.res.AssetManager;\nimport android.os.Environment;\n\n\n\npublic class FileUtil {\t\n\n\tstatic public boolean externalStorageMounted() {\n\t\tString state = Environment.getExternalStorageState();\n\t\treturn Environment.MEDIA_MOUNTED.equals(state)\n\t\t\t\t|| Environment.MEDIA_MOUNTED_READ_ONLY.equals(state);\n\t}\n\n\tpublic static int chmod(File path, int mode) throws Exception {\n\t\tClass<?> fileUtils = Class.forName(\"android.os.FileUtils\");\n\t\tMethod setPermissions = fileUtils.getMethod(\"setPermissions\",\n\t\t\t\tString.class, int.class, int.class, int.class);\n\t\treturn (Integer) setPermissions.invoke(null, path.getAbsolutePath(),\n\t\t\t\tmode, -1, -1);\n\t}\n\n\tpublic static boolean recursiveChmod(File root, int mode) throws Exception {\n\t\tboolean success = chmod(root, mode) == 0;\n\t\tfor (File path : root.listFiles()) {\n\t\t\tif (path.isDirectory()) {\n\t\t\t\tsuccess = recursiveChmod(path, mode);\n\t\t\t}\n\t\t\tsuccess &= (chmod(path, mode) == 0);\n\t\t}\n\t\treturn success;\n\t}\n\n\tpublic static boolean delete(File path) {\n\t\tboolean result = true;\n\t\tif (path.exists()) {\n\t\t\tif (path.isDirectory()) {\n\t\t\t\tfor (File child : path.listFiles()) {\n\t\t\t\t\tresult &= delete(child);\n\t\t\t\t}\n\t\t\t\tresult &= path.delete(); // Delete empty directory.\n\t\t\t}\n\t\t\tif (path.isFile()) {\n\t\t\t\tresult &= path.delete();\n\t\t\t}\n\t\t\tif (!result) {\n\t\t\t\tLogger.e(\"Delete failed;\");\n\t\t\t}\n\t\t\treturn result;\n\t\t} else {\n\t\t\tLogger.e(\"File does not exist.\");\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic static File copyFromStream(String name, InputStream input) {\n\t\tif (name == null || name.length() == 0) {\n\t\t\tLogger.e(\"No script name specified.\");\n\t\t\treturn null;\n\t\t}\n\t\tFile file = new File(name);\n\t\tif (!makeDirectories(file.getParentFile(), 0755)) {\n\t\t\treturn null;\n\t\t}\n\t\ttry {\n\t\t\tOutputStream output = new FileOutputStream(file);\n\t\t\tIoUtils.copy(input, output);\n\t\t} catch (Exception e) {\n\t\t\tLogger.e(e);\n\t\t\treturn null;\n\t\t}\n\t\treturn file;\n\t}\n\n\tpublic static boolean makeDirectories(File directory, int mode) {\n\t\tFile parent = directory;\n\t\twhile (parent.getParentFile() != null && !parent.exists()) {\n\t\t\tparent = parent.getParentFile();\n\t\t}\n\t\tif (!directory.exists()) {\n\t\t\tLogger.v(\"Creating directory: \" + directory.getName());\n\t\t\tif (!directory.mkdirs()) {\n\t\t\t\tLogger.e(\"Failed to create directory.\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\ttry {\n\t\t\trecursiveChmod(parent, mode);\n\t\t} catch (Exception e) {\n\t\t\tLogger.e(e);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic static File getExternalDownload() {\n\t\ttry {\n\t\t\tClass<?> c = Class.forName(\"android.os.Environment\");\n\t\t\tMethod m = c.getDeclaredMethod(\"getExternalStoragePublicDirectory\",\n\t\t\t\t\tString.class);\n\t\t\tString download = c.getDeclaredField(\"DIRECTORY_DOWNLOADS\")\n\t\t\t\t\t.get(null).toString();\n\t\t\treturn (File) m.invoke(null, download);\n\t\t} catch (Exception e) {\n\t\t\treturn new File(Environment.getExternalStorageDirectory(),\n\t\t\t\t\t\"Download\");\n\t\t}\n\t}\n\n\tpublic static boolean rename(File file, String name) {\n\t\treturn file.renameTo(new File(file.getParent(), name));\n\t}\n\n\tpublic static String readToString(File file) throws IOException {\n\t\tif (file == null || !file.exists()) {\n\t\t\treturn null;\n\t\t}\n\t\tFileReader reader = new FileReader(file);\n\t\tStringBuilder out = new StringBuilder();\n\t\tchar[] buffer = new char[1024 * 4];\n\t\tint numRead = 0;\n\t\twhile ((numRead = reader.read(buffer)) > -1) {\n\t\t\tout.append(String.valueOf(buffer, 0, numRead));\n\t\t}\n\t\treader.close();\n\t\treturn out.toString();\n\t}\n\n\tpublic static String readFromAssetsFile(Context context, String name)\n\t\t\tthrows IOException {\n\t\tAssetManager am = context.getAssets();\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(\n\t\t\t\tam.open(name)));\n\t\tString line;\n\t\tString sp = System.getProperty(\"line.separator\");\n\t\tStringBuilder builder = new StringBuilder();\n\t\twhile ((line = reader.readLine()) != null) {\n\t\t\tbuilder.append(line).append(sp);\n\t\t}\n\t\treader.close();\n\t\treturn builder.toString();\n\t}\n\n\tpublic static String ReadFile(InputStream fis, String encoding) {\n\t\tBufferedReader br;\n\t\tStringBuilder b = new StringBuilder();\n\t\tString line;\n\t\tString sp = System.getProperty(\"line.separator\");\n\n\t\ttry {\n\t\t\tbr = new BufferedReader(new InputStreamReader(fis, encoding));\n\t\t\ttry {\n\t\t\t\twhile ((line = br.readLine()) != null) {\n\t\t\t\t\tb.append(line).append(sp);\n\t\t\t\t}\n\t\t\t\tbr.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t} catch (UnsupportedEncodingException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\treturn b.toString();\n\t}\n\n\tpublic static String ReadFile(File filename, String encoding) {\n\t\ttry {\n\t\t\tFileInputStream fis = new FileInputStream(filename);\n\t\t\treturn ReadFile(fis, encoding);\n\t\t} catch (FileNotFoundException e) {\n\t\t\treturn \"\";\n\t\t}\n\t}\n\tpublic static String ReadFile(String filename) {\n\t\treturn ReadFile(filename,\"UTF-8\");\n\t}\n\n\tpublic static String ReadFile(String fileName, String encoding) {\n\t\tFile file = new File(fileName);\n\t\treturn ReadFile(file, encoding);\n\t}\n\n\tpublic static String getExt(String path) {\n//\t\tSystem.out.println(\"getext:\"+path);\n\t\tint lastIndex = path.lastIndexOf(\".\");\n\t\tif (lastIndex == -1)\n\t\t\treturn null;\n//\t\tSystem.out.println(\"getext end:\"+path.substring(lastIndex + 1).trim().toLowerCase());\n\n\t\treturn path.substring(lastIndex + 1).trim().toLowerCase();\n\t\t\n\t}\n\n\tpublic static String getEncoding(String path) {\n\t\tString encoding = \"\";\n\t\t// encoding= CharsetDetector.getEncoding(path).trim().toUpperCase();\n\t\tif (encoding == null || \"\".equals(encoding)) {\n\t\t\tencoding = \"UTF-8\";\n\t\t} else if (\"GB18030\".equals(encoding)) {\n\t\t\tencoding = \"GBK\";\n\t\t}\n\t\treturn encoding;\n\t}\n\t\n\t\n\t\n\t\n\t\n\n}\n"
  },
  {
    "path": "src/org/evilbinary/utils/IoUtils.java",
    "content": "/*\n * Copyright (C) 2010 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\npackage org.evilbinary.utils;\n\nimport java.io.BufferedInputStream;\nimport java.io.BufferedOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\n\npublic class IoUtils {\n  private static final int BUFFER_SIZE = 1024 * 8;\n\n  private IoUtils() {\n    // Utility class.\n  }\n\n  public static int copy(InputStream input, OutputStream output) throws Exception, IOException {\n    byte[] buffer = new byte[BUFFER_SIZE];\n\n    BufferedInputStream in = new BufferedInputStream(input, BUFFER_SIZE);\n    BufferedOutputStream out = new BufferedOutputStream(output, BUFFER_SIZE);\n    int count = 0, n = 0;\n    try {\n      while ((n = in.read(buffer, 0, BUFFER_SIZE)) != -1) {\n        out.write(buffer, 0, n);\n        count += n;\n      }\n      out.flush();\n    } finally {\n      try {\n        out.close();\n      } catch (IOException e) {\n        Logger.e(e);\n      }\n      try {\n        in.close();\n      } catch (IOException e) {\n    \t  Logger.e( e);\n      }\n    }\n    return count;\n  }\n\n}\n"
  },
  {
    "path": "src/org/evilbinary/utils/Logger.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.utils;\n\nimport java.io.PrintWriter;\nimport java.io.StringWriter;\n\nimport android.util.*;\n\npublic class Logger   {\n\tpublic static String LOG_TAG=\"Highlight\";\n\t\n\tpublic static void v(String info){\n\t\tLog.v(LOG_TAG,info);\n\t }\n\t public static void i(String info){\n\t\tLog.i(LOG_TAG,info);\n\t }\n\t public static void d(String debug){\n\t\t\tLog.d(LOG_TAG,debug);\n\t }\n\t\n\t public static void w(String warn){\n\t\t Log.w(LOG_TAG, warn);\n\t }\n\t public static void e(String error){\n\t\t Log.e(LOG_TAG, error);\n\t }\n\t public static void v(String tag,String info){\n\t\t Log.v(tag,info);\n\t }\n\t public static void i(String tag,String info){\n\t\t\tLog.i(tag,info);\n\t\t }\n\t public static void d(String tag,String debug){\n\t\t\tLog.d(tag,debug);\n\t }\n\t public static void w(String tag,String warn){\n\t\t Log.w(tag, warn);\n\t }\n\t public static void e(String tag,String error){\n\t\t Log.e(tag, error);\n\t }\n\t \n\t public static void e(Throwable ex){\n\t\tStringWriter sw = new StringWriter();\n\t\tPrintWriter pw = new PrintWriter(sw);\n\t\tex.printStackTrace(pw);\n\t\tpw.flush();   \n        sw.flush();   \n\t\tLog.e(LOG_TAG, sw.toString());\n\t }\n\t\n}\n"
  },
  {
    "path": "src/org/evilbinary/utils/PxAndDp.java",
    "content": "package org.evilbinary.utils;\n\nimport android.content.Context;\n\npublic class PxAndDp {\n\t/** \n     * 根据手机的分辨率从 dp 的单位 转成为 px(像素) \n     */  \n    public static int dip2px(Context context, float dpValue) {  \n        final float scale = context.getResources().getDisplayMetrics().density;  \n        return (int) (dpValue * scale + 0.5f);  \n    }  \n  \n    /** \n     * 根据手机的分辨率从 px(像素) 的单位 转成为 dp \n     */  \n    public static int px2dip(Context context, float pxValue) {  \n        final float scale = context.getResources().getDisplayMetrics().density;  \n        return (int) (pxValue / scale + 0.5f);  \n    }  \n}\n"
  },
  {
    "path": "src/org/evilbinary/utils/RichTextUtils.java",
    "content": "/*\n * Copyright (C) 2014 ChatWing\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.evilbinary.utils;\n\nimport android.text.Spannable;\nimport android.text.SpannableString;\nimport android.text.Spanned;\nimport android.text.style.CharacterStyle;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\npublic class RichTextUtils {\n    public static <A extends CharacterStyle, B extends CharacterStyle> Spannable replaceAll(Spanned original,\n                                                                                            Class<A> sourceType,\n                                                                                            SpanConverter<A, B> converter) {\n        SpannableString result = new SpannableString(original);\n        A[] spans = result.getSpans(0, result.length(), sourceType);\n\n        for (A span : spans) {\n            int start = result.getSpanStart(span);\n            int end = result.getSpanEnd(span);\n            int flags = result.getSpanFlags(span);\n\n            result.removeSpan(span);\n            result.setSpan(converter.convert(span), start, end, flags);\n        }\n\n        return (result);\n    }\n\n    public static boolean isUrl(String imageUrl) {\n        try {\n            new URL(imageUrl);\n            return true;\n        } catch (MalformedURLException e) {\n            e.printStackTrace();\n        }\n        return false;\n    }\n\n    public interface SpanConverter<A extends CharacterStyle, B extends CharacterStyle> {\n        B convert(A span);\n    }\n\n    public static String autoInsertBBCode(String message) {\n        // Separate input by spaces ( URLs don't have spaces )\n        String[] parts = message.split(\"\\\\s\");\n        StringBuilder builder = new StringBuilder();\n        // Attempt to convert each item into an URL.\n        for (String item : parts) {\n            try {\n                URL url = new URL(item);\n                // If possible then replace with anchor...\n                builder.append(\"[url]\" + url + \"[/url] \");\n            } catch (MalformedURLException e) {\n                // If there was an URL that was not it!...\n                builder.append(item + \" \");\n            } catch (StringIndexOutOfBoundsException e) {\n                //Fix weird bug on android 2.3 and possibly honeycomb\n                //https://code.google.com/p/android/issues/detail?id=15960\n                builder.append(item + \" \");\n            }\n        }\n        return builder.toString().trim();\n    }\n}"
  },
  {
    "path": "src/org/evilbinary/utils/ZipUtil.java",
    "content": "/* Copyright (C) 2015 evilbinary.\n * rootdebug@163.com\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\npackage org.evilbinary.utils;\n\nimport java.io.*;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Enumeration;\nimport java.util.zip.ZipEntry;\nimport java.util.zip.ZipException;\nimport java.util.zip.ZipFile;\nimport java.util.zip.ZipInputStream;\nimport java.util.zip.ZipOutputStream;\n\npublic class ZipUtil {\n\tprivate static final int BUFF_SIZE = 1024 * 1024; // 1M Byte\n\n\t/**\n\t * 批量压缩文件（夹）\n\t * \n\t * @param resFileList\n\t *            要压缩的文件（夹）列表\n\t * @param zipFile\n\t *            生成的压缩文件\n\t * @throws IOException\n\t *             当压缩过程出错时抛出\n\t */\n\tpublic static void zipFiles(Collection<File> resFileList, File zipFile) throws IOException {\n\t\tZipOutputStream zipout = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile), BUFF_SIZE));\n\t\tfor (File resFile : resFileList) {\n\t\t\tzipFile(resFile, zipout, \"\");\n\t\t}\n\t\tzipout.close();\n\t}\n\n\t/**\n\t * 批量压缩文件（夹）\n\t * \n\t * @param resFileList\n\t *            要压缩的文件（夹）列表\n\t * @param zipFile\n\t *            生成的压缩文件\n\t * @param comment\n\t *            压缩文件的注释\n\t * @throws IOException\n\t *             当压缩过程出错时抛出\n\t */\n\tpublic static void zipFiles(Collection<File> resFileList, File zipFile, String comment) throws IOException {\n\t\tZipOutputStream zipout = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile), BUFF_SIZE));\n\t\tfor (File resFile : resFileList) {\n\t\t\tzipFile(resFile, zipout, \"\");\n\t\t}\n\t\tzipout.setComment(comment);\n\t\tzipout.close();\n\t}\n\n\t/**\n\t * 解压缩一个文件\n\t * \n\t * @param zipFile\n\t *            压缩文件\n\t * @param folderPath\n\t *            解压缩的目标目录\n\t * @throws IOException\n\t *             当解压缩过程出错时抛出\n\t */\n\tpublic static void upZipFile(File zipFile, String folderPath) throws ZipException, IOException {\n\t\tFile desDir = new File(folderPath);\n\t\tif (!desDir.exists()) {\n\t\t\tdesDir.mkdirs();\n\t\t}\n\t\tZipFile zf = new ZipFile(zipFile);\n\t\tfor (Enumeration<?> entries = zf.entries(); entries.hasMoreElements();) {\n\t\t\tZipEntry entry = ((ZipEntry) entries.nextElement());\n\t\t\tInputStream in = zf.getInputStream(entry);\n\t\t\tString str = folderPath + File.separator + entry.getName();\n\t\t\tstr = new String(str.getBytes(\"8859_1\"), \"GB2312\");\n\t\t\tFile desFile = new File(str);\n\t\t\tif (!desFile.exists()) {\n\t\t\t\tFile fileParentDir = desFile.getParentFile();\n\t\t\t\tif (!fileParentDir.exists()) {\n\t\t\t\t\tfileParentDir.mkdirs();\n\t\t\t\t}\n\t\t\t\tdesFile.createNewFile();\n\t\t\t}\n\t\t\tOutputStream out = new FileOutputStream(desFile);\n\t\t\tbyte buffer[] = new byte[BUFF_SIZE];\n\t\t\tint realLength;\n\t\t\twhile ((realLength = in.read(buffer)) > 0) {\n\t\t\t\tout.write(buffer, 0, realLength);\n\t\t\t}\n\t\t\tin.close();\n\t\t\tout.close();\n\t\t}\n\t}\n\n\tpublic static void upZipFile(InputStream is, String dir) throws IOException {\n\t\tFile desDir = new File(dir);\n\t\tif (!desDir.exists()) {\n\t\t\tdesDir.mkdirs();\n\t\t}\n\t\tFile dest = desDir;\n\t\tif (!dest.isDirectory())\n\t\t\tthrow new IOException(\"Invalid Unzip destination \" + dest);\n\n\t\tif (null == is) {\n\t\t\tthrow new IOException(\"InputStream is null\");\n\t\t}\n\t\tZipInputStream zip = new ZipInputStream(is);\n\n\t\tZipEntry ze;\n\t\twhile ((ze = zip.getNextEntry()) != null) {\n\t\t\tfinal String path = dest.getAbsolutePath() + File.separator + ze.getName();\n\n\t\t\t// Create any entry folders\n\t\t\tString zeName = ze.getName();\n\t\t\tchar cTail = zeName.charAt(zeName.length() - 1);\n\t\t\tif (cTail == File.separatorChar) {\n\t\t\t\tFile file = new File(path);\n\t\t\t\tif (!file.exists()) {\n\t\t\t\t\tif (!file.mkdirs()) {\n\t\t\t\t\t\tthrow new IOException(\"Unable to create folder \" + file);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tFileOutputStream fout = new FileOutputStream(path);\n\t\t\tbyte[] bytes = new byte[1024];\n\t\t\tint c;\n\t\t\twhile ((c = zip.read(bytes)) != -1) {\n\t\t\t\tfout.write(bytes, 0, c);\n\t\t\t}\n\n\t\t\tzip.closeEntry();\n\t\t\tfout.close();\n\t\t}\n\n\t}\n\n\t/**\n\t * 解压文件名包含传入文字的文件\n\t * \n\t * @param zipFile\n\t *            压缩文件\n\t * @param folderPath\n\t *            目标文件夹\n\t * @param nameContains\n\t *            传入的文件匹配名\n\t * @throws ZipException\n\t *             压缩格式有误时抛出\n\t * @throws IOException\n\t *             IO错误时抛出\n\t */\n\tpublic static ArrayList<File> upZipSelectedFile(File zipFile, String folderPath, String nameContains)\n\t\t\tthrows ZipException, IOException {\n\t\tArrayList<File> fileList = new ArrayList<File>();\n\n\t\tFile desDir = new File(folderPath);\n\t\tif (!desDir.exists()) {\n\t\t\tdesDir.mkdir();\n\t\t}\n\n\t\tZipFile zf = new ZipFile(zipFile);\n\t\tfor (Enumeration<?> entries = zf.entries(); entries.hasMoreElements();) {\n\t\t\tZipEntry entry = ((ZipEntry) entries.nextElement());\n\t\t\tif (entry.getName().contains(nameContains)) {\n\t\t\t\tInputStream in = zf.getInputStream(entry);\n\t\t\t\tString str = folderPath + File.separator + entry.getName();\n\t\t\t\tstr = new String(str.getBytes(\"8859_1\"), \"GB2312\");\n\t\t\t\t// str.getBytes(\"GB2312\"),\"8859_1\" 输出\n\t\t\t\t// str.getBytes(\"8859_1\"),\"GB2312\" 输入\n\t\t\t\tFile desFile = new File(str);\n\t\t\t\tif (!desFile.exists()) {\n\t\t\t\t\tFile fileParentDir = desFile.getParentFile();\n\t\t\t\t\tif (!fileParentDir.exists()) {\n\t\t\t\t\t\tfileParentDir.mkdirs();\n\t\t\t\t\t}\n\t\t\t\t\tdesFile.createNewFile();\n\t\t\t\t}\n\t\t\t\tOutputStream out = new FileOutputStream(desFile);\n\t\t\t\tbyte buffer[] = new byte[BUFF_SIZE];\n\t\t\t\tint realLength;\n\t\t\t\twhile ((realLength = in.read(buffer)) > 0) {\n\t\t\t\t\tout.write(buffer, 0, realLength);\n\t\t\t\t}\n\t\t\t\tin.close();\n\t\t\t\tout.close();\n\t\t\t\tfileList.add(desFile);\n\t\t\t}\n\t\t}\n\t\treturn fileList;\n\t}\n\n\t/**\n\t * 获得压缩文件内文件列表\n\t * \n\t * @param zipFile\n\t *            压缩文件\n\t * @return 压缩文件内文件名称\n\t * @throws ZipException\n\t *             压缩文件格式有误时抛出\n\t * @throws IOException\n\t *             当解压缩过程出错时抛出\n\t */\n\tpublic static ArrayList<String> getEntriesNames(File zipFile) throws ZipException, IOException {\n\t\tArrayList<String> entryNames = new ArrayList<String>();\n\t\tEnumeration<?> entries = getEntriesEnumeration(zipFile);\n\t\twhile (entries.hasMoreElements()) {\n\t\t\tZipEntry entry = ((ZipEntry) entries.nextElement());\n\t\t\tentryNames.add(new String(getEntryName(entry).getBytes(\"GB2312\"), \"8859_1\"));\n\t\t}\n\t\treturn entryNames;\n\t}\n\n\t/**\n\t * 获得压缩文件内压缩文件对象以取得其属性\n\t * \n\t * @param zipFile\n\t *            压缩文件\n\t * @return 返回一个压缩文件列表\n\t * @throws ZipException\n\t *             压缩文件格式有误时抛出\n\t * @throws IOException\n\t *             IO操作有误时抛出\n\t */\n\tpublic static Enumeration<?> getEntriesEnumeration(File zipFile) throws ZipException, IOException {\n\t\tZipFile zf = new ZipFile(zipFile);\n\t\treturn zf.entries();\n\n\t}\n\n\t/**\n\t * 取得压缩文件对象的注释\n\t * \n\t * @param entry\n\t *            压缩文件对象\n\t * @return 压缩文件对象的注释\n\t * @throws UnsupportedEncodingException\n\t */\n\tpublic static String getEntryComment(ZipEntry entry) throws UnsupportedEncodingException {\n\t\treturn new String(entry.getComment().getBytes(\"GB2312\"), \"8859_1\");\n\t}\n\n\t/**\n\t * 取得压缩文件对象的名称\n\t * \n\t * @param entry\n\t *            压缩文件对象\n\t * @return 压缩文件对象的名称\n\t * @throws UnsupportedEncodingException\n\t */\n\tpublic static String getEntryName(ZipEntry entry) throws UnsupportedEncodingException {\n\t\treturn new String(entry.getName().getBytes(\"GB2312\"), \"8859_1\");\n\t}\n\n\t/**\n\t * 压缩文件\n\t * \n\t * @param resFile\n\t *            需要压缩的文件（夹）\n\t * @param zipout\n\t *            压缩的目的文件\n\t * @param rootpath\n\t *            压缩的文件路径\n\t * @throws FileNotFoundException\n\t *             找不到文件时抛出\n\t * @throws IOException\n\t *             当压缩过程出错时抛出\n\t */\n\tprivate static void zipFile(File resFile, ZipOutputStream zipout, String rootpath) throws FileNotFoundException,\n\t\t\tIOException {\n\t\trootpath = rootpath + (rootpath.trim().length() == 0 ? \"\" : File.separator) + resFile.getName();\n\t\trootpath = new String(rootpath.getBytes(\"8859_1\"), \"GB2312\");\n\t\tif (resFile.isDirectory()) {\n\t\t\tFile[] fileList = resFile.listFiles();\n\t\t\tfor (File file : fileList) {\n\t\t\t\tzipFile(file, zipout, rootpath);\n\t\t\t}\n\t\t} else {\n\t\t\tbyte buffer[] = new byte[BUFF_SIZE];\n\t\t\tBufferedInputStream in = new BufferedInputStream(new FileInputStream(resFile), BUFF_SIZE);\n\t\t\tzipout.putNextEntry(new ZipEntry(rootpath));\n\t\t\tint realLength;\n\t\t\twhile ((realLength = in.read(buffer)) != -1) {\n\t\t\t\tzipout.write(buffer, 0, realLength);\n\t\t\t}\n\t\t\tin.close();\n\t\t\tzipout.flush();\n\t\t\tzipout.closeEntry();\n\t\t}\n\t}\n}\n"
  }
]