| 1 |
/*=========================================================================== |
| 2 |
Copyright (C) 1995-2007 European Southern Observatory (ESO) |
| 3 |
|
| 4 |
This program is free software; you can redistribute it and/or |
| 5 |
modify it under the terms of the GNU General Public License as |
| 6 |
published by the Free Software Foundation; either version 2 of |
| 7 |
the License, or (at your option) any later version. |
| 8 |
|
| 9 |
This program is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
GNU General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public |
| 15 |
License along with this program; if not, write to the Free |
| 16 |
Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, |
| 17 |
MA 02139, USA. |
| 18 |
|
| 19 |
Correspondence concerning ESO-MIDAS should be addressed as follows: |
| 20 |
Internet e-mail: [email protected] |
| 21 |
Postal address: European Southern Observatory |
| 22 |
Data Management Division |
| 23 |
Karl-Schwarzschild-Strasse 2 |
| 24 |
D 85748 Garching bei Muenchen |
| 25 |
GERMANY |
| 26 |
===========================================================================*/ |
| 27 |
|
| 28 |
/* ----------------------------------------------------------------- */ |
| 29 |
/* --------- IIE -------------------------------------------------- */ |
| 30 |
/* ----------------------------------------------------------------- */ |
| 31 |
|
| 32 |
/* file iie.c : contains the following `Escape' routines |
| 33 |
* |
| 34 |
* IIEGDB_C : Get a datablock from IDI server |
| 35 |
* IIESDB_C : Send a datablock to IDI server |
| 36 |
* |
| 37 |
* show_misc : Display various data from idistruct.h |
| 38 |
* |
| 39 |
* V 1.0 950203 Klaus Banse - ESO Garching |
| 40 |
|
| 41 |
070523 last modif |
| 42 |
|
| 43 |
************************************************************************* |
| 44 |
*/ |
| 45 |
|
| 46 |
# include <idi.h> |
| 47 |
# include <idistruct.h> |
| 48 |
# include <proto_idi.h> |
| 49 |
|
| 50 |
# include <stdio.h> |
| 51 |
|
| 52 |
|
| 53 |
/* |
| 54 |
|
| 55 |
*/ |
| 56 |
|
| 57 |
/************************************************************************ |
| 58 |
* IIEGDB_C routine : get a block of data from IDI server |
| 59 |
* * |
| 60 |
* synopsis IIEGDB_C(display,flag,auxid,cbuf,ibuf,rbuf) |
| 61 |
* * |
| 62 |
* int display; input display identifier * |
| 63 |
* int flag; input for different options |
| 64 |
* = 1 for memory data block |
| 65 |
* int auxid; input object id, |
| 66 |
* for flag = 1, it's the memory id |
| 67 |
* char *cbuf; output char. info |
| 68 |
* int *ibuf; output int info |
| 69 |
* float *rbuf; output float info |
| 70 |
* |
| 71 |
* the no. of elements in ibuf + rbuf depends upon flag |
| 72 |
* flag = 1, ibuf 17 elements, rbuf 8 elements |
| 73 |
* corresponding to the IDIMEMC keyword* |
| 74 |
************************************************************************/ |
| 75 |
|
| 76 |
int IIEGDB_C(display,flag,auxid,cbuf,ibuf,rbuf) |
| 77 |
|
| 78 |
int display, flag, auxid, *ibuf; |
| 79 |
char *cbuf; |
| 80 |
float *rbuf; |
| 81 |
|
| 82 |
{ |
| 83 |
|
| 84 |
CONF_DATA *conf; |
| 85 |
MEM_DATA *mem; |
| 86 |
ITT_DATA *itt; |
| 87 |
TLIST *tlist; |
| 88 |
GLIST *glist; |
| 89 |
|
| 90 |
int mm, i; |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
if (flag == 1) /* handle the memory data stuff */ |
| 96 |
{ |
| 97 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 98 |
|
| 99 |
conf = ididev[display].confptr; |
| 100 |
if (conf->RGBmode == 1) |
| 101 |
{ |
| 102 |
if (auxid == 3) |
| 103 |
auxid = conf->overlay; |
| 104 |
else |
| 105 |
auxid = 0; /* single memory for 3 channels */ |
| 106 |
} |
| 107 |
else |
| 108 |
{ |
| 109 |
if ((auxid < 0) || (auxid >= conf->overlay)) return(ILLMEMID); |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
mem = conf->memory[auxid]; |
| 114 |
|
| 115 |
(void)strcpy(cbuf,mem->frame); |
| 116 |
|
| 117 |
*ibuf++ = mem->load_dir; |
| 118 |
*ibuf++ = mem->sspx; |
| 119 |
*ibuf++ = mem->sspy; |
| 120 |
*ibuf++ = mem->nsx; |
| 121 |
*ibuf++ = mem->nsy; |
| 122 |
*ibuf++ = mem->sfpx; |
| 123 |
*ibuf++ = mem->sfpy; |
| 124 |
*ibuf++ = mem->xscale; |
| 125 |
*ibuf++ = mem->yscale; |
| 126 |
*ibuf++ = mem->xscroll; |
| 127 |
*ibuf++ = mem->yscroll; |
| 128 |
*ibuf++ = mem->zoom; |
| 129 |
*ibuf++ = mem->zoom; /* same zoom in y */ |
| 130 |
*ibuf++ = mem->source; |
| 131 |
itt = mem->ittpntr; |
| 132 |
if (itt != (ITT_DATA *)0) |
| 133 |
*ibuf++ = itt->vis; |
| 134 |
else |
| 135 |
*ibuf++ = 0; |
| 136 |
*ibuf = 0; |
| 137 |
glist = mem->gpntr; |
| 138 |
if ((glist != (GLIST *)0) && (glist->geln > 0)) |
| 139 |
*ibuf = 1; |
| 140 |
else |
| 141 |
{ |
| 142 |
tlist = mem->tpntr; |
| 143 |
if ((tlist != (TLIST *)0) && (tlist->teln > 0)) *ibuf = 1; |
| 144 |
} |
| 145 |
ibuf++; |
| 146 |
*ibuf = mem->plane_no; |
| 147 |
|
| 148 |
for (mm=0; mm<8; mm++) *rbuf++ = mem->rbuf[mm]; |
| 149 |
} |
| 150 |
|
| 151 |
else if (flag == 2) /* get complete setup */ |
| 152 |
{ |
| 153 |
char *mytype, cc; |
| 154 |
|
| 155 |
mytype = cbuf; |
| 156 |
|
| 157 |
for (i=0; i<MAX_DEV; i++) /* return w. type and no. */ |
| 158 |
{ |
| 159 |
if (ididev[i].devname[0] == '\0') |
| 160 |
{ |
| 161 |
*mytype++ = ' '; /* indicate unused slot */ |
| 162 |
*mytype++ = ' '; |
| 163 |
*ibuf++ = -9; |
| 164 |
*ibuf++ = -9; |
| 165 |
} |
| 166 |
else |
| 167 |
{ |
| 168 |
cc = ididev[i].devname[6]; |
| 169 |
if (cc == '\0') cc = 'i'; /* nothing = image */ |
| 170 |
*mytype++ = cc; |
| 171 |
*mytype++ = ididev[i].devname[5]; |
| 172 |
|
| 173 |
/* printf("IIE: links at %d: %d, %d\n", |
| 174 |
i,ididev[i].link[0],ididev[i].link[1]); */ |
| 175 |
|
| 176 |
*ibuf++ = ididev[i].link[0]; /* also save links */ |
| 177 |
*ibuf++ = ididev[i].link[1]; |
| 178 |
} |
| 179 |
} |
| 180 |
*mytype = '\0'; |
| 181 |
} |
| 182 |
|
| 183 |
|
| 184 |
return(II_SUCCESS); |
| 185 |
} |
| 186 |
/* |
| 187 |
|
| 188 |
*/ |
| 189 |
|
| 190 |
/************************************************************************ |
| 191 |
* IIESDB_C routine : send a block of data to IDI server |
| 192 |
* * |
| 193 |
* synopsis IIESDB_C(display,flag,auxid,cbuf,ibuf,rbuf) |
| 194 |
* * |
| 195 |
* int display; input display identifier * |
| 196 |
* int flag; input for different options |
| 197 |
* = 1 for memory data block |
| 198 |
* int auxid; input object id, |
| 199 |
* for flag = 1, it's the memory id |
| 200 |
* for flag = 2, it's ? |
| 201 |
* char *cbuf; input char. info |
| 202 |
* int *ibuf; input int info |
| 203 |
* float *rbuf; input float info |
| 204 |
* |
| 205 |
* the no. of elements in ibuf + rbuf depends upon flag |
| 206 |
* flag = 1: ibuf 17 elements, rbuf 8 elements |
| 207 |
* flag = 2: ibuf 2 elements |
| 208 |
* |
| 209 |
************************************************************************/ |
| 210 |
|
| 211 |
int IIESDB_C(display,flag,auxid,cbuf,ibuf,rbuf) |
| 212 |
|
| 213 |
int display, flag, auxid, *ibuf; |
| 214 |
char *cbuf; |
| 215 |
float *rbuf; |
| 216 |
|
| 217 |
{ |
| 218 |
|
| 219 |
CONF_DATA *conf; |
| 220 |
MEM_DATA *mem; |
| 221 |
|
| 222 |
int mm; |
| 223 |
|
| 224 |
int show_misc(); |
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 230 |
|
| 231 |
|
| 232 |
if (flag == 1) /* handle the memory data stuff */ |
| 233 |
{ |
| 234 |
conf = ididev[display].confptr; |
| 235 |
if ((auxid < 0) || (auxid >= conf->overlay)) return(ILLMEMID); |
| 236 |
|
| 237 |
mem = conf->memory[auxid]; |
| 238 |
|
| 239 |
(void)strcpy(mem->frame,cbuf); |
| 240 |
|
| 241 |
ibuf++; /* we don't need to update mem->load_dir */ |
| 242 |
mem->sspx = *ibuf++; |
| 243 |
mem->sspy = *ibuf++; |
| 244 |
mem->nsx = *ibuf++; |
| 245 |
mem->nsy = *ibuf++; |
| 246 |
mem->sfpx = *ibuf++; |
| 247 |
mem->sfpy = *ibuf++; |
| 248 |
mem->xscale = *ibuf++; |
| 249 |
mem->yscale = *ibuf++; |
| 250 |
|
| 251 |
/* omit mem->xscroll, yscroll, zoom (2*), source, ITTvis and draw-flag */ |
| 252 |
|
| 253 |
mem->plane_no = *(ibuf+7); |
| 254 |
|
| 255 |
|
| 256 |
for (mm=0; mm<8; mm++) mem->rbuf[mm] = *rbuf++; |
| 257 |
} |
| 258 |
|
| 259 |
else if (flag > 100) |
| 260 |
{ |
| 261 |
flag -= 100; |
| 262 |
if (flag > 100) /* > 200 => display idi structs */ |
| 263 |
{ |
| 264 |
flag -= 100; |
| 265 |
show_misc(display,flag,auxid,cbuf,ibuf,rbuf); |
| 266 |
} |
| 267 |
else |
| 268 |
do_misc(display,flag,auxid,cbuf,ibuf,rbuf); |
| 269 |
} |
| 270 |
|
| 271 |
|
| 272 |
return(II_SUCCESS); |
| 273 |
} |
| 274 |
/* |
| 275 |
|
| 276 |
*/ |
| 277 |
|
| 278 |
int show_misc(display,flag,auxid,cbuf,ibuf,rbuf) |
| 279 |
int display, flag, auxid, *ibuf; |
| 280 |
char *cbuf; |
| 281 |
float *rbuf; |
| 282 |
|
| 283 |
{ |
| 284 |
|
| 285 |
if (flag == 1) /* display ididev */ |
| 286 |
{ |
| 287 |
printf("struct ididev[%d]\n---------\n",display); |
| 288 |
|
| 289 |
printf("devname = %s\t\tdevtyp = %c\n", |
| 290 |
ididev[display].devname,ididev[display].devtyp); |
| 291 |
printf("ref = %c\t\t\tscreen = %d\n", |
| 292 |
ididev[display].ref,ididev[display].screen); |
| 293 |
printf("xsize = %d\t\tysize = %d\t\tdepth = %d\n", |
| 294 |
ididev[display].xsize,ididev[display].ysize,ididev[display].lutoff); |
| 295 |
printf("ncurs = %d\t\tlutsect = %d\t\tlutoff = %d\n", |
| 296 |
ididev[display].ncurs,ididev[display].lutsect,ididev[display].lutoff); |
| 297 |
printf("n_inter = %d\t\texit trigger = %d\tinter_mask = %ld\n", |
| 298 |
ididev[display].n_inter,ididev[display].trigger,ididev[display].inter_mask); |
| 299 |
printf("alpno = %d\t\talphx = %d\talphy = %d\n", |
| 300 |
ididev[display].alpno,ididev[display].alphx,ididev[display].alphy); |
| 301 |
printf("alphxscal = %d\t\talphlinsz = %d\n", |
| 302 |
ididev[display].alphxscal,ididev[display].alphlinsz); |
| 303 |
printf("backpix = 0x%lx\t\tlink[0] = %d\tlink[1] = %d\n", |
| 304 |
ididev[display].backpix,ididev[display].link[0],ididev[display].link[1]); |
| 305 |
} |
| 306 |
|
| 307 |
else if (flag == 2) /* display Xworkst */ |
| 308 |
{ |
| 309 |
int mm; |
| 310 |
|
| 311 |
mm = ididev[display].screen; |
| 312 |
|
| 313 |
printf("struct Xworkst[%d]\n-----------\n",mm); |
| 314 |
|
| 315 |
printf("name = %s\t\tMidas unit = %4.4s\n", |
| 316 |
Xworkst[mm].name,Xworkst[mm].miduni); |
| 317 |
printf("visual = %d\t\tRGBord = %d\n", |
| 318 |
Xworkst[mm].visual,Xworkst[mm].RGBord); |
| 319 |
printf("lutflag = %d\t\townlut = %d\t\tauxcol = %d\n", |
| 320 |
Xworkst[mm].lutflag,Xworkst[mm].ownlut,Xworkst[mm].auxcol); |
| 321 |
printf("width = %d\t\theight = %d\t\tdepth = %d\n", |
| 322 |
Xworkst[mm].width,Xworkst[mm].height,Xworkst[mm].depth); |
| 323 |
if (Xworkst[mm].nobyt > 0) |
| 324 |
printf("bytes_pixel = %d\t\tflag24 = %d,%d,%d\n", |
| 325 |
Xworkst[mm].nobyt, |
| 326 |
Xworkst[mm].flag24[0],Xworkst[mm].flag24[1],Xworkst[mm].flag24[2]); |
| 327 |
else |
| 328 |
printf("bits_pixel = %d\t\tflag24 = %d,%d,%d\n", |
| 329 |
-Xworkst[mm].nobyt, |
| 330 |
Xworkst[mm].flag24[0],Xworkst[mm].flag24[1],Xworkst[mm].flag24[2]); |
| 331 |
printf("fixpix = \n%d, %d, %d, %d, %d, %d, %d, %d, %d\n", |
| 332 |
Xworkst[mm].fixpix[0], Xworkst[mm].fixpix[1], |
| 333 |
Xworkst[mm].fixpix[2], Xworkst[mm].fixpix[3], |
| 334 |
Xworkst[mm].fixpix[4], Xworkst[mm].fixpix[5], |
| 335 |
Xworkst[mm].fixpix[6], Xworkst[mm].fixpix[7], |
| 336 |
Xworkst[mm].fixpix[8]); |
| 337 |
printf("mapin[0], mapin[1], mapin[2] = %d, %d, %d\n", |
| 338 |
Xworkst[mm].mapin[0], Xworkst[mm].mapin[1], |
| 339 |
Xworkst[mm].mapin[2]); |
| 340 |
printf("mapout[0], mapout[1], mapout[2] = %d, %d, %d\n", |
| 341 |
Xworkst[mm].mapout[0], Xworkst[mm].mapout[1], |
| 342 |
Xworkst[mm].mapout[2]); |
| 343 |
printf("nolut = %d\t\tlutsize = %d\t\tlutlen = %d\n", |
| 344 |
Xworkst[mm].nolut,Xworkst[mm].lutsize,Xworkst[mm].lutlen); |
| 345 |
printf("lutfct = %f\t\tlutinv = %f\n", |
| 346 |
Xworkst[mm].lutfct,Xworkst[mm].lutinv); |
| 347 |
printf("blackpixel = 0x%lx\t\twhitepixel = 0x%lx\tblmask = 0x%x\n", |
| 348 |
Xworkst[mm].black,Xworkst[mm].white,Xworkst[mm].blmask); |
| 349 |
} |
| 350 |
|
| 351 |
else /* display mem_data */ |
| 352 |
{ |
| 353 |
CONF_DATA *conf; |
| 354 |
MEM_DATA *mem; |
| 355 |
|
| 356 |
conf = ididev[display].confptr; |
| 357 |
if ((auxid < 0) || (auxid >= conf->overlay)) return(ILLMEMID); |
| 358 |
|
| 359 |
mem = conf->memory[auxid]; |
| 360 |
printf("struct mem_data[%d]\n-----------\n",auxid); |
| 361 |
|
| 362 |
printf("pixmap = %d\t\tvisibility = %d\t\tmemtype = %d\n", |
| 363 |
mem->pixmap,mem->visibility,mem->type); |
| 364 |
printf("xsize = %d\t\tysize = %d\t\tdepth = %d\n", |
| 365 |
mem->xsize,mem->ysize,mem->depth); |
| 366 |
printf("xwoff = %d\tywoff = %d\txwdim = %d\tywdim = %d\n", |
| 367 |
mem->xwoff,mem->ywoff,mem->xwdim,mem->ywdim); |
| 368 |
printf("load_dir = %d\t\tlut_id = %d\n", |
| 369 |
mem->load_dir,mem->lut_id); |
| 370 |
printf("xscroll = %d\t\tyscroll = %d\t\tzoom = %d\n", |
| 371 |
mem->xscroll,mem->yscroll,mem->zoom); |
| 372 |
printf("xscale = %d\t\tyscale = %d\n", |
| 373 |
mem->xscale,mem->yscale); |
| 374 |
printf("sspx = %d\tsspy = %d\tnsx = %d\tnsy = %d\n", |
| 375 |
mem->sspx,mem->sspy,mem->nsx,mem->nsy); |
| 376 |
printf("sfpx = %d\tsfpy = %d\tsource = %d\tplane_no = %d\n", |
| 377 |
mem->sfpx,mem->sfpy,mem->source,mem->plane_no); |
| 378 |
printf("frame = %s\n",mem->frame); |
| 379 |
printf("start, end, ... = \n%f, %f, %f, %f, %f , %f, %f, %f\n", |
| 380 |
mem->rbuf[0], mem->rbuf[1], mem->rbuf[2], mem->rbuf[3], |
| 381 |
mem->rbuf[4], mem->rbuf[5], mem->rbuf[6], mem->rbuf[7]); |
| 382 |
} |
| 383 |
|
| 384 |
return 0; |
| 385 |
} |
| 386 |
|
| 387 |
|