From 5df79c53745fde5d6c3340a2979b1429cd5892c1 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sat, 8 Oct 2011 20:30:28 +0200 Subject: Initial import of htcd system 1.0 Signed-off-by: Henrik Rydberg --- src/ops/comp.cc | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 src/ops/comp.cc (limited to 'src/ops/comp.cc') diff --git a/src/ops/comp.cc b/src/ops/comp.cc new file mode 100644 index 0000000..aa40246 --- /dev/null +++ b/src/ops/comp.cc @@ -0,0 +1,134 @@ +/************************************************************************* + * + * HTCd - Copyright (C) 1998-2006 Henrik Rydberg + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include + +OP2_IMPL(lt) {out<<(L=R);} +OP2_IMPL(gt) {out<<(L>R);} +OP2_IMPL(ltn) {out<<(L.compare(R,cset_lcase)<0);} +OP2_IMPL(len) {out<<(L.compare(R,cset_lcase)<=0);} +OP2_IMPL(gen) {out<<(L.compare(R,cset_lcase)>=0);} +OP2_IMPL(gtn) {out<<(L.compare(R,cset_lcase)>0);} +OP2_IMPL(ltnn) {out<<(nncomp(L,R)<0);} +OP2_IMPL(lenn) {out<<(nncomp(L,R)<=0);} +OP2_IMPL(genn) {out<<(nncomp(L,R)>=0);} +OP2_IMPL(gtnn) {out<<(nncomp(L,R)>0);} +OP2_IMPL(ltf) {out<<(atof(L)=atof(R));} +OP2_IMPL(gtf) {out<<(atof(L)>atof(R));} + +void opAddComp(opmap& M) +{ + OP_ADD(20,lt, + "Lexicographic less than\n" + "Syntax: (string) lt (string)\n" + "Returns: (int)\n" + ); + OP_ADD(20,le, + "Lexicographic less or equal\n" + "Syntax: (string) le (string)\n" + "Returns: (int)\n" + ); + OP_ADD(20,ge, + "Lexicographic greater or equal\n" + "Syntax: (string) ge (string)\n" + "Returns: (int)\n" + ); + OP_ADD(20,gt, + "Lexicographic greater than\n" + "Syntax: (string) gt (string)\n" + "Returns: (int)\n" + ); + + OP_ADD(20,ltn, + "Lexicographic less than, case insensitive\n" + "Syntax: (string) ltn (string)\n" + "Returns: (int)\n" + ); + OP_ADD(20,len, + "Lexicographic less or equal, case insensitive\n" + "Syntax: (string) len (string)\n" + "Returns: (int)\n" + ); + OP_ADD(20,gen, + "Lexicographic greater or equal, case insensitive\n" + "Syntax: (string) gen (string)\n" + "Returns: (int)\n" + ); + OP_ADD(20,gtn, + "Lexicographic greater than, case insensitive\n" + "Syntax: (string) gtn (string)\n" + "Returns: (int)\n" + ); + + OP_ADD(20,ltnn, + "Lexicographic less than, NN-style\n" + "Syntax: (string) ltnn (string)\n" + "Returns: (int)\n" + "\n" + "NN-style compares names as \n" + ); + OP_ADD(20,lenn, + "Lexicographic less or equal, NN-style\n" + "Syntax: (string) lenn (string)\n" + "Returns: (int)\n" + "\n" + "NN-style compares names as \n" + ); + OP_ADD(20,genn, + "Lexicographic greater or equal, NN-style\n" + "Syntax: (string) genn (string)\n" + "Returns: (int)\n" + "\n" + "NN-style compares names as \n" + ); + OP_ADD(20,gtnn, + "Lexicographic greater than, NN-style\n" + "Syntax: (string) gtnn (string)\n" + "Returns: (int)\n" + "\n" + "NN-style compares names as \n" + ); + + OP_ADDN(20,ltf,<, + "Arithmetic less than\n" + "Syntax: (real) < (real)\n" + "Returns: (int)\n" + ); + OP_ADDN(20,lef,<=, + "Arithmetic less or equal\n" + "Syntax: (real) <= (real)\n" + "Returns: (int)\n" + ); + OP_ADDN(20,gef,>=, + "Arithmetic greater or equal\n" + "Syntax: (real) >= (real)\n" + "Returns: (int)\n" + ); + OP_ADDN(20,gtf,>, + "Arithmetic greater than\n" + "Syntax: (real) > (real)\n" + "Returns: (int)\n" + ); + +} -- cgit v1.2.3