IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13344


Ignore:
Timestamp:
May 10, 2007, 5:24:58 PM (19 years ago)
Author:
eugene
Message:

converting to kapa2 support: INET socket connections, single device type

Files:
2 added
41 edited

Legend:

Unmodified
Added
Removed
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/include/globals.h

    r13333 r13344  
    1515
    1616/* file descriptor for socket connection to mana */
    17 int sock;
     17// int sock;
    1818
    1919/* each layout / section defines one of the active portions of the graphics window
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/include/prototypes.h

    r13333 r13344  
    3939
    4040/* EventLoop */
    41 int           PScommand           PROTO(());
     41int           PScommand           PROTO((int sock));
    4242int           CheckPipe           PROTO(());
    4343int           Reconfig            PROTO((XEvent *event));
     
    4545
    4646/* CheckPipe */
    47 int           PNGit               PROTO(());
    48 int           PPMit               PROTO(());
    49 int           LoadFrame           PROTO(());
    50 int           LoadObject          PROTO(());
    51 int           LoadLabels          PROTO(());
    52 int           LoadTextlines       PROTO(());
    53 int           LoadVectorData      PROTO(());
    54 int           Resize              PROTO(());
    55 int           GetLimits           PROTO(());
    56 int           SetLimits           PROTO(());
    57 int           SetSection          PROTO(());
    58 int           ListSection         PROTO(());
    59 int           DefineSection       PROTO(());
    60 int           SetFont             PROTO(());
    61 int           EraseCurrentPlot    PROTO(());
    62 int           ErasePlots          PROTO(());
    63 int           EraseSections       PROTO(());
     47int           PNGit               PROTO((int sock));
     48int           PPMit               PROTO((int sock));
     49int           LoadFrame           PROTO((int sock));
     50int           LoadObject          PROTO((int sock));
     51int           LoadLabels          PROTO((int sock));
     52int           LoadTextlines       PROTO((int sock));
     53int           Resize              PROTO((int sock));
     54int           GetLimits           PROTO((int sock));
     55int           SetLimits           PROTO((int sock));
     56int           SetSection          PROTO((int sock));
     57int           ListSection         PROTO((int sock));
     58int           DefineSection       PROTO((int sock));
     59int           SetFont             PROTO((int sock));
     60int           EraseCurrentPlot    PROTO((void));
     61int           ErasePlots          PROTO((void));
     62int           EraseSections       PROTO((void));
     63
     64int           LoadVectorData      PROTO((int sock, KapaGraphWidget *graph, int N, char *type));
    6465
    6566/* Section Utilities */
     
    7475Section      *GetActiveSection    PROTO(());
    7576int           SetActiveSectionByNumber PROTO((int N));
    76 int           ListSection         PROTO(());
     77int           ListSection         PROTO((int sock));
    7778
    7879KapaGraphWidget *InitGraph        PROTO(());
    7980void          DrawGraph           PROTO((KapaGraphWidget *graph));
    8081void          SetGraphSize        PROTO((Section *section));
     82void          FreeGraph           PROTO((KapaGraphWidget *graph));
    8183
    8284void          InitLayout          PROTO((int argc, char **argv));
     
    124126void          QuitX               PROTO((Display *display, char *message));
    125127Graphic      *GetGraphic          PROTO(());
     128int           GetPixelCount       PROTO((int sock));
    126129
    127130int           Center              PROTO(());
     
    131134void          Remap24             PROTO((Graphic *graphic, KapaImageWidget *image, Matrix *matrix));
    132135void          Remap32             PROTO((Graphic *graphic, KapaImageWidget *image, Matrix *matrix));
    133 int           LoadPicture         PROTO(());
     136int           LoadPicture         PROTO((int sock));
     137
    134138KapaImageWidget *InitImage        PROTO(());
     139void          FreeImage           PROTO((KapaImageWidget *image));
    135140void          SetImageSize        PROTO((Section *section));
    136 int           GetPixelCount       PROTO(());
     141
    137142void          InitButtonSize      PROTO((Button *button, int width, int height, char *bitmap));
    138143void          InitButtonFunc      PROTO((Button *button, int (*function)()));
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/CSaveOverlay.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int CSaveOverlay () {
     3int CSaveOverlay (int sock) {
    44
    55  char filename[256];
     
    1010  KapaImageWidget *image;
    1111
     12  KiiScanMessage (sock, "%*s %d %s", &N, filename);
     13 
    1214  section = GetActiveSection();
    1315  image   = section->image;
     16  if (image == NULL) return (TRUE);
    1417
    15   KiiScanMessage (sock, "%*s %d %s", &N, filename);
    16  
    1718  f = fopen (filename, "w");
    1819  if (f == NULL) {
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Center.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int Center () {
     3int Center (int sock) {
    44
    55  int zoom;
     
    99  KapaImageWidget *image;
    1010
     11  KiiScanMessage (sock, "%lf %lf %d", &X,  &Y, &zoom);
     12
    1113  graphic = GetGraphic();
    1214  section = GetActiveSection();
    1315  image = section->image;
    14 
    15   KiiScanMessage (sock, "%lf %lf %d", &X,  &Y, &zoom);
     16  if (image == NULL) return (TRUE);
    1617
    1718  image[0].X = 0.5*image[0].matrix.Naxis[0] - X;
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/CheckPipe.c

    r13333 r13344  
    22# define STRCONST(A) ((int)(0x1000000*A[0] + 0x10000*A[1] + 0x100*A[2] + 0x1*A[3]))
    33
     4static KapaSockAddress Address;
     5static int InitSocket = -1;
     6static int sock = -1;
     7
     8// we can supply a port here, with only small changes
     9void InitPipe () {
     10  InitSocket = KapaServerInit (&Address);
     11  return;
     12}
     13
    414int CheckPipe () {
    515
    616  int status;
    717  char buffer[32];
     18
     19  // check if we have a valid connection. if not, see if we can get one
     20  if (sock == -1) {
     21    sock = KapaServerWait (InitSocket, &Address);
     22    if (sock == -1) return (TRUE);
     23  }
    824
    925  /***** read (4 byte) message word from socket ****/
     
    4763 
    4864  if (!strcmp (buffer, "PSIT")) {
    49     status = PScommand ();
     65    status = PScommand (sock);
    5066    write (sock, "DONE", 4);
    5167    return (status);
     
    5369 
    5470  if (!strcmp (buffer, "PNGF")) {
    55     status = PNGit ();
     71    status = PNGit (sock);
    5672    write (sock, "DONE", 4);
    5773    return (status);
     
    5975 
    6076  if (!strcmp (buffer, "PPMF")) {
    61     status = PPMit ();
     77    status = PPMit (sock);
    6278    write (sock, "DONE", 4);
    6379    return (status);
     
    6581 
    6682  if (!strcmp (buffer, "DBOX")) {
    67     status = LoadFrame ();
     83    status = LoadFrame (sock);
    6884    return (status);
    6985  }
    7086 
    7187  if (!strcmp (buffer, "PLOT")) {
    72     status = LoadObject ();
     88    status = LoadObject (sock);
    7389    return (status);
    7490  }
    7591 
    7692  if (!strcmp (buffer, "LABL")) {
    77     status = LoadLabels ();
     93    status = LoadLabels (sock);
    7894    return (TRUE);
    7995  }
    8096 
    8197  if (!strcmp (buffer, "PTXT")) {
    82     status = LoadTextlines ();
     98    status = LoadTextlines (sock);
    8399    return (TRUE);
    84100  }
    85101 
    86102  if (!strcmp (buffer, "RSIZ")) {
    87     status = Resize ();
     103    status = Resize (sock);
    88104    return (status);
    89105  }
    90106
    91107  if (!strcmp (buffer, "LIMS")) {
    92     GetLimits ();
     108    GetLimits (sock);
    93109    return (TRUE);
    94110  }
    95111 
    96112  if (!strcmp (buffer, "SLIM")) {
    97     status = SetLimits ();
     113    status = SetLimits (sock);
    98114    return (TRUE);
    99115  }
    100116 
    101117  if (!strcmp (buffer, "SSEC")) {
    102     status = SetSection ();
     118    status = SetSection (sock);
    103119    return (TRUE);
    104120  }
    105121 
    106122  if (!strcmp (buffer, "LSEC")) {
    107     status = ListSection ();
     123    status = ListSection (sock);
    108124    return (TRUE);
    109125  }
    110126 
    111127  if (!strcmp (buffer, "DSEC")) {
    112     status = DefineSection ();
     128    status = DefineSection (sock);
    113129    return (TRUE);
    114130  }
    115131 
    116132  if (!strcmp (buffer, "FONT")) {
    117     status = SetFont ();
     133    status = SetFont (sock);
    118134    return (TRUE);
    119135  }
     
    121137  /* Erase Section */
    122138  if (!strcmp (buffer, "ERSC")) {
    123     status = EraseCurrentPlot (TRUE);
     139    status = EraseCurrentPlot ();
    124140    return (status);
    125141  }
     
    127143  /* Erase Section */
    128144  if (!strcmp (buffer, "ERAS")) {
    129     status = ErasePlots (TRUE);
     145    status = ErasePlots ();
    130146    return (status);
    131147  }
     
    133149  /* Don't Erase Section */
    134150  if (!strcmp (buffer, "ERSS")) {
    135     status = EraseSections (FALSE);
     151    status = EraseSections ();
    136152    return (status);
    137153  }
     
    139155
    140156  if (!strcmp (buffer, "READ")) {
    141     status = LoadPicture ();
     157    status = LoadPicture (sock);
    142158    return (status);
    143159  }
     
    145161  // XXX duplicate Command word
    146162  if (!strcmp (buffer, "ERAS")) {
    147     status = EraseOverlay ();
     163    status = EraseOverlay (sock);
    148164    return (status);
    149165  }
    150166
    151167  if (!strcmp (buffer, "LOAD")) {
    152     status = LoadOverlay ();
     168    status = LoadOverlay (sock);
    153169    return (status);
    154170  }
    155171
    156172  if (!strcmp (buffer, "TICK")) {
    157     status = LoadTickmarks ();
     173    status = LoadTickmarks (sock);
    158174    return (status);
    159175  }
    160176
    161177  if (!strcmp (buffer, "SAVE")) {
    162     status = SaveOverlay ();
     178    status = SaveOverlay (sock);
    163179    return (status);
    164180  }
    165181
    166182  if (!strcmp (buffer, "CSVE")) {
    167     status = CSaveOverlay ();
     183    status = CSaveOverlay (sock);
    168184    return (status);
    169185  }
    170186
    171187  if (!strcmp (buffer, "JPEG")) {
    172     status = JPEGit24 ();
     188    status = JPEGit24 (sock);
    173189    write (sock, "DONE", 4);
    174190    return (status);
     
    176192
    177193  if (!strcmp (buffer, "CENT")) {
    178     status = Center ();
     194    status = Center (sock);
    179195    return (status);
    180196  }
    181197
    182198  if (!strcmp (buffer, "NPIX")) {
    183     GetPixelCount ();
     199    GetPixelCount (sock);
    184200    return (TRUE);
    185201  }
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/DefineSection.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int DefineSection () {
     3// define the section, but do not create a graph or image
     4int DefineSection (int sock) {
    45 
    56  int i, N, MoveSection;
     
    1516  if (N < 0) {
    1617    section = AddSection (name, x, y, dx, dy);
    17     section->graph = InitGraph ();
    1818    MoveSection = TRUE;
    1919  } else {
     
    3434  if (MoveSection) {
    3535    SetGraphSize (section);
     36    SetImageSize (section);
    3637    Refresh (1);
    3738  }
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/EraseCurrentPlot.c

    r13320 r13344  
    1111  section = GetActiveSection();
    1212  if (section->graph == NULL) return (TRUE);
     13
    1314  EraseGraph (section->graph);
    1415 
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/EraseOverlay.c

    r13331 r13344  
    11# include "Ximage.h"
    22
    3 int EraseOverlay () {
     3int EraseOverlay (int sock) {
    44
    55  char buffer[256];
     
    1212  section = GetActiveSection();
    1313  image = section->image;
     14  if (image == NULL) return (TRUE);
    1415
    1516  KiiScanCommand (sock, 16, "%*s %d", &N);
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/GetPixelCount.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int GetPixelCount () {
     3int GetPixelCount (int sock) {
    44 
    55  int i;
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Graphs.c

    r13320 r13344  
    100100  FREE (graph[0].objects);
    101101  FREE (graph[0].textline);
     102  free (graph);
    102103  return;
    103104}
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Image.c

    r13331 r13344  
    145145  FlushDisplay (graphic[0].display);
    146146}
     147
     148void FreeImage (KapaImageWidget *image) {
     149
     150  int i;
     151
     152  if (image == NULL) return;
     153
     154  for (i = 0; i < NOVERLAYS; i++) {
     155    free (image[0].overlay[i].objects);
     156  }
     157  free (image[0].matrix.buffer);
     158  free (image[0].picture.data);
     159  free (image[0].cmapbar.data);
     160  free (image[0].zoom.data);
     161
     162  free (image);
     163}
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/InterpretKeys.c

    r13333 r13344  
    5555    }
    5656    snprintf (line, 40, "%12s %12.6f %12.6f ", name, X, Y);
    57     write (sock, line, 40);
     57    // XXX need to do something different here
     58    // xxx write (sock, line, 40);
    5859  }
    5960
    6061skip_cursor:
     62  if (image == NULL) return (TRUE);
     63
    6164  // offset is in image pixels:
    6265  // 0.5 image pixels is 1 screen pixel for expand == +2
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/InterpretPresses.c

    r13333 r13344  
    3434    }
    3535    snprintf (line, 40, "%12s %12.6f %12.6f ", name, X, Y);
    36     write (sock, line, 40);
     36    // need to do something different here...
     37    // xxx write (sock, line, 40);
    3738  }
    3839
     
    4041  status = TRUE;
    4142  this_button = event[0].button;
     43
     44  // XXX add graph buttons here
     45  if (image == NULL) return (TRUE);
    4246 
    4347  if ((event[0].type == ButtonPress) && InPicture (event, &image[0].picture)) {
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/JPEGit24.c

    r13320 r13344  
    66# define WHITE_B 255
    77
    8 // XXX this currently writes out the jpeg for the active image
    9 int JPEGit24 () {
     8// XXX this currently writes out the jpeg for just the active image
     9int JPEGit24 (int sock) {
    1010
    1111  struct jpeg_compress_struct cinfo;
     
    3030  FILE *f;
    3131
     32  /* expect a line telling the number of bytes and a filename */
     33  KiiScanMessage (sock, "%s", filename);
     34
    3235  graphic = GetGraphic();
    3336  section = GetActiveSection();
    3437  image   = section->image;
    35 
    36   /* expect a line telling the number of bytes and a filename */
    37   KiiScanMessage (sock, "%s", filename);
     38  if (image == NULL) return (TRUE);
    3839
    3940  /***** JPEG init calls */
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Layout.c

    r13333 r13344  
    44void InitLayout (int argc, char **argv) {
    55
    6   int N, UseGraph;
     6  int N;
    77  Section *section;
    88
    9   UseGraph = FALSE;
    10   if ((N = get_argument (argc, argv, "-image"))) {
    11     remove_argument(N, &argc, argv);
    12     UseGraph = FALSE;
    13   }
    14 
    15   /** initiate connection with server **/
    16   if (!FOREGROUND) {   
    17     if (argc < 2) {
    18       fprintf (stderr, "socket path not specified\n");
    19       exit (0);
    20     }
    21     sock = KiiWait (argv[1]);
    22   }
     9  InitPipe();
    2310
    2411  ACTIVE_CURSOR = FALSE;
     
    3724  }
    3825
     26  /* move this out of here... */
     27  if (argc != 1) {
     28    fprintf (stderr, "USAGE: kapa\n");
     29    exit (0);
     30  }
     31
    3932  InitRotFonts ();
    4033
    41   /* create basic section */
     34  /* create basic section, empty of image or graph */
    4235  section = AddSection ("default", 0.0, 0.0, 1.0, 1.0);
    43   if (UseGraph) {
    44     section->graph = InitGraph ();
    45     SetGraphSize (section);
    46   } else {
    47     section->image = InitImage ();
    48     SetImageSize (section);
    49   }
    5036}
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadFrame.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int LoadFrame () {
     3int LoadFrame (int sock) {
    44 
    55  int i, status;
     
    99
    1010  section = GetActiveSection();
     11  if (section->graph == NULL) {
     12    section->graph = InitGraph ();
     13    SetGraphSize (section);
     14  }
    1115  graph = section->graph;
    1216
    13   // XXX what to do if graph is NULL?
    14  
    1517  KiiScanMessage (sock, "%lf %lf %lf %lf",
    1618                  &graph[0].axis[0].min, &graph[0].axis[0].max,
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadLabels.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int LoadLabels () {
     3int LoadLabels (int sock) {
    44 
    55  char *c, *label;
     
    99
    1010  section = GetActiveSection();
     11  if (section->graph == NULL) {
     12    section->graph = InitGraph ();
     13    SetGraphSize (section);
     14  }
    1115  graph = section->graph;
    1216 
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadObject.c

    r13320 r13344  
    22# include <errno.h>
    33
    4 int LoadObject () {
     4int LoadObject (int sock) {
    55 
    66  int N;
     
    99
    1010  section = GetActiveSection();
     11  if (section->graph == NULL) {
     12    section->graph = InitGraph ();
     13    SetGraphSize (section);
     14  }
    1115  graph = section->graph;
    1216 
     
    4448  fcntl (sock, F_SETFL, O_NONBLOCK); 
    4549 
    46   if (!LoadVectorData (graph, N, "x")) {
     50  if (!LoadVectorData (sock, graph, N, "x")) {
    4751    FreeObjectData (&graph[0].objects[N]);
    4852    graph[0].Nobjects --;
     
    5054  }
    5155   
    52   if (!LoadVectorData (graph, N, "y")) {
     56  if (!LoadVectorData (sock, graph, N, "y")) {
    5357    FreeObjectData (&graph[0].objects[N]);
    5458    graph[0].Nobjects --;
     
    5660  }
    5761  if (graph[0].objects[N].size < 0.0) {
    58     if (!LoadVectorData (graph, N, "z")) {
     62    if (!LoadVectorData (sock, graph, N, "z")) {
    5963      FreeObjectData (&graph[0].objects[N]);
    6064      graph[0].Nobjects --;
     
    6367  }
    6468  if (graph[0].objects[N].etype & 0x01) {
    65     if (!LoadVectorData (graph, N, "dym")) {
     69    if (!LoadVectorData (sock, graph, N, "dym")) {
    6670      FreeObjectData (&graph[0].objects[N]);
    6771      graph[0].Nobjects --;
    6872      REALLOCATE (graph[0].objects, Gobjects, MAX (1, graph[0].Nobjects));
    6973    }
    70     if (!LoadVectorData (graph, N, "dyp")) {
     74    if (!LoadVectorData (sock, graph, N, "dyp")) {
    7175      FreeObjectData (&graph[0].objects[N]);
    7276      graph[0].Nobjects --;
     
    7579  }
    7680  if (graph[0].objects[N].etype & 0x02) {
    77     if (!LoadVectorData (graph, N, "dxm")) {
     81    if (!LoadVectorData (sock, graph, N, "dxm")) {
    7882      FreeObjectData (&graph[0].objects[N]);
    7983      graph[0].Nobjects --;
    8084      REALLOCATE (graph[0].objects, Gobjects, MAX (1, graph[0].Nobjects));
    8185    }
    82     if (!LoadVectorData (graph, N, "dxp")) {
     86    if (!LoadVectorData (sock, graph, N, "dxp")) {
    8387      FreeObjectData (&graph[0].objects[N]);
    8488      graph[0].Nobjects --;
     
    97101
    98102/* load data for the named component */
    99 int LoadVectorData (KapaGraphWidget *graph, int N, char *type) {
     103int LoadVectorData (int sock, KapaGraphWidget *graph, int N, char *type) {
    100104 
    101105  int Npts, Ninpts, status, Ntry;
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadOverlay.c

    r13331 r13344  
    22
    33// XXX this is a very inefficient method to send the data: binary would be better
    4 int LoadOverlay () {
     4int LoadOverlay (int sock) {
    55 
    66  char word[17], type[16], string[128];
     
    1515  graphic = GetGraphic ();
    1616  section = GetActiveSection();
     17  if (section->image == NULL) {
     18    section->image = InitImage ();
     19    SetImageSize (section);
     20  }
    1721  image   = section->image;
    1822
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadPicture.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int LoadPicture () {
     3int LoadPicture (int sock) {
    44
    55  Header header;
     
    1212  graphic = GetGraphic ();
    1313  section = GetActiveSection();
    14   image   = section->image;
     14  if (section->image == NULL) {
     15    section->image = InitImage ();
     16    SetImageSize (section);
     17  }
     18  image = section->image;
    1519 
    1620  KiiSendMessage (sock, "%d", graphic->Npixels);
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadTextlines.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int LoadTextlines () {
     3int LoadTextlines (int sock) {
    44 
    55  char *string;
     
    1111  section = GetActiveSection();
    1212  graph = section->graph;
    13  
     13    if (section->graph == NULL) {
     14    section->graph = InitGraph ();
     15    SetGraphSize (section);
     16  }
     17
    1418  fcntl (sock, F_SETFL, !O_NONBLOCK); 
    1519 
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadTickmarks.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int LoadTickmarks () {
     3int LoadTickmarks (int sock) {
    44 
    55  char line[129], type[16];
     
    1010
    1111  section = GetActiveSection();
     12  if (section->image == NULL) {
     13    section->image = InitImage ();
     14    SetImageSize (section);
     15  }
    1216  image   = section->image;
     17
    1318  fcntl (sock, F_SETFL, !O_NONBLOCK); 
    1419
     
    6368  fcntl (sock, F_SETFL, O_NONBLOCK); 
    6469  return (TRUE);
    65  
    6670}
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PNGit.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int PNGit () {
     3int PNGit (int sock) {
    44
    55  FILE *f;
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PPMit.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int PPMit () {
     3int PPMit (int sock) {
    44
    55  FILE *f;
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PSit.c

    r13331 r13344  
    66static Graphic *graphic;
    77
    8 int PScommand () {
     8int PScommand (int sock) {
    99
    1010  int status, scaleMode, pageMode;
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Resize.c

    r13320 r13344  
    22
    33// XXX Should there be a base command + KiiMessage command?
    4 int Resize () {
     4int Resize (int sock) {
    55 
    66  int i, Nsection;
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SaveOverlay.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int SaveOverlay () {
     3int SaveOverlay (int sock) {
    44
    55  int i, N;
     
    1111  section = GetActiveSection();
    1212  image   = section->image;
     13  if (image == NULL) return (TRUE);
    1314
    1415  KiiScanMessage (sock, "%*s %d %s", &N, filename);
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Sections.c

    r13320 r13344  
    2424
    2525  if (section == NULL) return;
    26   if (section[0].graph != NULL) FreeGraph (section[0].graph);
    27   // if (section[0].image != NULL) FreeImage (section[0].image);
    28   if (section[0].name  != NULL) free (section[0].name);
     26  FreeGraph (section[0].graph);
     27  FreeImage (section[0].image);
     28  FREE (section[0].name);
    2929  free (section);
    3030}
     
    4242}
    4343
    44 // XXX how to set the section type?
    45 // XXX set active section on Add?
    4644Section *AddSection (char *name, float x, float y, float dx, float dy) {
    4745
     
    116114}
    117115
    118 int ListSection () {
     116int ListSection (int sock) {
    119117 
    120118  int i, ThisSection;
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SetFont.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int SetFont () {
     3int SetFont (int sock) {
    44 
    55  char name[64];
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SetLimits.c

    r13320 r13344  
    11# include "Ximage.h"
    22
    3 int SetLimits () {
     3int SetLimits (int sock) {
    44 
    55  int i;
     
    1414
    1515  section = GetActiveSection();
    16   if (section->graph == NULL) return (TRUE);
     16  if (section->graph == NULL) {
     17    section->graph = InitGraph ();
     18    SetGraphSize (section);
     19  }
    1720  graph = section->graph;
    18 
     21 
    1922  graph[0].axis[2].min = graph[0].axis[0].min = xmin;
    2023  graph[0].axis[2].max = graph[0].axis[0].max = xmax;
     
    3235  Refresh (1);
    3336
    34   return (TRUE);
    35  
     37  return (TRUE); 
    3638}
    3739
    38 int GetLimits () {
     40int GetLimits (int sock) {
    3941 
    4042  double dX, dY;
     
    5759  return (TRUE);
    5860}
     61
     62/* example for image:
     63   
     64    section->image = InitImage ();
     65    SetImageSize (section);
     66*/
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SetSection.c

    r13320 r13344  
    22
    33// set active section
    4 int SetSection () {
     4int SetSection (int sock) {
    55 
    66  int N;
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/UpdatePointer.c

    r13320 r13344  
    1313  section = GetActiveSection();
    1414  image   = section->image;
     15  if (image == NULL) return (TRUE);
    1516
    1617  if (image[0].MovePointer && InPicture ((XButtonEvent *)event, &image[0].picture)) {
  • branches/kapa-mods-2007-05/Ohana/src/kapa2/src/kapa.c

    r13320 r13344  
    77  SetUpGraphic (&argc, argv);
    88
    9   // XXX get socket connection here?
    10 
    119  InitLayout (argc, argv);
    1210  EventLoop ();
  • branches/kapa-mods-2007-05/Ohana/src/libkapa/Makefile

    r12879 r13344  
    2929$(SRC)/KiiConvert.$(ARCH).o \
    3030$(SRC)/KapaWindow.$(ARCH).o \
    31 $(SRC)/KapaColors.$(ARCH).o
     31$(SRC)/KapaColors.$(ARCH).o \
     32$(SRC)/KapaOpen.$(ARCH).o
    3233
    3334DRAW = \
  • branches/kapa-mods-2007-05/Ohana/src/libkapa/include/kapa.h

    r13334 r13344  
    22# define KAPA_H
    33
     4/* linux is happy with this, not solaris */
     5# include <netinet/ip.h>
     6# include <netdb.h>
     7# include <arpa/inet.h>
     8
     9# include <sys/types.h>
     10# include <sys/socket.h>
    411# include <X11/Xlib.h>
    512# include <png.h>
    613# include <dvo.h>
     14
     15typedef struct sockaddr_in KapaSockAddress;
    716
    817typedef struct {
     
    196205int bDrawRotBitmap (int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale);
    197206
     207/* Kapa Socket functions */
     208int KapaOpen (char *kapa_exec, char *kapa_name);
     209int KapaServerInit (KapaSockAddress *Address);
     210int KapaServerWait (int InitSocket, KapaSockAddress *Address);
     211int KapaDefineValidIP (char *ipstring);
     212int KapaClientSocket (char *hostname);
     213
    198214/* define Kapa names for shared functions */
    199 # define KapaOpen(p,n) KiiOpen(p,n)
     215// # define KapaOpen(p,n) KiiOpen(p,n)
    200216# define KapaResize(fd,Nx,Ny) KiiResize(fd,Nx,Ny)
    201217# define KapaCenter(fd,x,y,z) KiiResize(fd,x,y,z)
  • branches/kapa-mods-2007-05/Ohana/src/libkapa/src/IOfuncs.c

    r13334 r13344  
    111111int KiiScanCommand (int device, int length, char *format, ...) {
    112112
    113   int Nbytes, status;
    114   char *buffer, *message;
     113  int status;
     114  char *message;
    115115  va_list argp; 
    116116
     
    118118
    119119  /* read Nbytes from the device */
    120   status = read (device, message, Nbytes);
    121   if (status != Nbytes) fprintf (stderr, "Kii/Kapa comm error\n");
     120  status = read (device, message, length);
     121  if (status != length) fprintf (stderr, "Kii/Kapa comm error\n");
    122122  message[status] = 0;
    123123  /* make the string easy to parse */
     
    125125  /* scan the incoming message */
    126126  va_start (argp, format);
    127   Nbytes = vsscanf (message, format, argp);
     127  status = vsscanf (message, format, argp);
    128128  va_end (argp);
    129129
  • branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/close.c

    r6686 r13344  
    2424  if (IsImage) {
    2525    if (!GetImage (&Source, &Nsource)) return (FALSE);
    26     close_image (Nsource);
     26    // close_image (Nsource);
    2727  } else {
    2828    if (!GetGraph (NULL, &Source, &Nsource)) return (FALSE);
    29     close_graph (Nsource);
     29    // close_graph (Nsource);
    3030  }
    3131
  • branches/kapa-mods-2007-05/Ohana/src/opihi/include/display.h

    r12332 r13344  
    44# ifndef DISPLAY_H
    55# define DISPLAY_H
    6 
    7 # if (0)
    8 typedef struct {
    9   double xmin, xmax, ymin, ymax;
    10   int style, ptype, ltype, etype, ebar, color;
    11   double lweight, size;
    12   Coords coords;
    13   int flipeast, flipnorth;
    14   char axis[8], labels[8], ticks[8];
    15 } Graphdata;
    16 # endif
    176
    187/*** plotting functions ***/
     
    4534int           SelectOverlay         PROTO((char *name, int *number));
    4635
     36void InitKapa ();
     37int FindKapaDevice (int thisDevice);
     38int open_kapa (int thisDevice);
     39
    4740/* calling program need to define a function 'get_variable' which
    4841 * returns the name of the executable for each of KAPA and KII
  • branches/kapa-mods-2007-05/Ohana/src/opihi/lib.data/Makefile

    r12879 r13344  
    2929$(SDIR)/gaussian.$(ARCH).o              \
    3030$(SDIR)/graphtools.$(ARCH).o            \
    31 $(SDIR)/open_graph.$(ARCH).o            \
    32 $(SDIR)/open_image.$(ARCH).o            \
    3331$(SDIR)/queues.$(ARCH).o                \
    3432$(SDIR)/PlotVectors.$(ARCH).o           \
     33$(SDIR)/open_kapa.$(ARCH).o             \
    3534$(SDIR)/style_args.$(ARCH).o
     35
     36#$(SDIR)/open_graph.$(ARCH).o            \
     37#$(SDIR)/open_image.$(ARCH).o            \
    3638
    3739# dependancy rules for include files ########################
  • branches/kapa-mods-2007-05/Ohana/src/opihi/lib.data/open_image.c

    r7938 r13344  
    122122  return (Ximbuffer[Active]);
    123123}
    124  
     124 
     125// leave this information on kapa, request when needed?
    125126void SetImageScale (double zero, double range) {
    126127  Xzero[Active] = zero;
  • branches/kapa-mods-2007-05/Ohana/src/opihi/mana/mana.c.in

    r12280 r13344  
    5151/* add program-dependent exit functions here */
    5252void cleanup () {
    53   QuitImage ();
    54   QuitGraph ();
     53        //   QuitImage ();
     54        //   QuitGraph ();
    5555  return;
    5656}
Note: See TracChangeset for help on using the changeset viewer.