2014-05-18 22:46:44 +00:00
|
|
|
require "formula"
|
2011-03-04 03:30:48 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Aamath < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Renders mathematical expressions as ASCII art"
|
2014-05-18 22:46:44 +00:00
|
|
|
homepage "http://fuse.superglue.se/aamath/"
|
|
|
|
url "http://fuse.superglue.se/aamath/aamath-0.3.tar.gz"
|
|
|
|
sha1 "dc68abaf2131c73ddb1a520c95d65596e30f1b0a"
|
2011-03-04 03:30:48 +00:00
|
|
|
|
2014-05-18 22:46:44 +00:00
|
|
|
# Fix build on clang; patch by Homebrew team
|
|
|
|
# https://github.com/Homebrew/homebrew/issues/23872
|
2014-03-18 03:44:46 +00:00
|
|
|
patch :DATA
|
2013-11-17 02:03:46 +00:00
|
|
|
|
2011-03-04 03:30:48 +00:00
|
|
|
def install
|
|
|
|
ENV.j1
|
|
|
|
system "make"
|
|
|
|
|
|
|
|
bin.install "aamath"
|
|
|
|
man1.install "aamath.1"
|
|
|
|
prefix.install "testcases"
|
|
|
|
end
|
|
|
|
|
2013-03-26 17:38:16 +00:00
|
|
|
test do
|
2014-05-04 19:12:41 +00:00
|
|
|
s = pipe_output("#{bin}/aamath", (prefix/"testcases").read)
|
|
|
|
assert_match /#{Regexp.escape("f(x + h) = f(x) + h f'(x)")}/, s
|
2011-03-04 03:30:48 +00:00
|
|
|
end
|
|
|
|
end
|
2013-11-17 02:03:46 +00:00
|
|
|
|
|
|
|
__END__
|
|
|
|
diff --git a/expr.cc b/expr.cc
|
|
|
|
index 7bc0ee3..8f4eaf7 100644
|
|
|
|
--- a/expr.cc
|
|
|
|
+++ b/expr.cc
|
|
|
|
@@ -1192,7 +1192,7 @@ IntegralOnInterval::render_head() const
|
|
|
|
|
|
|
|
class SumSymbol : public OpSymbol {
|
|
|
|
public:
|
|
|
|
- void render(Canvas& c, int r, int c) const;
|
|
|
|
+ void render(Canvas& canvas, int r, int c) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
@@ -1208,7 +1208,7 @@ SumSymbol::render(Canvas& canvas, int r, int c) const
|
|
|
|
|
|
|
|
class ProductSymbol : public OpSymbol {
|
|
|
|
public:
|
|
|
|
- void render(Canvas& c, int r, int c) const;
|
|
|
|
+ void render(Canvas& canvas, int r, int c) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
@@ -1612,7 +1612,7 @@ Matrix::render() const
|
|
|
|
int cols = num_cols();
|
|
|
|
int rows = num_rows();
|
|
|
|
|
|
|
|
- CanvasPtr ec[cols * rows];
|
|
|
|
+ CanvasPtr *ec = new CanvasPtr[cols * rows];
|
|
|
|
Size sz[cols * rows];
|
|
|
|
|
|
|
|
int row_height[rows];
|
|
|
|
@@ -1692,6 +1692,8 @@ Matrix::render() const
|
|
|
|
|
|
|
|
canvas->center();
|
|
|
|
|
|
|
|
+ delete[] ec;
|
|
|
|
+
|
|
|
|
return canvas;
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/expr.h b/expr.h
|
|
|
|
index 000ebd4..d233da9 100644
|
|
|
|
--- a/expr.h
|
|
|
|
+++ b/expr.h
|
|
|
|
@@ -451,7 +451,7 @@ class Integral : public OpOnFunction {
|
|
|
|
|
|
|
|
virtual CanvasPtr render_head() const;
|
|
|
|
|
|
|
|
- void render_symbol(Canvas& c, int r, int c, int h) const;
|
|
|
|
+ void render_symbol(Canvas& canvas, int r, int c, int h) const;
|
|
|
|
|
|
|
|
virtual CanvasPtr render() const;
|
|
|
|
};
|
|
|
|
@@ -467,7 +467,7 @@ class IntegralOnInterval : public Integral, public OpOverInterval {
|
|
|
|
|
|
|
|
class OpSymbol {
|
|
|
|
public:
|
|
|
|
- virtual void render(Canvas& c, int r, int c) const = 0;
|
|
|
|
+ virtual void render(Canvas& canvas, int r, int c) const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SumOrProduct : public OpOnFunction {
|