├── .gitignore ├── README.md ├── project.clj ├── src └── elbow │ ├── pprint.cljs │ ├── grease.cljs │ └── core.cljs └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | pom.xml 2 | pom.xml.asc 3 | *jar 4 | /lib/ 5 | /classes/ 6 | /target/ 7 | /out/ 8 | /checkouts/ 9 | .lein-deps-sum 10 | .lein-repl-history 11 | .lein-plugins/ 12 | .lein-failures 13 | .nrepl-port 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # elbow 2 | Use Replumb in Node 3 | 4 | # Usage 5 | 6 | 1. `lein cljsbuild once` 7 | 2. `node out/main.js ` 8 | 9 | where `src-paths` looks like `src1:/bar/src2:/foo/src3` 10 | 11 | # Example 12 | 13 | ``` 14 | $ node out/main.js 15 | cljs.user=> 3 16 | 3 17 | cljs.user=> (+ 3 2) 18 | 5 19 | cljs.user=> (ns foo.bar) 20 | nil 21 | foo.bar=> ::a 22 | :foo.bar/a 23 | ``` 24 | 25 | # Demo 26 | 27 | Watch a demo to see it in action: 28 | 29 | [![Elbow Demo](http://img.youtube.com/vi/VwARsqTRw7s/0.jpg)](http://www.youtube.com/watch?v=VwARsqTRw7s "Replumb in Node") 30 | 31 | # License 32 | 33 | Copyright © 2015–2016 Mike Fikes and Contributors 34 | 35 | Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version. 36 | -------------------------------------------------------------------------------- /project.clj: -------------------------------------------------------------------------------- 1 | (defproject elbow "0.1.0-SNAPSHOT" 2 | :description "Use Replumb in Node" 3 | :url "https://github.com/mfikes/elbow" 4 | :license {:name "Eclipse Public License" 5 | :url "https://github.com/mfikes/elbow/blob/master/LICENSE"} 6 | :dependencies [[org.clojure/clojure "1.7.0"] 7 | [org.clojure/clojurescript "1.8.51"] 8 | [replumb/replumb "0.2.1"] 9 | [fipp "0.6.5"]] 10 | :clean-targets [:target-path "out"] 11 | :plugins [[lein-cljsbuild "1.1.1"]] 12 | :cljsbuild { 13 | :builds [{ 14 | :source-paths ["src"] 15 | :compiler { 16 | :target :nodejs 17 | :main elbow.core 18 | :output-to "out/main.js" 19 | :output-dir "out" 20 | :optimizations :none}}]}) 21 | -------------------------------------------------------------------------------- /src/elbow/pprint.cljs: -------------------------------------------------------------------------------- 1 | (ns elbow.pprint 2 | (:require [fipp.visit :refer [visit visit*]] 3 | [fipp.engine :refer (pprint-document)])) 4 | 5 | (defn pretty-coll [{:keys [print-level print-length] :as printer} 6 | open xs sep close f] 7 | (let [printer (cond-> printer print-level (update :print-level dec)) 8 | xform (comp (if print-length (take print-length) identity) 9 | (map #(f printer %)) 10 | (interpose sep)) 11 | ys (if (pos? (or print-level 1)) 12 | (sequence xform xs) 13 | "#") 14 | ellipsis (when (and print-length (seq (drop print-length xs))) 15 | [:span sep "..."])] 16 | [:group open [:align ys ellipsis] close])) 17 | 18 | (defrecord ElbowPrinter [symbols print-meta print-length print-level] 19 | 20 | fipp.visit/IVisitor 21 | 22 | (visit-unknown [this x] 23 | [:text (pr-str x)]) 24 | 25 | 26 | (visit-nil [this] 27 | [:text "nil"]) 28 | 29 | (visit-boolean [this x] 30 | [:text (str x)]) 31 | 32 | (visit-string [this x] 33 | [:text (pr-str x)]) 34 | 35 | (visit-character [this x] 36 | [:text (pr-str x)]) 37 | 38 | (visit-symbol [this x] 39 | [:text (str x)]) 40 | 41 | (visit-keyword [this x] 42 | [:text (pr-str x)]) 43 | 44 | (visit-number [this x] 45 | [:text (pr-str x)]) 46 | 47 | (visit-seq [this x] 48 | (if-let [pretty (symbols (first x))] 49 | (pretty this x) 50 | (pretty-coll this "(" x :line ")" visit))) 51 | 52 | (visit-vector [this x] 53 | (pretty-coll this "[" x :line "]" visit)) 54 | 55 | (visit-map [this x] 56 | (pretty-coll this "{" x [:span "," :line] "}" 57 | (fn [printer [k v]] 58 | [:span (visit printer k) " " (visit printer v)]))) 59 | 60 | (visit-set [this x] 61 | (pretty-coll this "#{" x :line "}" visit)) 62 | 63 | (visit-tagged [this {:keys [tag form]}] 64 | [:group "#" (pr-str tag) 65 | (when (or (and print-meta (meta form)) 66 | (not (coll? form))) 67 | " ") 68 | (visit this form)]) 69 | 70 | 71 | (visit-meta [this m x] 72 | (if print-meta 73 | [:align [:span "^" (visit this m)] :line (visit* this x)] 74 | (visit* this x))) 75 | 76 | (visit-var [this x] 77 | [:text (pr-str x)]) 78 | 79 | (visit-pattern [this x] 80 | [:text (pr-str x)]) 81 | 82 | (visit-record [this x] 83 | [:text (pr-str x)])) 84 | 85 | (defn pprint 86 | ([x] (pprint x {})) 87 | ([x options] 88 | (let [defaults {:symbols {} 89 | :print-length *print-length* 90 | :print-level *print-level* 91 | :print-meta *print-meta*} 92 | full-opts (merge defaults options) 93 | printer (map->ElbowPrinter full-opts)] 94 | (pprint-document (visit printer x) full-opts)))) 95 | -------------------------------------------------------------------------------- /src/elbow/grease.cljs: -------------------------------------------------------------------------------- 1 | (ns elbow.grease 2 | (:require 3 | cljs.pprint 4 | cljs.test 5 | goog.Delay 6 | goog.Disposable 7 | goog.Promise 8 | goog.Throttle 9 | goog.Timer 10 | goog.Uri 11 | goog.array.ArrayLike 12 | goog.color 13 | goog.color.Hsl 14 | goog.color.Hsv 15 | goog.color.Rgb 16 | goog.color.alpha 17 | goog.color.names 18 | goog.crypt 19 | goog.crypt.Aes 20 | goog.crypt.Arc4 21 | goog.crypt.BlobHasher 22 | goog.crypt.Cbc 23 | goog.crypt.Hash 24 | goog.crypt.Hmac 25 | goog.crypt.JpegEncoder 26 | goog.crypt.Md5 27 | goog.crypt.Sha1 28 | goog.crypt.Sha2 29 | goog.crypt.Sha224 30 | goog.crypt.Sha256 31 | goog.crypt.Sha2_64bit 32 | goog.crypt.Sha512 33 | goog.crypt.Sha512_256 34 | goog.crypt.base64 35 | goog.crypt.baseN 36 | goog.crypt.hash32 37 | goog.crypt.hashTester 38 | goog.crypt.pbkdf2 39 | goog.date.Date 40 | goog.date.DateLike 41 | goog.date.DateRange 42 | goog.date.DateTime 43 | goog.date.Interval 44 | goog.date.UtcDateTime 45 | goog.date.duration 46 | goog.date.month 47 | goog.date.relative.TimeDeltaFormatter 48 | goog.date.relative.Unit 49 | goog.date.relativeWithPlurals 50 | goog.date.weekDay 51 | goog.format 52 | goog.format.EmailAddress 53 | goog.format.HtmlPrettyPrinter 54 | goog.format.InternationalizedEmailAddress 55 | goog.format.JsonPrettyPrinter 56 | goog.i18n.BidiFormatter 57 | goog.i18n.CharListDecompressor 58 | goog.i18n.CharPickerData 59 | goog.i18n.DateTimeFormat 60 | goog.i18n.DateTimeParse 61 | goog.i18n.GraphemeBreak 62 | goog.i18n.MessageFormat 63 | goog.i18n.NumberFormat 64 | goog.i18n.TimeZone 65 | goog.i18n.bidi 66 | goog.i18n.bidi.Dir 67 | goog.i18n.bidi.Format 68 | goog.i18n.collation 69 | goog.i18n.currency 70 | goog.i18n.mime 71 | goog.i18n.ordinalRules 72 | goog.i18n.pluralRules 73 | goog.i18n.uChar 74 | goog.i18n.uChar.LocalNameFetcher 75 | goog.i18n.uChar.RemoteNameFetcher 76 | goog.i18n.uCharNames 77 | goog.iter 78 | goog.iter.Iterable 79 | goog.iter.Iterator 80 | goog.json 81 | goog.json.EvalJsonProcessor 82 | goog.json.HybridJsonProcessor 83 | goog.json.NativeJsonProcessor 84 | goog.json.Replacer 85 | goog.json.Reviver 86 | goog.json.Serializer 87 | goog.json.hybrid 88 | goog.locale 89 | goog.locale.TimeZoneFingerprint 90 | goog.locale.defaultLocaleNameConstants 91 | goog.locale.genericFontNames 92 | goog.locale.timeZoneDetection 93 | goog.math 94 | goog.math.AffineTransform 95 | goog.math.Bezier 96 | goog.math.Box 97 | goog.math.Coordinate 98 | goog.math.Coordinate3 99 | goog.math.ExponentialBackoff 100 | goog.math.Integer 101 | goog.math.Line 102 | goog.math.Long 103 | goog.math.Matrix 104 | goog.math.Path 105 | goog.math.Path.Segment 106 | goog.math.Range 107 | goog.math.RangeSet 108 | goog.math.Rect 109 | goog.math.Size 110 | goog.math.Vec2 111 | goog.math.Vec3 112 | goog.math.interpolator.Linear1 113 | goog.math.interpolator.Pchip1 114 | goog.math.interpolator.Spline1 115 | goog.math.paths 116 | goog.math.tdma 117 | goog.spell.SpellCheck 118 | goog.string 119 | goog.string.Const 120 | goog.string.StringBuffer 121 | goog.string.Unicode 122 | goog.string.format 123 | goog.string.newlines 124 | goog.string.newlines.Line 125 | goog.structs 126 | goog.structs.AvlTree 127 | goog.structs.AvlTree.Node 128 | goog.structs.CircularBuffer 129 | goog.structs.Heap 130 | goog.structs.InversionMap 131 | goog.structs.LinkedMap 132 | goog.structs.Map 133 | goog.structs.Node 134 | goog.structs.Pool 135 | goog.structs.PriorityPool 136 | goog.structs.PriorityQueue 137 | goog.structs.QuadTree 138 | goog.structs.QuadTree.Node 139 | goog.structs.QuadTree.Point 140 | goog.structs.Queue 141 | goog.structs.Set 142 | goog.structs.SimplePool 143 | goog.structs.StringSet 144 | goog.structs.TreeNode 145 | goog.structs.Trie 146 | goog.structs.weak 147 | goog.text.LoremIpsum)) 148 | -------------------------------------------------------------------------------- /src/elbow/core.cljs: -------------------------------------------------------------------------------- 1 | (ns elbow.core 2 | (:require [clojure.string :as string] 3 | [cljs.nodejs :as nodejs] 4 | [replumb.core :as replumb] 5 | [elbow.pprint :as pprint])) 6 | 7 | ;; Node file reading fns 8 | 9 | (def fs (nodejs/require "fs")) 10 | 11 | (defn node-read-file 12 | "Accepts a filename to read and a callback. Upon success, invokes 13 | callback with the source. Otherwise invokes the callback with nil." 14 | [filename cb] 15 | (.readFile fs filename "utf-8" 16 | (fn [err source] 17 | (cb (when-not err 18 | source))))) 19 | 20 | (defn node-read-file-sync 21 | "Accepts a filename to read. Upon success, returns the source. 22 | Otherwise returns nil." 23 | [filename] 24 | (.readFileSync fs filename "utf-8")) 25 | 26 | ;; Facilities for loading Closure deps 27 | 28 | (def goog-path-root "out/goog/") 29 | 30 | (defn closure-index 31 | [] 32 | (let [paths-to-provides 33 | (map (fn [[_ path provides]] 34 | [path (map second 35 | (re-seq #"'(.*?)'" provides))]) 36 | (re-seq #"\ngoog\.addDependency\('(.*)', \[(.*?)\].*" 37 | (node-read-file-sync (str goog-path-root "deps.js"))))] 38 | (into {} 39 | (for [[path provides] paths-to-provides 40 | provide provides] 41 | [(symbol provide) (str goog-path-root (second (re-find #"(.*)\.js$" path)))])))) 42 | 43 | (def closure-index-mem (memoize closure-index)) 44 | 45 | (defn load-goog 46 | [name cb] 47 | (if-let [goog-path (get (closure-index-mem) name)] 48 | (if-let [source (node-read-file-sync (str goog-path ".js"))] 49 | (cb {:source source 50 | :lang :js}) 51 | (cb nil)) 52 | (cb nil))) 53 | 54 | ;; Facilities for loading files 55 | 56 | (defn- filename->lang 57 | "Converts a filename to a lang keyword by inspecting the file 58 | extension." 59 | [filename] 60 | (if (string/ends-with? filename ".js") 61 | :js 62 | :clj)) 63 | 64 | (defn- read-some 65 | "Reads the first filename in a sequence of supplied filenames, 66 | using a supplied read-file-fn, calling back upon first successful 67 | read, otherwise calling back with nil." 68 | [[filename & more-filenames] read-file-fn cb] 69 | (if filename 70 | (read-file-fn 71 | filename 72 | (fn [source] 73 | (if source 74 | (cb {:lang (filename->lang filename) 75 | :source source}) 76 | (read-some more-filenames read-file-fn cb)))) 77 | (cb nil))) 78 | 79 | (defn- filenames-to-try 80 | "Produces a sequence of filenames to try reading, in the 81 | order they should be tried." 82 | [src-paths macros path] 83 | (let [extensions (if macros 84 | [".clj" ".cljc"] 85 | [".cljs" ".cljc" ".js"])] 86 | (for [extension extensions 87 | src-path src-paths] 88 | (str src-path "/" path extension)))) 89 | 90 | (defn skip-load? 91 | [name macros] 92 | ((if macros 93 | #{'cljs.pprint} 94 | #{'goog.object 95 | 'goog.string 96 | 'goog.string.StringBuffer 97 | 'goog.array 98 | 'clojure.string 99 | 'clojure.set 100 | 'cljs.core 101 | 'cljs.env 102 | 'cljs.reader 103 | 'cljs.tagged-literals 104 | 'cljs.tools.reader.impl.utils 105 | 'cljs.pprint}) name)) 106 | 107 | ;; An atom to keep track of things we've already loaded 108 | (def loaded (atom #{})) 109 | 110 | (defn load? 111 | [name macros] 112 | (let [do-not-load (or (@loaded name) 113 | (skip-load? name macros))] 114 | (swap! loaded conj name) 115 | (not do-not-load))) 116 | 117 | (defn make-load-fn 118 | "Makes a load function that will read from a sequence of src-paths 119 | using a supplied read-file-fn. It returns a cljs.js-compatible 120 | *load-fn*. 121 | 122 | Read-file-fn is a 2-arity function (fn [filename source-cb] ...) where 123 | source-cb is itself a function (fn [source] ...) that needs to be called 124 | with the source of the library (as string)." 125 | [src-paths read-file-fn] 126 | (fn [{:keys [name macros path]} cb] 127 | (prn name) 128 | (if (load? name macros) 129 | (if (re-matches #"^goog/.*" path) 130 | (load-goog name cb) 131 | (read-some (filenames-to-try src-paths macros path) read-file-fn cb)) 132 | (cb {:source "" 133 | :lang :js})))) 134 | 135 | ;; Simple REPL 136 | 137 | (defn read-eval-print-loop 138 | [src-paths] 139 | (let [node-readline (nodejs/require "readline") 140 | rl (.createInterface node-readline 141 | #js {:input (.-stdin js/process) 142 | :output (.-stdout js/process)})] 143 | (doto rl 144 | (.setPrompt (replumb/get-prompt)) 145 | (.on "line" 146 | (fn [cmd] 147 | (replumb/read-eval-call 148 | (merge 149 | {:no-pr-str-on-value true} 150 | (replumb/options :nodejs (make-load-fn src-paths node-read-file))) 151 | (fn [res] 152 | (let [{:keys [error value]} res] 153 | (if error 154 | (println error) 155 | (pprint/pprint value))) 156 | (.setPrompt rl (replumb/get-prompt)) 157 | (.prompt rl)) 158 | cmd))) 159 | (.prompt)))) 160 | 161 | (defn arg->src-paths 162 | [arg] 163 | (string/split arg #":")) 164 | 165 | (defn -main [& args] 166 | (read-eval-print-loop 167 | (if-not (empty? args) 168 | (-> (first args) 169 | arg->src-paths) 170 | []))) 171 | 172 | (set! *main-cli-fn* -main) 173 | 174 | (defn enable-process-print! [] 175 | (set! *print-newline* true) 176 | (set! *print-fn* 177 | (fn [& args] 178 | (.apply (.-write nodejs/process.stdout) nodejs/process.stdout (into-array args)))) 179 | (set! *print-err-fn* 180 | (fn [& args] 181 | (.apply (.-write nodejs/process.stderr) nodejs/process.stderr (into-array args)))) 182 | nil) 183 | 184 | (enable-process-print!) 185 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Eclipse Public License - v 1.0 2 | 3 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC 4 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM 5 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 6 | 7 | 1. DEFINITIONS 8 | 9 | "Contribution" means: 10 | 11 | a) in the case of the initial Contributor, the initial code and documentation 12 | distributed under this Agreement, and 13 | b) in the case of each subsequent Contributor: 14 | i) changes to the Program, and 15 | ii) additions to the Program; 16 | 17 | where such changes and/or additions to the Program originate from and are 18 | distributed by that particular Contributor. A Contribution 'originates' 19 | from a Contributor if it was added to the Program by such Contributor 20 | itself or anyone acting on such Contributor's behalf. Contributions do not 21 | include additions to the Program which: (i) are separate modules of 22 | software distributed in conjunction with the Program under their own 23 | license agreement, and (ii) are not derivative works of the Program. 24 | 25 | "Contributor" means any person or entity that distributes the Program. 26 | 27 | "Licensed Patents" mean patent claims licensable by a Contributor which are 28 | necessarily infringed by the use or sale of its Contribution alone or when 29 | combined with the Program. 30 | 31 | "Program" means the Contributions distributed in accordance with this 32 | Agreement. 33 | 34 | "Recipient" means anyone who receives the Program under this Agreement, 35 | including all Contributors. 36 | 37 | 2. GRANT OF RIGHTS 38 | a) Subject to the terms of this Agreement, each Contributor hereby grants 39 | Recipient a non-exclusive, worldwide, royalty-free copyright license to 40 | reproduce, prepare derivative works of, publicly display, publicly 41 | perform, distribute and sublicense the Contribution of such Contributor, 42 | if any, and such derivative works, in source code and object code form. 43 | b) Subject to the terms of this Agreement, each Contributor hereby grants 44 | Recipient a non-exclusive, worldwide, royalty-free patent license under 45 | Licensed Patents to make, use, sell, offer to sell, import and otherwise 46 | transfer the Contribution of such Contributor, if any, in source code and 47 | object code form. This patent license shall apply to the combination of 48 | the Contribution and the Program if, at the time the Contribution is 49 | added by the Contributor, such addition of the Contribution causes such 50 | combination to be covered by the Licensed Patents. The patent license 51 | shall not apply to any other combinations which include the Contribution. 52 | No hardware per se is licensed hereunder. 53 | c) Recipient understands that although each Contributor grants the licenses 54 | to its Contributions set forth herein, no assurances are provided by any 55 | Contributor that the Program does not infringe the patent or other 56 | intellectual property rights of any other entity. Each Contributor 57 | disclaims any liability to Recipient for claims brought by any other 58 | entity based on infringement of intellectual property rights or 59 | otherwise. As a condition to exercising the rights and licenses granted 60 | hereunder, each Recipient hereby assumes sole responsibility to secure 61 | any other intellectual property rights needed, if any. For example, if a 62 | third party patent license is required to allow Recipient to distribute 63 | the Program, it is Recipient's responsibility to acquire that license 64 | before distributing the Program. 65 | d) Each Contributor represents that to its knowledge it has sufficient 66 | copyright rights in its Contribution, if any, to grant the copyright 67 | license set forth in this Agreement. 68 | 69 | 3. REQUIREMENTS 70 | 71 | A Contributor may choose to distribute the Program in object code form under 72 | its own license agreement, provided that: 73 | 74 | a) it complies with the terms and conditions of this Agreement; and 75 | b) its license agreement: 76 | i) effectively disclaims on behalf of all Contributors all warranties 77 | and conditions, express and implied, including warranties or 78 | conditions of title and non-infringement, and implied warranties or 79 | conditions of merchantability and fitness for a particular purpose; 80 | ii) effectively excludes on behalf of all Contributors all liability for 81 | damages, including direct, indirect, special, incidental and 82 | consequential damages, such as lost profits; 83 | iii) states that any provisions which differ from this Agreement are 84 | offered by that Contributor alone and not by any other party; and 85 | iv) states that source code for the Program is available from such 86 | Contributor, and informs licensees how to obtain it in a reasonable 87 | manner on or through a medium customarily used for software exchange. 88 | 89 | When the Program is made available in source code form: 90 | 91 | a) it must be made available under this Agreement; and 92 | b) a copy of this Agreement must be included with each copy of the Program. 93 | Contributors may not remove or alter any copyright notices contained 94 | within the Program. 95 | 96 | Each Contributor must identify itself as the originator of its Contribution, 97 | if 98 | any, in a manner that reasonably allows subsequent Recipients to identify the 99 | originator of the Contribution. 100 | 101 | 4. COMMERCIAL DISTRIBUTION 102 | 103 | Commercial distributors of software may accept certain responsibilities with 104 | respect to end users, business partners and the like. While this license is 105 | intended to facilitate the commercial use of the Program, the Contributor who 106 | includes the Program in a commercial product offering should do so in a manner 107 | which does not create potential liability for other Contributors. Therefore, 108 | if a Contributor includes the Program in a commercial product offering, such 109 | Contributor ("Commercial Contributor") hereby agrees to defend and indemnify 110 | every other Contributor ("Indemnified Contributor") against any losses, 111 | damages and costs (collectively "Losses") arising from claims, lawsuits and 112 | other legal actions brought by a third party against the Indemnified 113 | Contributor to the extent caused by the acts or omissions of such Commercial 114 | Contributor in connection with its distribution of the Program in a commercial 115 | product offering. The obligations in this section do not apply to any claims 116 | or Losses relating to any actual or alleged intellectual property 117 | infringement. In order to qualify, an Indemnified Contributor must: 118 | a) promptly notify the Commercial Contributor in writing of such claim, and 119 | b) allow the Commercial Contributor to control, and cooperate with the 120 | Commercial Contributor in, the defense and any related settlement 121 | negotiations. The Indemnified Contributor may participate in any such claim at 122 | its own expense. 123 | 124 | For example, a Contributor might include the Program in a commercial product 125 | offering, Product X. That Contributor is then a Commercial Contributor. If 126 | that Commercial Contributor then makes performance claims, or offers 127 | warranties related to Product X, those performance claims and warranties are 128 | such Commercial Contributor's responsibility alone. Under this section, the 129 | Commercial Contributor would have to defend claims against the other 130 | Contributors related to those performance claims and warranties, and if a 131 | court requires any other Contributor to pay any damages as a result, the 132 | Commercial Contributor must pay those damages. 133 | 134 | 5. NO WARRANTY 135 | 136 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN 137 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR 138 | IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each 140 | Recipient is solely responsible for determining the appropriateness of using 141 | and distributing the Program and assumes all risks associated with its 142 | exercise of rights under this Agreement , including but not limited to the 143 | risks and costs of program errors, compliance with applicable laws, damage to 144 | or loss of data, programs or equipment, and unavailability or interruption of 145 | operations. 146 | 147 | 6. DISCLAIMER OF LIABILITY 148 | 149 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY 150 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, 151 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION 152 | LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 153 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 154 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE 155 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY 156 | OF SUCH DAMAGES. 157 | 158 | 7. GENERAL 159 | 160 | If any provision of this Agreement is invalid or unenforceable under 161 | applicable law, it shall not affect the validity or enforceability of the 162 | remainder of the terms of this Agreement, and without further action by the 163 | parties hereto, such provision shall be reformed to the minimum extent 164 | necessary to make such provision valid and enforceable. 165 | 166 | If Recipient institutes patent litigation against any entity (including a 167 | cross-claim or counterclaim in a lawsuit) alleging that the Program itself 168 | (excluding combinations of the Program with other software or hardware) 169 | infringes such Recipient's patent(s), then such Recipient's rights granted 170 | under Section 2(b) shall terminate as of the date such litigation is filed. 171 | 172 | All Recipient's rights under this Agreement shall terminate if it fails to 173 | comply with any of the material terms or conditions of this Agreement and does 174 | not cure such failure in a reasonable period of time after becoming aware of 175 | such noncompliance. If all Recipient's rights under this Agreement terminate, 176 | Recipient agrees to cease use and distribution of the Program as soon as 177 | reasonably practicable. However, Recipient's obligations under this Agreement 178 | and any licenses granted by Recipient relating to the Program shall continue 179 | and survive. 180 | 181 | Everyone is permitted to copy and distribute copies of this Agreement, but in 182 | order to avoid inconsistency the Agreement is copyrighted and may only be 183 | modified in the following manner. The Agreement Steward reserves the right to 184 | publish new versions (including revisions) of this Agreement from time to 185 | time. No one other than the Agreement Steward has the right to modify this 186 | Agreement. The Eclipse Foundation is the initial Agreement Steward. The 187 | Eclipse Foundation may assign the responsibility to serve as the Agreement 188 | Steward to a suitable separate entity. Each new version of the Agreement will 189 | be given a distinguishing version number. The Program (including 190 | Contributions) may always be distributed subject to the version of the 191 | Agreement under which it was received. In addition, after a new version of the 192 | Agreement is published, Contributor may elect to distribute the Program 193 | (including its Contributions) under the new version. Except as expressly 194 | stated in Sections 2(a) and 2(b) above, Recipient receives no rights or 195 | licenses to the intellectual property of any Contributor under this Agreement, 196 | whether expressly, by implication, estoppel or otherwise. All rights in the 197 | Program not expressly granted under this Agreement are reserved. 198 | 199 | This Agreement is governed by the laws of the State of New York and the 200 | intellectual property laws of the United States of America. No party to this 201 | Agreement will bring a legal action under this Agreement more than one year 202 | after the cause of action arose. Each party waives its rights to a jury trial in 203 | any resulting litigation. 204 | 205 | --------------------------------------------------------------------------------