# include "data.h"

int accum            PROTO((int, char **));
int applyfit         PROTO((int, char **));
int applyfit2d       PROTO((int, char **));
int box              PROTO((int, char **));
int book_command     PROTO((int, char **));
int center           PROTO((int, char **));
int circstats        PROTO((int, char **));
int clear            PROTO((int, char **));
int clip             PROTO((int, char **));
int close_device     PROTO((int, char **));
int concat           PROTO((int, char **));
int contour          PROTO((int, char **));
int create           PROTO((int, char **));
int cumulative       PROTO((int, char **));
int cursor           PROTO((int, char **));
int cut              PROTO((int, char **));
int datafile         PROTO((int, char **));
int delete           PROTO((int, char **));
int device           PROTO((int, char **));
int dimendown        PROTO((int, char **));
int dimenup          PROTO((int, char **));
int erase            PROTO((int, char **));
int extract          PROTO((int, char **));
int fft1d            PROTO((int, char **));
int fft2d            PROTO((int, char **));
int fit2d            PROTO((int, char **));
int fit              PROTO((int, char **));
int gaussjordan      PROTO((int, char **));
int gaussdeviate     PROTO((int, char **));
int gaussintegral    PROTO((int, char **));
int grid             PROTO((int, char **));
int gridify          PROTO((int, char **));
int ungridify        PROTO((int, char **));
int histogram        PROTO((int, char **));
int imcut            PROTO((int, char **));
int imhist           PROTO((int, char **));
int imsmooth         PROTO((int, char **));
int integrate        PROTO((int, char **));
int interpolate      PROTO((int, char **));
int jpeg             PROTO((int, char **));
int kern             PROTO((int, char **));
int keyword          PROTO((int, char **));
int labels           PROTO((int, char **));
int limits           PROTO((int, char **));
int line             PROTO((int, char **));
int list_buffers     PROTO((int, char **));
int header           PROTO((int, char **));
int list_vectors     PROTO((int, char **));
int load             PROTO((int, char **));
int lookup           PROTO((int, char **));
int mkrgb            PROTO((int, char **));
int mcreate          PROTO((int, char **));
int medacc           PROTO((int, char **));
int mget             PROTO((int, char **));
int minterp          PROTO((int, char **));
int mset             PROTO((int, char **));
int peak             PROTO((int, char **));
int periodogram      PROTO((int, char **));
int plot             PROTO((int, char **));
int dot              PROTO((int, char **));
int point            PROTO((int, char **));
int ps               PROTO((int, char **));
int queuelist        PROTO((int, char **));
int queueload        PROTO((int, char **));
int queueinit        PROTO((int, char **));
int queuedelete      PROTO((int, char **));
int queuedrop        PROTO((int, char **));
int queuepop         PROTO((int, char **));
int queueprint       PROTO((int, char **));
int queuepush        PROTO((int, char **));
int queuesize        PROTO((int, char **));
int rd               PROTO((int, char **));
int rdseg            PROTO((int, char **));
int read_vectors     PROTO((int, char **));
int rebin            PROTO((int, char **));
int resize           PROTO((int, char **));
int roll             PROTO((int, char **));
int rotate           PROTO((int, char **));
int save             PROTO((int, char **));
int section          PROTO((int, char **));
int set              PROTO((int, char **));
int shift            PROTO((int, char **));
int sort_vectors     PROTO((int, char **));
int spline_apply     PROTO((int, char **));
int spline_construct PROTO((int, char **));
int stats            PROTO((int, char **));
int style            PROTO((int, char **));
int subraster        PROTO((int, char **));
int subset           PROTO((int, char **));
int svd              PROTO((int, char **));
int swapbytes        PROTO((int, char **));
int textline         PROTO((int, char **));
int tv               PROTO((int, char **));
int tvcontour        PROTO((int, char **));
int tvgrid           PROTO((int, char **));
int uniq             PROTO((int, char **));
int unsign           PROTO((int, char **));
int vbin             PROTO((int, char **));
int vclip            PROTO((int, char **));
int vect_select      PROTO((int, char **));
int vgrid            PROTO((int, char **));
int vgauss           PROTO((int, char **));
int vmaxwell         PROTO((int, char **));
int vload            PROTO((int, char **));
int vstat            PROTO((int, char **));
int vroll            PROTO((int, char **));
int vpop             PROTO((int, char **));
int vsmooth          PROTO((int, char **));
int wd               PROTO((int, char **));
int write_vectors    PROTO((int, char **));
int zap              PROTO((int, char **));
int zplot            PROTO((int, char **));

