aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorStuart Sierra <mail@stuartsierra.com>2010-01-30 19:43:34 -0500
committerStuart Sierra <mail@stuartsierra.com>2010-01-30 19:43:34 -0500
commit3275810556b075ff9a3a0abc0d08b3a19ee46bae (patch)
tree51aeb124027efa7637d7a782ebc0ea04bd6627ce /src/main
parenta0f80d127b31b45ad0148ffc2b540c23cc15024f (diff)
pprint: Move gen-class expressions to separate file; refs #65
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.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/clojure/clojure/contrib/pprint/ColumnWriter.clj13
-rw-r--r--src/main/clojure/clojure/contrib/pprint/PrettyWriter.clj16
-rw-r--r--src/main/clojure/clojure/contrib/pprint/gen_class.clj31
3 files changed, 33 insertions, 27 deletions
diff --git a/src/main/clojure/clojure/contrib/pprint/ColumnWriter.clj b/src/main/clojure/clojure/contrib/pprint/ColumnWriter.clj
index fc6ae75c..99623da9 100644
--- a/src/main/clojure/clojure/contrib/pprint/ColumnWriter.clj
+++ b/src/main/clojure/clojure/contrib/pprint/ColumnWriter.clj
@@ -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)
diff --git a/src/main/clojure/clojure/contrib/pprint/PrettyWriter.clj b/src/main/clojure/clojure/contrib/pprint/PrettyWriter.clj
index 09c59559..04742696 100644
--- a/src/main/clojure/clojure/contrib/pprint/PrettyWriter.clj
+++ b/src/main/clojure/clojure/contrib/pprint/PrettyWriter.clj
@@ -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
diff --git a/src/main/clojure/clojure/contrib/pprint/gen_class.clj b/src/main/clojure/clojure/contrib/pprint/gen_class.clj
new file mode 100644
index 00000000..1b4c550b
--- /dev/null
+++ b/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)