            [org.eclipse.cdt.internal.core.dom.parser.cpp CPPASTTranslationUnit]
            [org.eclipse.cdt.internal.core.dom.rewrite.astwriter ASTWriter]))
 
-
-;(def filename "/Users/dgopstein/nyu/confusion/atoms/simplifications/2000-natori/nonconfusing.c")
-;(def filename "/Users/dgopstein/nyu/confusion/atom-finder/src/atom_finder/macro-in-expression.c")
-
-;(def root (translation-unit (resource-path "if-starts-in-expression.c")))
 
 (defn find-atoms-in-file
   "Find every example of each of the given atoms in the given file"

  "Find all preprocessor directives not at the top level in directory"
  [dirname]
(time
 ; (prn (count (for [filename (map #(.getPath %) (c-files "/Users/dgopstein/opt/src/mono"))]
 (prn (count (pmap

              (fn [file]

              (c-files dirname)
              )))))


(def ^:private running-jar
    "Resolves the path to the current running jar file."
  (-> :keyword class (.. getProtectionDomain getCodeSource getLocation getPath)))

(defn list-resources [path]
  (let [jar (java.util.jar.JarFile. path)
        entries (.entries jar)]
    (loop [result  []]
      (if (.hasMoreElements entries)
        (recur (conj result (.. entries nextElement getName)))
                result))))

(defn -main
  [& args]

  ;(def root (translation-unit (resource-path "if-starts-in-expression.c")))

  ;; the place where all test-files live
  (def resource-dir (.getParent (java.io.File. (resource-path "define-in-if-loop.c"))))

  (defn PRINTLN [s]
    (println
     "\n==============================================================="
     s
     "\n==============================================================="))

  (PRINTLN "\nCount how many \"Preprocessor in Statement\" atoms are in the resource directory files")
  (preprocessor-in-dir resource-dir)

  (PRINTLN "\nPrint the AST of the file containing the atom")
  (print-tree (translation-unit (resource-path "macro-in-expression.c")))

  (PRINTLN "\nPrint the line of the atom in the file")
  (println (atom-finder.find-atom/preprocessors-in-contexts define-only expression-classifier (tu (resource-path "macro-in-expression.c"))))

  (System/exit 0)
  )