static Command cmds[] = {  
  {"accum",        accum,	     "accumulate vector values in another vector"},
  {"applyfit",     applyfit,	     "apply fit to new vector"},
  {"applyfit2d",   applyfit2d,	     "apply 2-d fit to new vector"},
  {"box",     	   box,		     "draw a box on the plot"},
  {"book",    	   book_command,     "commands to manipulate book/page/word data"},
  {"center",       center,	     "center image on coords"},
  {"circstats",    circstats,	     "circular statistics"},
  {"clear",   	   clear,	     "erase plot"},
  {"clip",         clip,	     "clip values in a buffer to be within a range"},
  {"close",        close_device,     "close the current display device"},
  {"concat",  	   concat,	     "reduce vector dimension"},
  {"contour", 	   contour,	     "create contour from image"},
  {"create",  	   create,	     "create a new vector"},
  {"cumulative",   cumulative,	     "build a cumulative histogram from a specific histogram"},
  {"cursor",  	   cursor,	     "get coords from cursor"},
  {"cut",	   cut,		     "extract a cut across an image"},
  {"datafile",     datafile,	     "define file to read vectors"},
  {"delete",  	   delete,	     "delete vectors or matrices"},
  {"device",  	   device,	     "set / get current graphics device"},
  {"dimendown",	   dimendown,	     "convert matrix to vector"},
  {"dimenup",	   dimenup,	     "convert vector to matrix"},
  {"erase",        erase,	     "erase objects on an overlay"},
  {"extract",      extract,	     "extract a portion of a buffer into another buffer"},
  {"fft1d",        fft1d,	     "fft on the pixel-stream in an image"},
  {"fft2d",        fft2d,	     "fft on an image"},
  {"fit",     	   fit,		     "fit polynomial to vector pair"},
  {"fit2d",        fit2d,	     "fit 2-d polynomial to vector triplet"},
  {"gaussj",  	   gaussjordan,	     "solve Ax = B (N-D)"},
  {"gaussdev",	   gaussdeviate,     "generate a gaussian deviate vector"},
  {"gaussint",	   gaussintegral,    "return the integrated gaussian vector"},
  {"grid",    	   grid,	     "plot cartesian grid"},
  {"gridify",      gridify,	     "convert vector triplet to buffer"},
  {"ungridify",    ungridify,        "convert buffer region to vector triplet"},
  {"header",       header,	     "print buffer header"},
  {"histogram",    histogram,	     "generate histogram from vector"},
  {"imcut",        imcut,	     "linear image cut between arbitrary coords"},
  {"imhist",       imhist,	     "histogram of an image region"},
  {"imsmooth",     imsmooth,	     "circular gaussian smoothing"},
  {"integrate",    integrate,	     "integrate a vector"},
  {"interpolate",  interpolate,	     "interpolate between vector pairs"},
  {"jpeg",         jpeg,	     "write text line on graph"},
  {"png",          jpeg,	     "write text line on graph"},
  {"ppm",          jpeg,	     "write text line on graph"},
  {"kern",         kern,	     "convolve with 3x3 kernel"},
  {"keyword",      keyword,	     "extract a FITS keyword from buffer header"},
  {"labels",  	   labels,	     "define labels for plot"},
  {"limits",  	   limits,	     "define plot limits"},
  {"line",         line,	     "plot line"},
  {"buffers",      list_buffers,     "list the currently allocated buffers"},
  {"vectors", 	   list_vectors,     "list vectors"},
  {"load",         load,	     "load an SAOimage style overlay"},
  {"lookup",       lookup,	     "convert vector via lookup table (vector pair)"},
  {"mkrgb", 	   mkrgb,	     "convert 3 images to rgb jpeg"},
  {"mcreate", 	   mcreate,	     "create a matrix"},
  {"medacc",       medacc,	     "accumulate vector values in another vector"},
  {"mget",    	   mget,	     "extract a vector from a matrix"},
  {"minterp",      minterp,	     "interpolate image pixels"},
  {"mset",    	   mset,	     "insert a vector in a matrix"},
  {"peak",	   peak,	     "find vector peak in range"},
  {"periodogram",  periodogram,	     "measure periods in unevenly sampled data"},
  {"plot",    	   plot,	     "plot a pair of vectors"},
  {"dot",    	   dot,	             "plot a single point"},
  {"point",	   point,	     "load overlay with single point"},
  {"ps",      	   ps,		     "define labels for plot"},
  {"queuepop", 	   queuepop,	     "pop value from queue to variable"},
  {"queuedrop",    queuedrop,	     "drop values from queue matching a key"},
  {"queueprint",   queueprint,	     "print the contents of a queue"},
  {"queuepush",	   queuepush,	     "push value onto queue"},
  {"queueinit",	   queueinit,	     "create an empty queue"},
  {"queuedelete",  queuedelete,	     "delete a queue"},
  {"queuelist",	   queuelist,	     "list defined queues"},
  {"queueload",	   queueload,	     "load queue from command"},
  {"queuesize",    queuesize,	     "show queue size"},
  {"rd",           rd,		     "load fits image"},
  {"rdseg",	   rdseg,	     "read a segment of an image from a file"},
  {"read",         read_vectors,     "read vectors from datafile"},
  {"rebin",	   rebin,	     "rebin data by factor of N"},
  {"resize",  	   resize,	     "set graphics/image window size"},
  {"roll",	   roll,	     "roll image to new start point"},
  {"rotate",	   rotate,	     "rotate image"},
  {"save",	   save,	     "save an SAOimage style overlay"},
  {"section", 	   section,	     "define section of graph"},
  {"set",     	   set,		     "vector math"},
  {"shift",	   shift,	     "shift data in an image"},
  {"sort",    	   sort_vectors,     "sort list of vectors"},
  {"spline.apply", spline_apply,     "apply spline fit to generate an image"},
  {"spline.const", spline_construct, "create spline 2nd deriv. terms"},
  {"stats",   	   stats,	     "give statistics on a portion of a buffer"},
  {"style",   	   style,	     "set the style for graph plots"},
  {"subraster",    subraster,	     "subraster of fits image"},
  {"subset",  	   subset,	     "expand vector dimension"},
  {"svd",	   svd,		     "singular value decomposition of a matrix"},
  {"swapbytes",	   swapbytes,        "byte swap thing"},
  {"textline",     textline,	     "write text line on graph"},
  {"tv",      	   tv,		     "display an image on the Kii window"},
  {"tvcontour",	   tvcontour,	     "send contour to overlay"},
  {"tvgrid",	   tvgrid,	     "wait until return is typed"},
  {"uniq",    	   uniq,	     "create a uniq vector subset from a vector"},
  {"unsign",	   unsign,	     "toggle the UNSIGN status"},
  {"vbin",	   vbin,	     "bin values in a vector to be within a range"},
  {"vclip",	   vclip,	     "clip values in a vector to be within a range"},
  {"select",	   vect_select,	     "selective vector assignment"},
  {"vgauss",       vgauss,	     ""},
  {"vmaxwell",     vmaxwell,	     ""},
  {"vgrid",        vgrid,	     ""},
  {"vload",        vload,	     "load vectors on Kii"},
  {"vstat",        vstat,	     "get info from imreg database"},
  {"vsmooth",      vsmooth,	     "gaussian smooth of a vector"},
  {"vroll",        vroll,	     "roll vector elements"},
  {"vpop",         vpop, 	     "remove first element"},
  {"wd",      	   wd,		     "write an image to a file"},
  {"write",   	   write_vectors,    "write vectors to datafile"},
  {"zap",     	   zap,		     "delete pixels"},
  {"zplot",   	   zplot,	     "plot x y with size scaled by z"},
}; 

void InitData () {
  
  int i;

  InitGraph ();
  InitImage ();
  InitQueues ();

  for (i = 0; i < sizeof (cmds) / sizeof (Command); i++) {
    AddCommand (&cmds[i]);
  }

}
