<commit_before>/*
  teem: <NAME>'s research software
  Copyright (C) 2002, 2001, 2000, 1999, 1998 University of Utah

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library 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
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#include "unrrdu.h"
#include "privateUnrrdu.h"

#define INFO "Binary operation on two nrrds, or on a nrrd and a constant"
char *_unrrdu_2opInfoL =
(INFO
 ". Either the first or second operand can be a float, "
 "but not both.  Use \"-\" for an operand to signify "
 "a nrrd to be read from stdin (a pipe).  Note, however, "
 "that \"-\" can probably only be used once (reliably).");

int
unrrdu_2opMain(int argc, char **argv, char *me, hestParm *hparm) {
  hestOpt *opt = NULL;
  char *out, *err;
  NrrdIter *in1, *in2;
  Nrrd *nout, *ntmp=NULL;
  int op, type, E, pret;
  airArray *mop;

  hestOptAdd(&opt, NULL, "operator", airTypeEnum, 1, 1, &op, NULL,
	     "Binary operator. Possibilities include:\n "
	     "\b\bo \"+\", \"-\", \"x\", \"/\": "
	     "add, subtract, multiply, divide\n "
	     "\b\bo \"^\": exponentiation\n "
	     "\b\bo \"%\": integer modulo\n "
	     "\b\bo \"fmod\": same as fmod() in C\n "
	     "\b\bo \"atan2\": same as atan2() in C\n "
	     "\b\bo \"min\", \"max\": minimum, maximum\n "
	     "\b\bo \"lt\": 1 if 1st value less than 2nd value, otherwise 0\n "
	     "\b\bo \"comp\": -1, 0, or 1 if 1st value is less than,"
             "equal to, or greater than 2nd value",
	     NULL, nrrdBinaryOp);
  hestOptAdd(&opt, NULL, "in1", airTypeOther, 1, 1, &in1, NULL,
	     "First input.  Can be float or nrrd.",
	     NULL, NULL, nrrdHestIter);
  hestOptAdd(&opt, NULL, "in2", airTypeOther, 1, 1, &in2, NULL,
	     "Second input.  Can be float or nrrd.",
	     NULL, NULL, nrrdHestIter);
  hestOptAdd(&opt, "t", "type", airTypeOther, 1, 1, &type, "unknown",
	     "type to convert all nrrd inputs to, prior to "
	     "doing operation.  This also determines output type. "<commit_msg>more binary operations<commit_after>/*
  teem: <NAME>'s research software
  Copyright (C) 2002, 2001, 2000, 1999, 1998 University of Utah

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library 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
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#include "unrrdu.h"
#include "privateUnrrdu.h"

#define INFO "Binary operation on two nrrds, or on a nrrd and a constant"
char *_unrrdu_2opInfoL =
(INFO
 ". Either the first or second operand can be a float constant, "
 "but not both.  Use \"-\" for an operand to signify "
 "a nrrd to be read from stdin (a pipe).  Note, however, "
 "that \"-\" can probably only be used once (reliably).");

int
unrrdu_2opMain(int argc, char **argv, char *me, hestParm *hparm) {
  hestOpt *opt = NULL;
  char *out, *err;
  NrrdIter *in1, *in2;
  Nrrd *nout, *ntmp=NULL;
  int op, type, E, pret;
  airArray *mop;

  hestOptAdd(&opt, NULL, "operator", airTypeEnum, 1, 1, &op, NULL,
	     "Binary operator. Possibilities include:\n "
	     "\b\bo \"+\", \"-\", \"x\", \"/\": "
	     "add, subtract, multiply, divide\n "
	     "\b\bo \"^\": exponentiation\n "
	     "\b\bo \"%\": integer modulo\n "
	     "\b\bo \"fmod\": same as fmod() in C\n "
	     "\b\bo \"atan2\": same as atan2() in C\n "
	     "\b\bo \"min\", \"max\": minimum, maximum\n "
	     "\b\bo \"lt\", \"lte\", \"gt\", \"gte\": same as C's <, <=, >, <=\n "
	     "\b\bo \"eq\", \"neq\": same as C's == and !=\n "
	     "\b\bo \"comp\": -1, 0, or 1 if 1st value is less than, "
             "equal to, or greater than 2nd value",
	     NULL, nrrdBinaryOp);
  hestOptAdd(&opt, NULL, "in1", airTypeOther, 1, 1, &in1, NULL,
	     "First input.  Can be float or nrrd.",
	     NULL, NULL, nrrdHestIter);
  hestOptAdd(&opt, NULL, "in2", airTypeOther, 1, 1, &in2, NULL,
	     "Second input.  Can be float or nrrd.",
	     NULL, NULL, nrrdHestIter);
  hestOptAdd(&opt, "t", "type", airTypeOther, 1, 1, &type, "unknown",
	     "type to convert all nrrd inputs to, prior to "
	     "doing operation.  This also determines output type. "
{'fraction_non_alphanumeric': 0.1347708894878706, 'fraction_numerical': 0.023488640739314594, 'mean_word_length': 2.9717125382262997, 'pattern_counts': {'":': 17, '<': 8, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7273101', 'n_tokens_mistral': 1863, 'n_tokens_neox': 1716, 'n_words': 714}