IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35761 for trunk/Ohana


Ignore:
Timestamp:
Jul 3, 2013, 2:16:41 PM (13 years ago)
Author:
eugene
Message:

deprecate KiiOpen, KiiClose, KiiWait

Location:
trunk/Ohana/src/libkapa
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libkapa/Makefile

    r16093 r35761  
    2424$(SRC)/IOfuncs.$(ARCH).o  \
    2525$(SRC)/KiiPicture.$(ARCH).o \
    26 $(SRC)/KiiOpen.$(ARCH).o \
    2726$(SRC)/KiiOverlay.$(ARCH).o \
    2827$(SRC)/KiiCursor.$(ARCH).o \
     
    3130$(SRC)/KapaColors.$(ARCH).o \
    3231$(SRC)/KapaOpen.$(ARCH).o
     32
     33# deprecated:
     34# $(SRC)/KiiOpen.$(ARCH).o
    3335
    3436DRAW = \
  • trunk/Ohana/src/libkapa/include/kapa.h

    r31647 r35761  
    142142char *KiiRecvData (int device);
    143143int KiiWaitAnswer (int device, char *expect);
    144 
    145 /* KiiOpen.c */
    146 int KiiOpen (char *kii_exec, char *name);
    147 int KiiClose (int socket);
    148 int KiiWait (char *sockpath);
    149144
    150145/* KiiPicture.c */
     
    271266int KapaOpenNamedSocket (char *kapa_exec, char *name);
    272267int KapaWaitNamedSocket (char *sockpath);
     268int KapaClose (int socket);
    273269
    274270/* define Kapa names for shared functions */
     
    281277# define KapaPS(fd,s,r,f) KiiPS(fd,s,r,f)
    282278
    283 # define KapaClose(socket) KiiClose(socket)
     279// deprecated
     280// # define KapaClose(socket) KiiClose(socket)
    284281# define KapaWait(sockpath) KiiWait(sockpath)
    285282# define KapaSendCommandV(device, length, format, argp) KiiSendCommandV(device, length, format, argp)
  • trunk/Ohana/src/libkapa/src/IOfuncs.c

    r34582 r35761  
    3030  sscanf (buffer, "%*s %d", &Nbytes);
    3131  ALLOCATE (data, char, Nbytes + 1);
     32  memset (data, 0, Nbytes + 1);
     33
    3234  status = read (device, data, Nbytes);
    3335  if (status != Nbytes) {
     
    7880      // XXX BUT: I need to think a bit more about hand-shaking.
    7981  }
    80   if (DEBUG) fprintf (stderr, "recv buffer: %s\n", buffer);
     82  if (DEBUG) fprintf (stderr, "recv buffer: %s...\n", buffer);
    8183
    8284  /* find the message length, allocate space */
    8385  sscanf (buffer, "%*s %d", &Nbytes);
    8486  ALLOCATE (message, char, Nbytes + 1);
     87  memset (message, 0, Nbytes + 1);
    8588
    8689  /* read Nbytes from the device */
     
    9295  /* make the string easy to parse */
    9396
    94   if (DEBUG) fprintf (stderr, "recv: %s\n", message);
     97  if (DEBUG) fprintf (stderr, "recv: %s...\n", message);
    9598
    9699  /* scan the incoming message */
     
    131134  if (Nwrite != length) return (FALSE);
    132135
    133   if (DEBUG) fprintf (stderr, "send: %s\n", string);
     136  if (DEBUG) fprintf (stderr, "send: %s...\n", string);
    134137
    135138  free (string);
     
    145148
    146149  ALLOCATE (message, char, length + 1);
     150  memset (message, 0, length + 1);
    147151
    148152  /* read Nbytes from the device */
    149153  status = read (device, message, length);
    150   if (DEBUG) fprintf (stderr, "recv message: %s\n", message);
     154  if (DEBUG) fprintf (stderr, "recv message: %s...\n", message);
    151155
    152156  if (status != length) {
     
    173177  Nbytes = strlen (expect);
    174178  ALLOCATE (answer, char, Nbytes + 1);
     179  memset (answer, 0, Nbytes + 1);
    175180
    176181  KiiScanCommand (device, Nbytes, "%s", answer);
  • trunk/Ohana/src/libkapa/src/KapaOpen.c

    r35416 r35761  
    430430  return (pid);
    431431}
     432
     433int KapaClose (int fd) {
     434
     435  if (fd < 1) return (FALSE);
     436  KiiSendCommand (fd, 4, "QUIT");
     437  close (fd);
     438  return (TRUE);
     439}
  • trunk/Ohana/src/libkapa/src/KapaWindow.c

    r29938 r35761  
    2222
    2323  KiiSendCommand (fd, 4, "RSIZ");
    24   KiiSendMessage (fd, "%d %d", Nx, Ny);
     24  KiiSendMessage (fd, "%d %d ", Nx, Ny);
    2525  KiiWaitAnswer (fd, "DONE");
    2626  return (TRUE);
     
    3737
    3838  KiiSendCommand (fd, 4, "MOVE");
    39   KiiSendMessage (fd, "%d %d", x, y);
     39  KiiSendMessage (fd, "%d %d ", x, y);
    4040  KiiWaitAnswer (fd, "DONE");
    4141  return (TRUE);
     
    8383 
    8484  KiiSendCommand (fd, 4, "TOOL");
    85   KiiSendMessage (fd, "%d", location);
     85  KiiSendMessage (fd, "%d ", location);
    8686  KiiWaitAnswer (fd, "DONE");
    8787  return (TRUE);
     
    134134 
    135135  /* send kapa the plot details */
    136   KiiSendMessage (fd, "%8d %8d %d %d %d %d %d %f %f",
     136  KiiSendMessage (fd, "%8d %8d %d %d %d %d %d %f %f ",
    137137                  Npts, data[0].style,
    138138                  data[0].ptype, data[0].ltype,
    139139                  data[0].etype, data[0].ebar, data[0].color,
    140140                  data[0].lweight, data[0].size);
    141   KiiSendMessage (fd, "%g %g %g %g",
     141  KiiSendMessage (fd, "%g %g %g %g ",
    142142                  data[0].xmin, data[0].xmax,
    143143                  data[0].ymin, data[0].ymax);
     
    149149
    150150  /* send kapa the plot details */
    151   KiiSendMessage (fd, "%g %g %g %g",
     151  KiiSendMessage (fd, "%g %g %g %g ",
    152152                  data[0].xmin, data[0].xmax,
    153153                  data[0].ymin, data[0].ymax);
    154154
    155   KiiSendMessage (fd, "%8d %d %d %d %d %d %f %f",
     155  KiiSendMessage (fd, "%8d %d %d %d %d %d %f %f ",
    156156                  data[0].style,
    157157                  data[0].ptype, data[0].ltype,
     
    159159                  data[0].lweight, data[0].size);
    160160
    161   KiiSendMessage (fd, "%g %g %g %g %g",
     161  KiiSendMessage (fd, "%g %g %g %g %g ",
    162162                  data[0].ticktextPad,
    163163                  data[0].padXm, data[0].padXp,
    164164                  data[0].padYm, data[0].padYp);
    165165
    166   KiiSendMessage (fd, "%g %g %g %g",
     166  KiiSendMessage (fd, "%g %g %g %g ",
    167167                  data[0].labelPadXm, data[0].labelPadXp,
    168168                  data[0].labelPadYm, data[0].labelPadYp);
    169169
    170   KiiSendMessage (fd, "%g %g %g %g",
     170  KiiSendMessage (fd, "%g %g %g %g ",
    171171                  data[0].coords.pc1_1, data[0].coords.pc2_2,
    172172                  data[0].coords.pc1_2, data[0].coords.pc2_1);
    173173
    174   KiiSendMessage (fd, "%d %d %s",
     174  KiiSendMessage (fd, "%d %d %s ",
    175175                  data[0].flipeast, data[0].flipnorth,
    176176                  data[0].coords.ctype);
    177177
    178   KiiSendMessage (fd, "%g %g %g %g %g %g",
     178  KiiSendMessage (fd, "%g %g %g %g %g %g ",
    179179                  data[0].coords.crval1,
    180180                  data[0].coords.crval2,
     
    184184                  data[0].coords.cdelt2);
    185185
    186   KiiSendMessage (fd, "%s %s %s", data[0].axis, data[0].ticks, data[0].labels);
     186  KiiSendMessage (fd, "%s %s %s ", data[0].axis, data[0].ticks, data[0].labels);
    187187
    188188  return (TRUE);
     
    265265 
    266266  /* send kapa the plot details */
    267   KiiSendMessage (fd, "%g %g %s %s",
     267  KiiSendMessage (fd, "%g %g %s %s ",
    268268                  data[0].zero, data[0].range, data[0].name, data[0].file);
    269269
     
    308308valid:
    309309  KiiSendCommand (fd, 4, "PLOB");
    310   KiiSendMessage (fd, "%s %d %d %d", type, Npts, Nbytes, swap);
     310  KiiSendMessage (fd, "%s %d %d %d ", type, Npts, Nbytes, swap);
    311311
    312312  Nwrite = write (fd, values, Nbytes);
     
    322322
    323323  KiiSendCommand (fd, 4, "FONT");
    324   KiiSendCommand (fd, 16, "%s", name);
    325   KiiSendCommand (fd, 16, "%d", size);
     324  KiiSendCommand (fd, 16, "%s ", name);
     325  KiiSendCommand (fd, 16, "%d ", size);
    326326  KiiWaitAnswer (fd, "DONE");
    327327  return (TRUE);
     
    331331
    332332  KiiSendCommand (fd, 4, "LABL");
    333   KiiSendMessage (fd, "%6d", mode);
     333  KiiSendMessage (fd, "%6d ", mode);
    334334  KiiSendData (fd, string, strlen(string));
    335335  KiiWaitAnswer (fd, "DONE");
     
    340340 
    341341  KiiSendCommand (fd, 4, "PTXT");
    342   KiiSendMessage (fd, "%f %f %f", x, y, angle);
     342  KiiSendMessage (fd, "%f %f %f ", x, y, angle);
    343343  KiiSendData (fd, string, strlen(string));
    344344  KiiWaitAnswer (fd, "DONE");
     
    366366
    367367  KiiSendCommand (fd, 4, "DSEC");
    368   KiiSendMessage (fd, "%s %6.3f %6.3f %6.3f %6.3f %3d",
     368  KiiSendMessage (fd, "%s %6.3f %6.3f %6.3f %6.3f %3d ",
    369369                  section[0].name,
    370370                  section[0].x,
     
    380380
    381381  KiiSendCommand (fd, 4, "ISEC");
    382   KiiSendMessage (fd, "%s %6.3f %6.3f %3d",
     382  KiiSendMessage (fd, "%s %6.3f %6.3f %3d ",
    383383                  section[0].name,
    384384                  section[0].x,
     
    392392
    393393  KiiSendCommand (fd, 4, "BSEC");
    394   KiiSendMessage (fd, "%s %3d", name, bg);
     394  KiiSendMessage (fd, "%s %3d ", name, bg);
    395395  KiiWaitAnswer (fd, "DONE");
    396396  return (TRUE);
     
    409409valid:
    410410  KiiSendCommand (fd, 4, "MSEC");
    411   KiiSendMessage (fd, "%s %s", name, direction);
     411  KiiSendMessage (fd, "%s %s ", name, direction);
    412412  KiiWaitAnswer (fd, "DONE");
    413413  return (TRUE);
     
    417417
    418418  KiiSendCommand (fd, 4, "SSEC");
    419   KiiSendMessage (fd, "%s", name);
     419  KiiSendMessage (fd, "%s ", name);
    420420  KiiWaitAnswer (fd, "DONE");
    421421  return (TRUE);
     
    425425
    426426  KiiSendCommand (fd, 4, "LSEC");
    427   KiiSendMessage (fd, "%s", name);
    428   KiiWaitAnswer (fd, "DONE");
    429   return (TRUE);
    430 }
     427  KiiSendMessage (fd, "%s ", name);
     428  KiiWaitAnswer (fd, "DONE");
     429  return (TRUE);
     430}
Note: See TracChangeset for help on using the changeset viewer.