From 83cdf0dc15f5bbf378220d39cd8c35c7e20d1f0b Mon Sep 17 00:00:00 2001 From: David Date: Tue, 13 Dec 2016 15:17:41 -0600 Subject: [PATCH] added the ability to identify arguments as numbers --- stim/math/filters/conv2.h | 2 +- stim/parser/arguments.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/stim/math/filters/conv2.h b/stim/math/filters/conv2.h index e34ea61..94e9f02 100644 --- a/stim/math/filters/conv2.h +++ b/stim/math/filters/conv2.h @@ -46,7 +46,7 @@ namespace stim { } //Performs a convolution of a 2D image using the GPU. All pointers are assumed to be to memory on the current device. - //@param out is a pointer to the output image + //@param out is a pointer to the output image, which is of size (sx - kx + 1) x (sy - ky + 1) //@param in is a pointer to the input image //@param sx is the size of the input image along X //@param sy is the size of the input image along Y diff --git a/stim/parser/arguments.h b/stim/parser/arguments.h index 23ee732..bd61cfc 100644 --- a/stim/parser/arguments.h +++ b/stim/parser/arguments.h @@ -205,6 +205,20 @@ namespace stim{ else return 0; } + //returns true if the specified argument can be represented as a number + bool is_num(size_t n = 0){ + bool decimal = false; + for(size_t i = 0; i < vals[n].size(); i++){ + if(vals[n][i] == '-' && i != 0) return false; + else if(vals[n][i] == '.'){ + if(decimal) return false; + else decimal = true; + } + else if(vals[n][i] < '0') return false; + else if(vals[n][i] > '9') return false; + } + return true; + } //get the width of the left column size_t col_width() -- libgit2 0.21.4