whitespace
This commit is contained in:
parent
2f5ecd46c7
commit
f6894fabc8
@ -5,12 +5,12 @@
|
|||||||
* terms of the GNU General Public License as published by the Free Software
|
* terms of the GNU General Public License as published by the Free Software
|
||||||
* Foundation, either version 3 of the License, or (at your option) any later
|
* Foundation, either version 3 of the License, or (at your option) any later
|
||||||
* version.
|
* version.
|
||||||
*
|
*
|
||||||
* libgim is distributed in the hope that it will be useful, but WITHOUT ANY
|
* libgim is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
* details.
|
* details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with libgim. If not, see <http://www.gnu.org/licenses/>.
|
* along with libgim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
* terms of the GNU General Public License as published by the Free Software
|
* terms of the GNU General Public License as published by the Free Software
|
||||||
* Foundation, either version 3 of the License, or (at your option) any later
|
* Foundation, either version 3 of the License, or (at your option) any later
|
||||||
* version.
|
* version.
|
||||||
*
|
*
|
||||||
* libgim is distributed in the hope that it will be useful, but WITHOUT ANY
|
* libgim is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
* details.
|
* details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with libgim. If not, see <http://www.gnu.org/licenses/>.
|
* along with libgim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
|
20
options.cpp
20
options.cpp
@ -64,7 +64,7 @@ void
|
|||||||
option::execute (void) {
|
option::execute (void) {
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"Cannot provide no value for the option '" + m_longopt + "'"
|
"Cannot provide no value for the option '" + m_longopt + "'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ bytesoption::execute (const std::string& data) {
|
|||||||
bytestype specified = m_type;
|
bytestype specified = m_type;
|
||||||
try {
|
try {
|
||||||
specified = type_from_character (data[cursor]);
|
specified = type_from_character (data[cursor]);
|
||||||
// If the character is a digit, it just means the user skipped the
|
// If the character is a digit, it just means the user skipped the
|
||||||
// size specifier, which is ok.
|
// size specifier, which is ok.
|
||||||
} catch (domain_error x) {
|
} catch (domain_error x) {
|
||||||
if (!isdigit (data[cursor]))
|
if (!isdigit (data[cursor]))
|
||||||
@ -395,7 +395,7 @@ processor::parse_short (int pos, int argc, const char **argv) {
|
|||||||
/**
|
/**
|
||||||
* Parse a single argument in long form. We are given an offset into the
|
* Parse a single argument in long form. We are given an offset into the
|
||||||
* argument array, and arguments. Establishes whether a value is present and
|
* argument array, and arguments. Establishes whether a value is present and
|
||||||
* passes control over to the option.
|
* passes control over to the option.
|
||||||
*
|
*
|
||||||
* The format of the options are "--foo[=bar]"
|
* The format of the options are "--foo[=bar]"
|
||||||
*
|
*
|
||||||
@ -430,11 +430,11 @@ processor::parse_long (int pos, int argc, const char ** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
option *o = m_longopt[arg];
|
option *o = m_longopt[arg];
|
||||||
if (!o)
|
if (!o)
|
||||||
throw runtime_error ("Cannot match option");
|
throw runtime_error ("Cannot match option");
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
o->execute (data);
|
o->execute (data);
|
||||||
else
|
else
|
||||||
o->execute ();
|
o->execute ();
|
||||||
|
|
||||||
@ -479,12 +479,12 @@ processor::parse_args (int argc, const char ** argv) {
|
|||||||
if (strlen (argv[i]) <= 1)
|
if (strlen (argv[i]) <= 1)
|
||||||
throw runtime_error ("Invalid argument");
|
throw runtime_error ("Invalid argument");
|
||||||
|
|
||||||
// Actually hand off args to be parsed. Subtract one from the
|
// Actually hand off args to be parsed. Subtract one from the
|
||||||
// tokens consumed, as the for loop increments tokens too.
|
// tokens consumed, as the for loop increments tokens too.
|
||||||
unsigned int consumed;
|
unsigned int consumed;
|
||||||
if (argv[i][1] != '-')
|
if (argv[i][1] != '-')
|
||||||
consumed = parse_short (i, argc, argv);
|
consumed = parse_short (i, argc, argv);
|
||||||
else
|
else
|
||||||
consumed = parse_long (i, argc, argv);
|
consumed = parse_long (i, argc, argv);
|
||||||
|
|
||||||
assert (consumed >= 1);
|
assert (consumed >= 1);
|
||||||
@ -533,7 +533,7 @@ processor::remove_option (char letter) {
|
|||||||
[&target] (std::unique_ptr<option> &rhs) { return rhs.get () == target; }
|
[&target] (std::unique_ptr<option> &rhs) { return rhs.get () == target; }
|
||||||
);
|
);
|
||||||
std::unique_ptr<option> opt = move (*prime);
|
std::unique_ptr<option> opt = move (*prime);
|
||||||
|
|
||||||
m_shortopt.erase (s_candidate);
|
m_shortopt.erase (s_candidate);
|
||||||
m_longopt.erase (l_candidate);
|
m_longopt.erase (l_candidate);
|
||||||
m_options.erase (prime);
|
m_options.erase (prime);
|
||||||
@ -561,7 +561,7 @@ processor::remove_option (const char *name) {
|
|||||||
[&target] (std::unique_ptr<option> &rhs) { return rhs.get () == target; }
|
[&target] (std::unique_ptr<option> &rhs) { return rhs.get () == target; }
|
||||||
);
|
);
|
||||||
std::unique_ptr<option> opt = move (*prime);
|
std::unique_ptr<option> opt = move (*prime);
|
||||||
|
|
||||||
m_shortopt.erase (s_candidate);
|
m_shortopt.erase (s_candidate);
|
||||||
m_longopt.erase (l_candidate);
|
m_longopt.erase (l_candidate);
|
||||||
m_options.erase (prime);
|
m_options.erase (prime);
|
||||||
|
@ -98,7 +98,7 @@ main (int, char **) {
|
|||||||
CHECK_EQ (magic3[2][0], 4.0);
|
CHECK_EQ (magic3[2][0], 4.0);
|
||||||
CHECK_EQ (magic3[2][1], 3.0);
|
CHECK_EQ (magic3[2][1], 3.0);
|
||||||
CHECK_EQ (magic3[2][2], 8.0);
|
CHECK_EQ (magic3[2][2], 8.0);
|
||||||
|
|
||||||
CHECK_EQ (seq2x2.determinant (), -2.0);
|
CHECK_EQ (seq2x2.determinant (), -2.0);
|
||||||
CHECK_EQ (magic3.determinant (), -360.0);
|
CHECK_EQ (magic3.determinant (), -360.0);
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ main (int, char **) {
|
|||||||
- 7.0, -22.0, 53.0 }) /= 360.0);
|
- 7.0, -22.0, 53.0 }) /= 360.0);
|
||||||
|
|
||||||
matrix invertible4 (4, 4, { 4, 14, 15, 1,
|
matrix invertible4 (4, 4, { 4, 14, 15, 1,
|
||||||
9, 7, 6, 12,
|
9, 7, 6, 12,
|
||||||
5, 11, 10, 8,
|
5, 11, 10, 8,
|
||||||
0, 0, 0, 1 });
|
0, 0, 0, 1 });
|
||||||
CHECK_EQ (invertible4.inverse (), matrix (4, 4, { 4, 25, -21, -136,
|
CHECK_EQ (invertible4.inverse (), matrix (4, 4, { 4, 25, -21, -136,
|
||||||
|
@ -91,7 +91,7 @@ template <size_t S>
|
|||||||
util::vector<S>
|
util::vector<S>
|
||||||
util::vector<S>::operator/ (double rhs) const {
|
util::vector<S>::operator/ (double rhs) const {
|
||||||
util::vector<S> out;
|
util::vector<S> out;
|
||||||
|
|
||||||
for (size_t i = 0; i < S; ++i)
|
for (size_t i = 0; i < S; ++i)
|
||||||
out.data[i] = this->data[i] / rhs;
|
out.data[i] = this->data[i] / rhs;
|
||||||
return out;
|
return out;
|
||||||
@ -259,7 +259,7 @@ util::vector<S>
|
|||||||
util::vector<S>::normalised (void) const {
|
util::vector<S>::normalised (void) const {
|
||||||
double mag = magnitude ();
|
double mag = magnitude ();
|
||||||
util::vector<S> out;
|
util::vector<S> out;
|
||||||
|
|
||||||
for (size_t i = 0; i < S; ++i)
|
for (size_t i = 0; i < S; ++i)
|
||||||
out.data[i] = this->data[i] / mag;
|
out.data[i] = this->data[i] / mag;
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ template <size_t S>
|
|||||||
const json::node&
|
const json::node&
|
||||||
util::operator>> (const json::node &node, util::vector<S> &v) {
|
util::operator>> (const json::node &node, util::vector<S> &v) {
|
||||||
const json::array &array = node.as_array ();
|
const json::array &array = node.as_array ();
|
||||||
if (array.size () != S)
|
if (array.size () != S)
|
||||||
throw std::runtime_error ("Invalid dimensionality for json-to-vector");
|
throw std::runtime_error ("Invalid dimensionality for json-to-vector");
|
||||||
|
|
||||||
// XXX: This used to be a std::transform but gcc 4.9.0 hit an internal
|
// XXX: This used to be a std::transform but gcc 4.9.0 hit an internal
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
* terms of the GNU General Public License as published by the Free Software
|
* terms of the GNU General Public License as published by the Free Software
|
||||||
* Foundation, either version 3 of the License, or (at your option) any later
|
* Foundation, either version 3 of the License, or (at your option) any later
|
||||||
* version.
|
* version.
|
||||||
*
|
*
|
||||||
* libgim is distributed in the hope that it will be useful, but WITHOUT ANY
|
* libgim is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
* details.
|
* details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with libgim. If not, see <http://www.gnu.org/licenses/>.
|
* along with libgim. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user