Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
pprint: Move gen-class expressions to separate file; refs #65
Browse files Browse the repository at this point in the history
To avoid order-of-compilation issues,
this patch puts the gen-class expressions
for ColumnWriter and PrettyWriter in a
separate file, rather than in the ns
declarations.
  • Loading branch information
Stuart Sierra committed Jan 31, 2010
1 parent a0f80d1 commit 3275810
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 27 deletions.
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -76,6 +76,7 @@
<namespace>clojure\.contrib\.fnmap\.PersistentFnMap</namespace>
<namespace>clojure\.contrib\.conditition\.Condition</namespace>
<namespace>clojure\.contrib\.repl-ln</namespace>
<namespace>clojure\.contrib\.pprint\.gen-class</namespace>
</namespaces>
</configuration>
<executions>
Expand Down
13 changes: 1 addition & 12 deletions src/main/clojure/clojure/contrib/pprint/ColumnWriter.clj
Expand Up @@ -13,18 +13,7 @@

;; This module implements a column-aware wrapper around an instance of java.io.Writer

(ns clojure.contrib.pprint.ColumnWriter
(:gen-class
:extends java.io.Writer
:init init
:constructors {[java.io.Writer Integer] [],
[java.io.Writer] []}
:methods [[getColumn [] Integer]
[getLine [] Integer]
[getMaxColumn [] Integer]
[setMaxColumn [Integer] Void]
[getWriter [] java.io.Writer]]
:state state))
(ns clojure.contrib.pprint.ColumnWriter)

(def *default-page-width* 72)

Expand Down
16 changes: 1 addition & 15 deletions src/main/clojure/clojure/contrib/pprint/PrettyWriter.clj
Expand Up @@ -16,21 +16,7 @@

(ns clojure.contrib.pprint.PrettyWriter
(:refer-clojure :exclude (deftype))
(:require clojure.contrib.pprint.ColumnWriter)
(:use clojure.contrib.pprint.utilities)
(:gen-class
:extends clojure.contrib.pprint.ColumnWriter
:init init
:constructors {[java.io.Writer Integer Object] [java.io.Writer Integer]}
:methods [[startBlock [String String String] void]
[endBlock [] void]
[newline [clojure.lang.Keyword] void]
[indent [clojure.lang.Keyword Integer] void]
[getMiserWidth [] Object]
[setMiserWidth [Object] void]
[setLogicalBlockCallback [clojure.lang.IFn] void]]
:exposes-methods {write col_write}
:state pwstate))
(:use clojure.contrib.pprint.utilities))

;; TODO: Support for tab directives

Expand Down
31 changes: 31 additions & 0 deletions src/main/clojure/clojure/contrib/pprint/gen_class.clj
@@ -0,0 +1,31 @@
;;; gen_class.clj: generate statically-named classes for pprint

(ns clojure.contrib.pprint.gen-class)

(gen-class :name clojure.contrib.pprint.ColumnWriter
:impl-ns clojure.contrib.pprint.ColumnWriter
:extends java.io.Writer
:init init
:constructors {[java.io.Writer Integer] [],
[java.io.Writer] []}
:methods [[getColumn [] Integer]
[getLine [] Integer]
[getMaxColumn [] Integer]
[setMaxColumn [Integer] Void]
[getWriter [] java.io.Writer]]
:state state)

(gen-class :name clojure.contrib.pprint.PrettyWriter
:impl-ns clojure.contrib.pprint.ColumnWriter
:extends clojure.contrib.pprint.ColumnWriter
:init init
:constructors {[java.io.Writer Integer Object] [java.io.Writer Integer]}
:methods [[startBlock [String String String] void]
[endBlock [] void]
[newline [clojure.lang.Keyword] void]
[indent [clojure.lang.Keyword Integer] void]
[getMiserWidth [] Object]
[setMiserWidth [Object] void]
[setLogicalBlockCallback [clojure.lang.IFn] void]]
:exposes-methods {write col_write}
:state pwstate)

0 comments on commit 3275810

Please sign in to comment.