summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorMatthew Petroff <matthew@mpetroff.net>2013-09-16 19:58:54 +0000
committerMatthew Petroff <matthew@mpetroff.net>2013-09-16 19:58:54 +0000
commit73b19d666ad7cb32ed829757227d1d7f229714e5 (patch)
tree308a6094fe24b9428205a528793abd0b3ce3595c /src/util
parentFix 3d box document unit change undo bug. (diff)
downloadinkscape-73b19d666ad7cb32ed829757227d1d7f229714e5.tar.gz
inkscape-73b19d666ad7cb32ed829757227d1d7f229714e5.zip
Comment clean up.
(bzr r12475.1.27)
Diffstat (limited to 'src/util')
-rw-r--r--src/util/expression-evaluator.cpp3
-rw-r--r--src/util/expression-evaluator.h29
-rw-r--r--src/util/units.h15
3 files changed, 22 insertions, 25 deletions
diff --git a/src/util/expression-evaluator.cpp b/src/util/expression-evaluator.cpp
index 2fb57e783..3b7e77c6c 100644
--- a/src/util/expression-evaluator.cpp
+++ b/src/util/expression-evaluator.cpp
@@ -62,9 +62,6 @@ ExpressionEvaluator::ExpressionEvaluator(const char *string, Unit *unit) :
* Evaluates the given arithmetic expression, along with an optional dimension
* analysis, and basic unit conversions.
*
- * @param string The NULL-terminated string to be evaluated.
- * @param unit_resolver_proc Unit resolver callback.
- *
* All units conversions factors are relative to some implicit
* base-unit. This is also the unit of the returned value.
*
diff --git a/src/util/expression-evaluator.h b/src/util/expression-evaluator.h
index 69a87eda1..6412dfea7 100644
--- a/src/util/expression-evaluator.h
+++ b/src/util/expression-evaluator.h
@@ -34,7 +34,7 @@
/**
* @file
- * Introducing eevl eva, the evaluator. A straightforward recursive
+ * Expression evaluator: A straightforward recursive
* descent parser, no fuss, no new dependencies. The lexer is hand
* coded, tedious, not extremely fast but works. It evaluates the
* expression as it goes along, and does not create a parse tree or
@@ -44,8 +44,8 @@
*
* It relies on external unit resolving through a callback and does
* elementary dimensionality constraint check (e.g. "2 mm + 3 px * 4
- * in" is an error, as L + L^2 is a missmatch). It uses g_strtod() for numeric
- * conversions and it's non-destructive in terms of the paramters, and
+ * in" is an error, as L + L^2 is a mismatch). It uses g_strtod() for numeric
+ * conversions and it's non-destructive in terms of the parameters, and
* it's reentrant.
*
* EBNF:
@@ -53,7 +53,9 @@
* expression ::= term { ('+' | '-') term }* |
* <empty string> ;
*
- * term ::= signed factor { ( '*' | '/' ) signed factor }* ;
+ * term ::= exponent { ( '*' | '/' ) exponent }* ;
+ *
+ * exponent ::= signed factor { '^' signed factor }* ;
*
* signed factor ::= ( '+' | '-' )? factor ;
*
@@ -80,10 +82,10 @@ namespace Util {
class Unit;
/**
-* EvaluatorQuantity:
-* @value: In reference units.
-* @dimension: mm has a dimension of 1, mm^2 has a dimension of 2, etc.
-*/
+ * EvaluatorQuantity:
+ * @param value In reference units.
+ * @param dimension mm has a dimension of 1, mm^2 has a dimension of 2, etc.
+ */
class EvaluatorQuantity
{
public:
@@ -93,6 +95,9 @@ public:
unsigned int dimension;
};
+/**
+ * TokenType
+ */
enum {
TOKEN_NUM = 30000,
TOKEN_IDENTIFIER = 30001,
@@ -101,6 +106,9 @@ enum {
};
typedef int TokenType;
+/**
+ * EvaluatorToken
+ */
class EvaluatorToken
{
public:
@@ -117,6 +125,11 @@ public:
} value;
};
+/**
+ * ExpressionEvaluator
+ * @param string NULL terminated input string to evaluate
+ * @param unit Unit output should be in
+ */
class ExpressionEvaluator
{
public:
diff --git a/src/util/units.h b/src/util/units.h
index 44333fae2..7ba6e1e86 100644
--- a/src/util/units.h
+++ b/src/util/units.h
@@ -1,5 +1,6 @@
/*
* Inkscape Units
+ * These classes are used for defining different unit systems.
*
* Authors:
* Matthew Petroff <matthew@mpetroff.net>
@@ -9,20 +10,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-/*
-This is a rough draft of a global 'units' thingee, to allow dialogs and
-the ruler to share info about unit systems... Dunno if this is the
-right kind of object though, so we may have to redo this or shift things
-around later when it becomes clearer what we need.
-
-This object is used for defining different unit systems.
-
-This is intended to eventually replace inkscape/helper/units.*.
-
-Need to review the Units support that's in Gtkmm already...
-
-*/
-
#ifndef INKSCAPE_UTIL_UNITS_H
#define INKSCAPE_UTIL_UNITS_H