IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 16, 2020, 2:04:27 PM (6 years ago)
Author:
tdeboer
Message:

quick undo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/spline_commands.c

    r41340 r41341  
    2828  if (xvec->Nelements != yvec->Nelements) {
    2929    gprint (GP_ERR, "x and y vectors must be the same length\n");
     30    return FALSE;
     31  }
     32
     33  if (xvec->Nelements < 3) {
     34    gprint (GP_ERR, "cannot make a spline with fewer than 3 knots\n");
    3035    return FALSE;
    3136  }
     
    9398}
    9499
     100int spline_print (int argc, char **argv) {
     101
     102  int i;
     103
     104  if (argc != 2) {
     105    gprint (GP_ERR, "USAGE: spline print (name)\n");
     106    return FALSE;
     107  }
     108
     109  Spline *myspline = FindSpline (argv[1]);
     110  if (!myspline) {
     111    gprint (GP_ERR, "spline %s not found\n", argv[1]);
     112    return (FALSE);
     113  }
     114
     115  for (i = 0; i < myspline->Nknots; i++) {
     116    gprint (GP_LOG, "%lf : %lf : %lf\n", myspline->xk[i], myspline->yk[i], myspline->y2[i]);
     117  }   
     118
     119  return TRUE;
     120}
     121
    95122int spline_load (int argc, char **argv) {
    96123
     
    109136int spline_delete (int argc, char **argv) {
    110137
    111   int status;
    112   Spline *spline;
     138  int N, status;
     139
     140  int QUIET = FALSE;
     141  if ((N = get_argument (argc, argv, "-q"))) {
     142    QUIET = TRUE;
     143    remove_argument (N, &argc, argv);
     144  }
    113145
    114146  if (argc != 2) {
     
    117149  }
    118150
    119   spline = FindSpline (argv[1]);
     151  Spline *spline = FindSpline (argv[1]);
    120152  if (spline == NULL) {
     153    if (QUIET) return TRUE;
    121154    gprint (GP_ERR, "spline %s not found\n", argv[1]);
    122155    return FALSE;
     
    130163int spline_rename (int argc, char **argv) {
    131164
    132   Spline *spline;
    133 
    134165  if (argc != 3) {
    135166    gprint (GP_ERR, "USAGE: spline rename (spline) (newname)\n");
     
    137168  }
    138169
    139   spline = FindSpline (argv[1]);
     170  Spline *spline = FindSpline (argv[1]);
    140171  if (spline == NULL) {
    141172    gprint (GP_ERR, "spline %s not found\n", argv[1]);
    142173    return FALSE;
     174  }
     175
     176  Spline *newname = FindSpline (argv[2]);
     177  if (newname != NULL) {
     178    DeleteSpline (newname);
    143179  }
    144180
     
    147183  return TRUE;
    148184}
    149 
    150 /*
    151 int spline_listspline (int argc, char **argv) {
    152 
    153   Spline *spline;
    154 
    155   if (argc != 2) {
    156     gprint (GP_ERR, "USAGE: spline listspline (spline)\n");
    157     return FALSE;
    158   }
    159 
    160   spline = FindSpline (argv[1]);
    161   if (spline == NULL) {
    162     gprint (GP_ERR, "spline %s not found\n", argv[1]);
    163     return FALSE;
    164   }
    165 
    166   ListPages (spline);
    167   return TRUE;
    168 }
    169 */
    170 
Note: See TracChangeset for help on using the changeset viewer.