MIDAS
The mdsupport.h & mdsupport.c
Collaboration diagram for The mdsupport.h & mdsupport.c:

Modules

 Midas dump error code
 
 Midas dump support Define
 
 Midas dump support Macros
 

Classes

struct  MY
 

Macros

#define TRACE
 
#define EXPRT
 

Functions

INT md_dev_os_read (INT handle, INT type, void *prec, DWORD nbytes, DWORD *nread)
 
INT md_dev_os_write (INT handle, INT type, void *prec, DWORD nbytes, DWORD *written)
 
void md_bank_event_display (const void *pevent, INT data_fmt, INT dsp_fmt, INT dsp_mode, const char *bn)
 
void md_raw_event_display (const void *pevent, INT data_fmt, INT dsp_fmt)
 
void md_raw_bank_display (void *pbank, INT data_fmt, INT dsp_fmt)
 
INT midas_event_get (void **pevent, DWORD *size)
 
INT midas_physrec_get (void *prec, DWORD *readn)
 
INT midas_event_skip (INT evtn)
 
void midas_bank_display (BANK *pbk, INT dsp_fmt)
 
template<typename T >
void midas_bank_display32 (T *pbk, INT dsp_fmt)
 
INT md_file_ropen (char *infile, INT data_fmt, INT openzip, INT max_event_size)
 
INT md_file_rclose (INT data_fmt)
 
INT md_file_wopen (INT type, INT data_fmt, char *filename, INT *hDev)
 
INT md_file_wclose (INT handle, INT type, INT data_fmt, char *destination)
 
INT md_physrec_get (INT data_fmt, void **precord, DWORD *readn)
 
INT md_log_write (INT handle, INT data_fmt, INT type, void *prec, DWORD nbytes)
 
INT md_all_info_display (INT what)
 
INT md_event_swap (INT data_fmt, void *pevent)
 
void md_event_display (const void *pevent, INT data_fmt, INT dsp_mode, INT dsp_fmt, const char *bn)
 
void md_bank_display (void *pmbh, void *pbk, INT data_fmt, INT dsp_mode, INT dsp_fmt)
 

Variables

struct stat * filestat
 
char * ptopmrd
 
gzFile filegz
 
MY my
 

Detailed Description

dox


Macro Definition Documentation

◆ EXPRT

#define EXPRT

dox

Definition at line 49 of file mdsupport.h.

◆ TRACE

#define TRACE

dox

Definition at line 32 of file mdsupport.cxx.

Function Documentation

◆ md_all_info_display()

INT EXPRT md_all_info_display ( INT  what)

Definition at line 695 of file mdsupport.cxx.

707 {
708  if (my.fmt == FORMAT_YBOS) {
709  assert(!"YBOS not supported anymore");
710  } else if (my.fmt == FORMAT_MIDAS) {
711  DWORD mbn, run, ser;
712  WORD id, msk;
713  mbn = my.evtn;
714  run = my.runn;
715  id = my.pmh->event_id;
716  msk = my.pmh->trigger_mask;
717  ser = my.pmh->serial_number;
718  switch (what) {
719  case D_RECORD:
720  case D_HEADER:
721  printf(">>> No physical record structure for Midas format <<<\n");
722  return MD_DONE;
723  break;
724  case D_EVTLEN:
725  printf("Evt#%d- ", my.evtn);
726  printf("%irun 0x%4.4uxid 0x%4.4uxmsk %5dmevt#", run, id, msk, mbn);
727  printf("%5del/x%x %5dserial\n", my.evtlen, my.evtlen, ser);
728  break;
729  }
730  }
731  return MD_SUCCESS;
732 }
unsigned short int WORD
Definition: mcstd.h:49
unsigned int DWORD
Definition: mcstd.h:51
#define FORMAT_YBOS
Definition: midas.h:319
#define FORMAT_MIDAS
Definition: midas.h:318
#define D_RECORD
Definition: mdsupport.h:78
#define D_EVTLEN
Definition: mdsupport.h:80
#define D_HEADER
Definition: mdsupport.h:79
#define MD_DONE
Definition: mdsupport.h:62
#define MD_SUCCESS
Definition: mdsupport.h:60
MY my
Definition: mdsupport.cxx:95
DWORD run
Definition: odbhist.cxx:39
short int event_id
Definition: midas.h:858
DWORD serial_number
Definition: midas.h:860
short int trigger_mask
Definition: midas.h:859
DWORD runn
Definition: mdsupport.cxx:91
INT fmt
Definition: mdsupport.cxx:89
DWORD evtn
Definition: mdsupport.cxx:84
DWORD evtlen
Definition: mdsupport.cxx:86
EVENT_HEADER * pmh
Definition: mdsupport.cxx:80

◆ md_bank_display()

void EXPRT md_bank_display ( void *  pmbh,
void *  pbk,
INT  fmt,
INT  dsp_mode,
INT  dsp_fmt 
)

dox

Definition at line 959 of file mdsupport.cxx.

973 {
974  if (dsp_mode == DSP_RAW)
976  else {
977  if (data_fmt == FORMAT_MIDAS) {
978  if (bk_is32a(pmbh)) {
979  midas_bank_display32<BANK32A>((BANK32A *) pbk, dsp_fmt);
980  } else if (bk_is32(pmbh)) {
981  midas_bank_display32<BANK32>((BANK32 *) pbk, dsp_fmt);
982  } else {
983  midas_bank_display((BANK *) pbk, dsp_fmt);
984  }
985  } else if (data_fmt == FORMAT_YBOS)
986  assert(!"YBOS not supported anymore");
987  }
988  return;
989 }
BOOL bk_is32a(const void *event)
Definition: midas.cxx:16404
BOOL bk_is32(const void *event)
Definition: midas.cxx:16382
#define DSP_RAW
Definition: mdsupport.h:84
void md_raw_bank_display(void *pbank, INT data_fmt, INT dsp_fmt)
Definition: mdsupport.cxx:992
void midas_bank_display(BANK *pbk, INT dsp_fmt)
Definition: mdsupport.cxx:1169
INT data_fmt
Definition: lazylogger.cxx:214
INT dsp_mode
Definition: mdump.cxx:32
INT dsp_fmt
Definition: mdump.cxx:32
Definition: midas.h:1227
Definition: midas.h:1221
Here is the call graph for this function:
Here is the caller graph for this function:

◆ md_bank_event_display()

void md_bank_event_display ( const void *  pevent,
INT  data_fmt,
INT  dsp_fmt,
INT  dsp_mode,
const char *  bn 
)

Definition at line 859 of file mdsupport.cxx.

873 {
875  DWORD *pdata, *pdata1;
876  BANK_HEADER *pbh = NULL;
877  BANK *pmbk;
878  BANK32 *pmbk32;
879  BANK32A *pmbk32a;
880  EVENT_HEADER *pheader;
881  INT status, single = 0;
882 
883  if (data_fmt == FORMAT_YBOS) {
884  assert(!"YBOS not supported anymore");
885  } else if (data_fmt == FORMAT_MIDAS) {
886  /* skip these special events (NO bank structure) */
887  pheader = (EVENT_HEADER *) pevent;
888  if (pheader->event_id == EVENTID_BOR ||
889  pheader->event_id == EVENTID_EOR || pheader->event_id == EVENTID_MESSAGE)
890  return;
891 
892  /* check if format is MIDAS or FIXED */
893  pbh = (BANK_HEADER *) (pheader + 1);
894 
895  /* Check for single bank display request */
896  if (dsp_mode == DSP_BANK_SINGLE) {
897  bk_locate(pbh, bn, &pdata1);
898  single = 1;
899  }
900  /* event header (skip it if in single bank display) */
901  if (!single)
902  printf("Evid:%4.4x- Mask:%4.4x- Serial:%i- Time:0x%x- Dsize:%i/0x%x",
903  (WORD) pheader->event_id, (WORD) pheader->trigger_mask,
904  pheader->serial_number, pheader->time_stamp, pheader->data_size, pheader->data_size);
905 
906  if ((pbh->data_size + 8) == pheader->data_size) {
907  /* bank list */
908  if (!single) {
909  /* Skip list if in single bank display */
910  status = bk_list((BANK_HEADER *) (pheader + 1), banklist);
911  printf("\n#banks:%i - Bank list:-%s-\n", status, banklist);
912  }
913 
914  /* display bank content */
915  if (bk_is32a(pbh)) {
916  pmbk32a = NULL;
917  do {
918  bk_iterate32a(pbh, &pmbk32a, &pdata);
919  if (pmbk32a != NULL)
920  if (single && (pdata == pdata1))
921  midas_bank_display32<BANK32A>(pmbk32a, dsp_fmt);
922  if (!single)
923  if (pmbk32a != NULL)
924  midas_bank_display32<BANK32A>(pmbk32a, dsp_fmt);
925  } while (pmbk32a != NULL);
926  } else if (bk_is32(pbh)) {
927  pmbk32 = NULL;
928  do {
929  bk_iterate32(pbh, &pmbk32, &pdata);
930  if (pmbk32 != NULL)
931  if (single && (pdata == pdata1))
932  midas_bank_display32<BANK32>(pmbk32, dsp_fmt);
933  if (!single)
934  if (pmbk32 != NULL)
935  midas_bank_display32<BANK32>(pmbk32, dsp_fmt);
936  } while (pmbk32 != NULL);
937  } else {
938  pmbk = NULL;
939  do {
940  bk_iterate(pbh, &pmbk, &pdata);
941  if (pmbk != NULL)
942  if (single && (pdata == pdata1))
944  if (!single)
945  if (pmbk != NULL)
947  } while (pmbk != NULL);
948  }
949  } else {
950  printf("\nFIXED event with Midas Header\n");
952  }
953  }
954 
955  return;
956 }
INT bk_iterate32a(const void *event, BANK32A **pbk32a, void *pdata)
Definition: midas.cxx:17070
INT bk_iterate32(const void *event, BANK32 **pbk, void *pdata)
Definition: midas.cxx:17034
INT bk_locate(const void *event, const char *name, void *pdata)
Definition: midas.cxx:16856
INT bk_list(const void *event, char *bklist)
Definition: midas.cxx:16807
INT bk_iterate(const void *event, BANK **pbk, void *pdata)
Definition: midas.cxx:17013
#define MD_STRING_BANKLIST_MAX
Definition: mdsupport.h:100
#define DSP_BANK_SINGLE
Definition: mdsupport.h:87
void md_raw_event_display(const void *pevent, INT data_fmt, INT dsp_fmt)
Definition: mdsupport.cxx:818
int INT
Definition: midas.h:129
#define EVENTID_MESSAGE
Definition: midas.h:908
#define EVENTID_EOR
Definition: midas.h:907
#define EVENTID_BOR
Definition: midas.h:906
#define STRING_BANKLIST_MAX
Definition: midas.h:286
DWORD status
Definition: odbhist.cxx:39
DWORD data_size
Definition: midas.h:1217
DWORD data_size
Definition: midas.h:862
DWORD time_stamp
Definition: midas.h:861
Here is the call graph for this function:
Here is the caller graph for this function:

◆ md_dev_os_read()

INT md_dev_os_read ( INT  handle,
INT  type,
void *  prec,
DWORD  nbytes,
DWORD nread 
)

Definition at line 426 of file mdsupport.cxx.

441 {
442  INT status;
443  if (type == LOG_TYPE_DISK)
444  /* --------- DISK ---------- */
445  {
446  *readn = read(handle, prec, nbytes);
447  if (*readn <= 0)
449  else
450  status = SS_SUCCESS;
451  return status;
452  }
453  /* --------- TAPE ---------- */
454 #ifdef OS_UNIX
455  else if (type == LOG_TYPE_TAPE) {
456  *readn = read(handle, prec, nbytes);
457  if (*readn <= 0)
459  else
460  status = SS_SUCCESS;
461  return status;
462  }
463 #endif
464 
465 #ifdef OS_WINNT
466  else if (type == LOG_TYPE_TAPE) {
467  if (!ReadFile((HANDLE) handle, prec, nbytes, readn, NULL))
468  status = GetLastError();
469  else
470  status = SS_SUCCESS;
471  if (status == ERROR_NO_DATA_DETECTED)
473 
474  return status;
475  }
476 #endif /* OS_WINNT */
477  else
478  return SS_SUCCESS;
479 }
#define SS_SUCCESS
Definition: midas.h:669
#define SS_FILE_ERROR
Definition: midas.h:675
#define SS_END_OF_TAPE
Definition: midas.h:690
#define LOG_TYPE_DISK
Definition: msystem.h:493
#define LOG_TYPE_TAPE
Definition: msystem.h:494
INT type
Definition: mana.cxx:269
#define read(n, a, f)
Definition: midas_macro.h:242
Here is the caller graph for this function:

◆ md_dev_os_write()

INT md_dev_os_write ( INT  handle,
INT  type,
void *  prec,
DWORD  nbytes,
DWORD written 
)

Definition at line 482 of file mdsupport.cxx.

498 {
499  INT status;
500  if (type == LOG_TYPE_DISK)
501 #ifdef OS_WINNT
502  { /* --------- DISK ---------- */
503  WriteFile((HANDLE) handle, (char *) prec, nbytes, written, NULL);
504  status = *written == nbytes ? SS_SUCCESS : SS_FILE_ERROR;
505  return status; /* return for DISK */
506  }
507 #else
508  { /* --------- DISK ---------- */
509  status = *written = write(handle, (char *) prec, nbytes) == (INT) nbytes ? SS_SUCCESS : SS_FILE_ERROR;
510  return status; /* return for DISK */
511  }
512 #endif
513  else if (type == LOG_TYPE_TAPE) { /* --------- TAPE ---------- */
514 #ifdef OS_UNIX
515  do {
516  status = write(handle, (char *) prec, nbytes);
517  } while (status == -1 && errno == EINTR);
518  *written = status;
519  if (*written != nbytes) {
520  cm_msg(MERROR, "any_dev_os_write", "write() status %d, errno %d (%s)", status, errno, strerror(errno));
521  if (errno == EIO)
522  return SS_IO_ERROR;
523  if (errno == ENOSPC)
524  return SS_NO_SPACE;
525  else
526  return SS_TAPE_ERROR;
527  }
528 #endif /* OS_UNIX */
529 
530 #ifdef OS_WINNT
531  WriteFile((HANDLE) handle, (char *) prec, nbytes, written, NULL);
532  if (*written != nbytes) {
533  status = GetLastError();
534  cm_msg(MERROR, "any_dev_os_write", "error %d", status);
535  return SS_IO_ERROR;
536  }
537  return SS_SUCCESS; /* return for TAPE */
538 #endif /* OS_WINNT */
539  } else if (type == LOG_TYPE_FTP)
540 #ifdef HAVE_FTPLIB
541  {
542  *written = status = ftp_send(ftp_con->data, (char *) prec,
543  (int) nbytes) == (int) nbytes ? SS_SUCCESS : SS_FILE_ERROR;
544  return status;
545  }
546 #else
547  {
548  cm_msg(MERROR, "mdsupport", "FTP support not included");
549  return SS_IO_ERROR;
550  }
551 #endif
552  return SS_SUCCESS;
553 }
int ftp_send(int sock, const char *buffer, int n_bytes_to_write)
Definition: ftplib.cxx:346
#define SS_TAPE_ERROR
Definition: midas.h:688
#define SS_IO_ERROR
Definition: midas.h:687
#define SS_NO_SPACE
Definition: midas.h:693
#define MERROR
Definition: midas.h:565
#define LOG_TYPE_FTP
Definition: msystem.h:495
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
Definition: midas.cxx:917
#define write(n, a, f, d)
Definition: midas_macro.h:245
Here is the call graph for this function:
Here is the caller graph for this function:

◆ md_event_display()

void EXPRT md_event_display ( const void *  pevent,
INT  data_fmt,
INT  dsp_mode,
INT  dsp_fmt,
const char *  bn 
)

Definition at line 793 of file mdsupport.cxx.

807 {
808  if (dsp_mode == DSP_RAW)
810  else if ((dsp_mode == DSP_BANK) || (dsp_mode == DSP_BANK_SINGLE))
812  else
813  printf("mdsupport- Unknown format:%i\n", dsp_fmt);
814  return;
815 }
#define DSP_BANK
Definition: mdsupport.h:86
void md_bank_event_display(const void *pevent, INT data_fmt, INT dsp_fmt, INT dsp_mode, const char *bn)
Definition: mdsupport.cxx:859
Here is the call graph for this function:
Here is the caller graph for this function:

◆ md_event_swap()

INT EXPRT md_event_swap ( INT  data_fmt,
void *  pevent 
)

Definition at line 735 of file mdsupport.cxx.

747 {
748  INT status;
749  BANK_HEADER *pbh;
750 
751  if (data_fmt == FORMAT_MIDAS) {
752  if ((((EVENT_HEADER *) pevent)->event_id == EVENTID_BOR) ||
753  (((EVENT_HEADER *) pevent)->event_id == EVENTID_EOR) ||
754  (((EVENT_HEADER *) pevent)->event_id == EVENTID_MESSAGE))
755  return SS_SUCCESS;
756  pbh = (BANK_HEADER *) (((EVENT_HEADER *) pevent) + 1);
757  status = bk_swap(pbh, FALSE);
759  } else if (data_fmt == FORMAT_YBOS) {
760  assert(!"YBOS not supported anymore");
761  }
762 
763  return MD_UNKNOWN_FORMAT;
764 }
#define FALSE
Definition: cfortran.h:309
INT bk_swap(void *event, BOOL force)
Definition: midas.cxx:17124
#define CM_SUCCESS
Definition: midas.h:588
#define MD_EVENT_NOT_SWAPPED
Definition: mdsupport.h:61
#define MD_UNKNOWN_FORMAT
Definition: mdsupport.h:67
#define event_id
Definition: midas_macro.h:234
Here is the call graph for this function:
Here is the caller graph for this function:

◆ md_file_rclose()

INT EXPRT md_file_rclose ( INT  data_fmt)

Definition at line 265 of file mdsupport.cxx.

276 {
277  switch (my.type) {
278  case LOG_TYPE_TAPE:
279  case LOG_TYPE_DISK:
280  /* close file */
281  if (my.zipfile) {
282  gzclose(filegz);
283  } else {
284  if (my.handle != 0)
285  close(my.handle);
286  }
287  break;
288  }
289  if (ptopmrd != NULL)
290  free(ptopmrd);
291  if (my.pmp != NULL)
292  free(my.pmp);
293  my.pmp = NULL;
294  my.pmh = NULL;
295  ptopmrd = NULL;
296  my.pmrd = NULL; /* ptopmrd and my.pmrd point to the same place. K.O. 25-FEB-2005 */
297  return (MD_SUCCESS);
298 }
char * ptopmrd
Definition: mdsupport.cxx:70
gzFile filegz
Definition: mdsupport.cxx:72
char * pmp
Definition: mdsupport.cxx:79
INT type
Definition: mdsupport.cxx:90
INT handle
Definition: mdsupport.cxx:76
char * pmrd
Definition: mdsupport.cxx:82
BOOL zipfile
Definition: mdsupport.cxx:92
Here is the caller graph for this function:

◆ md_file_ropen()

INT EXPRT md_file_ropen ( char *  infile,
INT  data_fmt,
INT  openzip,
INT  max_event_size 
)

dox

Definition at line 183 of file mdsupport.cxx.

196 {
197  /* fill up record with file name */
198  strcpy(my.name, infile);
199 
200  /* find out what dev it is ? : check on /dev */
201  my.zipfile = FALSE;
202  if ((strncmp(my.name, "/dev", 4) == 0) || (strncmp(my.name, "\\\\.\\", 4) == 0)) {
203  /* tape device */
205  } else {
206  /* disk device */
208  if (strncmp(infile + strlen(infile) - 3, ".gz", 3) == 0) {
209  // FALSE will for now prevent the mdump to see inside the .gz
210  // But lazylogger will NOT unzip during copy!
211  if (openzip == 0) my.zipfile = FALSE; // ignore zip, copy blindly blocks
212  else my.zipfile = TRUE; // Open Zip file
213  }
214  }
215 
216  /* open file */
217  if (!my.zipfile) {
218  if (my.type == LOG_TYPE_TAPE) {
219  ss_tape_open(my.name, O_RDONLY | O_BINARY, &my.handle);
220  } else if ((my.handle = open(my.name, O_RDONLY | O_BINARY | O_LARGEFILE, 0644)) == -1) {
221  printf("dev name :%s Handle:%d \n", my.name, my.handle);
222  return (SS_FILE_ERROR);
223  }
224  } else {
225  if (my.type == LOG_TYPE_TAPE) {
226  printf(" Zip on tape not yet supported \n");
227  return (SS_FILE_ERROR);
228  }
229  filegz = gzopen(my.name, "rb");
230  my.handle = 0;
231  if (filegz == NULL) {
232  printf("dev name :%s gzopen error:%d \n", my.name, my.handle);
233  return (SS_FILE_ERROR);
234  }
235  }
236 
237  if (data_fmt == FORMAT_YBOS) {
238  assert(!"YBOS support not supported anymore");
239  } else if (data_fmt == FORMAT_MIDAS) {
240  my.fmt = FORMAT_MIDAS;
242  my.pmp = (char *) malloc(my.size);
243  if (my.pmp == NULL)
244  return SS_NO_MEMORY;
245  my.pme = (EVENT_HEADER *) my.pmp;
246 
247  /* allocate memory for one full event */
248  if (my.pmrd != NULL)
249  free(my.pmrd);
250  my.pmrd = (char *) malloc(5 * max_event_size); /* in bytes */
251  ptopmrd = my.pmrd;
252  if (my.pmrd == NULL)
253  return SS_NO_MEMORY;
254  memset((char *) my.pmrd, -1, 5 * max_event_size);
255  my.pmh = (EVENT_HEADER *) my.pmrd;
256  }
257 
258  /* initialize pertinent variables */
259  my.recn = -1;
260  my.evtn = 0;
261  return (MD_SUCCESS);
262 }
#define SS_NO_MEMORY
Definition: midas.h:671
#define O_BINARY
Definition: msystem.h:219
INT ss_tape_open(char *path, INT oflag, INT *channel)
Definition: system.cxx:5750
INT openzip
Definition: mdump.cxx:33
INT max_event_size
Definition: mfed.cxx:29
#define O_LARGEFILE
Definition: midas.h:210
#define TRUE
Definition: midas.h:182
#define TAPE_BUFFER_SIZE
Definition: midas.h:271
EVENT_HEADER * pme
Definition: mdsupport.cxx:81
DWORD recn
Definition: mdsupport.cxx:88
DWORD size
Definition: mdsupport.cxx:87
char name[128]
Definition: mdsupport.cxx:77
Here is the call graph for this function:
Here is the caller graph for this function:

◆ md_file_wclose()

INT EXPRT md_file_wclose ( INT  handle,
INT  type,
INT  data_fmt,
char *  destination 
)

Definition at line 356 of file mdsupport.cxx.

367 {
368  INT status;
369 
370  status = SS_SUCCESS;
371  switch (type) {
372  case LOG_TYPE_TAPE:
373  /* writing EOF mark on tape Fonly */
374  status = ss_tape_write_eof(handle);
375  ss_tape_close(handle);
376  break;
377  case LOG_TYPE_DISK:
378  /* close file */
379  if (handle != 0)
380 #ifdef OS_WINNT
381  CloseHandle((HANDLE) handle);
382 #else
383  close(handle);
384 #endif
385  break;
386  case LOG_TYPE_FTP:
387 #ifdef HAVE_FTPLIB
388  {
389  char *p, filename[256];
390  int i;
391 
392  ftp_close(ftp_con);
393 
394  /*
395  destination should have the form:
396  host, port, user, password, directory, run%05d.mid, file_mode, command, ...
397  */
398  p = destination;
399  for (i = 0; i < 5 && p != NULL; i++) {
400  p = strchr(p, ',');
401  if (*p == ',')
402  p++;
403  }
404  if (p != NULL) {
405  strlcpy(filename, p, sizeof(filename));
406  if (strchr(filename, ','))
407  *strchr(filename, ',') = 0;
408  } else
409  strlcpy(filename, destination, sizeof(filename));
410 
411  /* if filename starts with a '.' rename it */
412  if (filename[0] == '.')
413  ftp_move(ftp_con, filename, filename + 1);
414 
415  ftp_bye(ftp_con);
416  }
417 #endif
418  break;
419  }
420  if (status != SS_SUCCESS)
421  return status;
422  return (MD_SUCCESS);
423 }
int ftp_close(FTP_CON *con)
Definition: ftplib.cxx:334
int ftp_bye(FTP_CON *con)
Definition: ftplib.cxx:422
int ftp_move(FTP_CON *con, const char *oldname, const char *newname)
Definition: ftplib.cxx:460
INT ss_tape_close(INT channel)
Definition: system.cxx:5841
INT ss_tape_write_eof(INT channel)
Definition: system.cxx:6105
INT i
Definition: mdump.cxx:35
size_t EXPRT strlcpy(char *dst, const char *src, size_t size)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ md_file_wopen()

INT EXPRT md_file_wopen ( INT  type,
INT  data_fmt,
char *  filename,
INT hDev 
)

Definition at line 301 of file mdsupport.cxx.

314 {
315  INT status = 0;
316 
317  if (type == LOG_TYPE_DISK)
318  /* takes care of TapeLX/NT under ss_tape_open , DiskLX/NT here */
319  {
320  if (data_fmt == FORMAT_YBOS) {
321  assert(!"YBOS not supported anymore");
322  } else if (data_fmt == FORMAT_MIDAS) {
323 #ifdef OS_WINNT
324  *hDev =
325  (int) CreateFile(filename, GENERIC_WRITE, FILE_SHARE_READ,
326  NULL, CREATE_ALWAYS,
327  FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH | FILE_FLAG_SEQUENTIAL_SCAN, 0);
328 #else
329  *hDev = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE, 0644);
330 #endif
331  status = *hDev < 0 ? SS_FILE_ERROR : SS_SUCCESS;
332  }
333  } else if (type == LOG_TYPE_TAPE) {
334  if (data_fmt == FORMAT_YBOS) {
335  assert(!"YBOS not supported anymore");
336  } else if (data_fmt == FORMAT_MIDAS)
337  status = ss_tape_open(filename, O_WRONLY | O_CREAT | O_TRUNC, hDev);
338  } else if (type == LOG_TYPE_FTP) {
339 #ifdef HAVE_FTPLIB
340  status = mftp_open(filename, (FTP_CON **) &ftp_con);
341  if (status != SS_SUCCESS) {
342  *hDev = 0;
343  return status;
344  } else
345  *hDev = 1;
346 #else
347  cm_msg(MERROR, "mdsupport", "FTP support not included");
348  return SS_FILE_ERROR;
349 #endif
350  }
351 
352  return status;
353 }
INT hDev
Definition: lazylogger.cxx:210
Definition: ftplib.h:25
Here is the call graph for this function:
Here is the caller graph for this function:

◆ md_log_write()

INT EXPRT md_log_write ( INT  handle,
INT  data_fmt,
INT  type,
void *  prec,
DWORD  nbytes 
)

Definition at line 577 of file mdsupport.cxx.

593 {
594  INT status;
595  DWORD written;
596 
597  status = data_fmt; /* avoid compiler warning */
598  /* write record */
599  status = md_dev_os_write(handle, type, prec, nbytes, &written);
600  return status;
601 }
INT md_dev_os_write(INT handle, INT type, void *prec, DWORD nbytes, DWORD *written)
Definition: mdsupport.cxx:482
Here is the call graph for this function:
Here is the caller graph for this function:

◆ md_physrec_get()

INT EXPRT md_physrec_get ( INT  data_fmt,
void **  precord,
DWORD readn 
)

Definition at line 556 of file mdsupport.cxx.

568 {
569  *precord = my.pmp;
570  if (data_fmt == FORMAT_MIDAS) {
571  return midas_physrec_get(*precord, readn);
572  } else
573  return MD_UNKNOWN_FORMAT;
574 }
INT midas_physrec_get(void *prec, DWORD *readn)
Definition: mdsupport.cxx:1127
Here is the call graph for this function:
Here is the caller graph for this function:

◆ md_raw_bank_display()

void md_raw_bank_display ( void *  pbank,
INT  data_fmt,
INT  dsp_fmt 
)

Definition at line 992 of file mdsupport.cxx.

1005 {
1006  DWORD *pdata = NULL, lrl = 0, j, i;
1007 
1008  if (data_fmt == FORMAT_YBOS) {
1009  assert(!"YBOS not supported any ore");
1010  } else if (data_fmt == FORMAT_MIDAS) {
1011  lrl = ((BANK *) pbank)->data_size >> 2; /* in DWORD */
1012  pdata = (DWORD *) ((BANK *) (pbank) + 1);
1013  }
1014 
1015  for (i = 0; i < lrl; i += NLINE) {
1016  j = 0;
1017  printf("\n%4i-> ", i + j + 1);
1018  for (j = 0; j < NLINE; j++) {
1019  if ((i + j) < lrl) {
1020  if (dsp_fmt == DSP_DEC)
1021  printf("%8.i ", *((DWORD *) pdata));
1022  if (dsp_fmt == DSP_ASC)
1023  printf("%8.8x ", *((DWORD *) pdata));
1024  if (dsp_fmt == DSP_HEX)
1025  printf("%8.8x ", *((DWORD *) pdata));
1026  pdata++;
1027  }
1028  }
1029  }
1030 }
#define DSP_DEC
Definition: mdsupport.h:92
#define DSP_HEX
Definition: mdsupport.h:93
#define DSP_ASC
Definition: mdsupport.h:94
#define NLINE
Definition: mdsupport.h:96
INT j
Definition: odbhist.cxx:40
Here is the caller graph for this function:

◆ md_raw_event_display()

void md_raw_event_display ( const void *  pevent,
INT  data_fmt,
INT  dsp_fmt 
)

Definition at line 818 of file mdsupport.cxx.

831 {
832  DWORD lrl = 0, *pevt = NULL, j, i, total = 0;
833 
834  if (data_fmt == FORMAT_YBOS) {
835  assert(!"YBOS not supported anymore");
836  } else if (data_fmt == FORMAT_MIDAS) {
837  lrl = ((((EVENT_HEADER *) pevent)->data_size) + sizeof(EVENT_HEADER)) /
838  sizeof(DWORD); /* in I*4 for raw including the header */
839  pevt = (DWORD *) pevent; /* local copy starting from the pheader */
840  }
841 
842  for (i = 0; i < lrl; i += NLINE) {
843  printf("%6.0d->: ", total);
844  for (j = 0; j < NLINE; j++) {
845  if ((i + j) < lrl) {
846  if (dsp_fmt == DSP_DEC)
847  printf("%8.i ", *pevt);
848  else
849  printf("%8.8x ", *pevt);
850  pevt++;
851  }
852  }
853  total += NLINE;
854  printf("\n");
855  }
856 }
double total[100]
Definition: odbhist.cxx:42
Here is the caller graph for this function:

◆ midas_bank_display()

void midas_bank_display ( BANK pbk,
INT  dsp_fmt 
)

Definition at line 1169 of file mdsupport.cxx.

1181 {
1182  char bank_name[5], strbktype[32];
1183  char *pdata, *pendbk;
1184  DWORD length_type = 0, lrl;
1185  INT type, i, j;
1186 
1187  lrl = pbk->data_size; /* in bytes */
1188  type = pbk->type & 0xff;
1189  bank_name[4] = 0;
1190  memcpy(bank_name, (char *) (pbk->name), 4);
1191  pdata = (char *) (pbk + 1);
1192 
1193  j = 64; /* elements within line */
1194  i = 1; /* data counter */
1195  strcpy(strbktype, "Unknown format");
1196  if (type == TID_DOUBLE) {
1197  length_type = sizeof(double);
1198  strcpy(strbktype, "double*8");
1199  }
1200  if (type == TID_FLOAT) {
1201  length_type = sizeof(float);
1202  strcpy(strbktype, "Real*4 (FMT machine dependent)");
1203  }
1204  if (type == TID_UINT64) {
1205  length_type = sizeof(uint64_t);
1206  strcpy(strbktype, "Unsigned Integer*8");
1207  }
1208  if (type == TID_INT64) {
1209  length_type = sizeof(int64_t);
1210  strcpy(strbktype, "Signed Integer*8");
1211  }
1212  if (type == TID_DWORD) {
1213  length_type = sizeof(DWORD);
1214  strcpy(strbktype, "Unsigned Integer*4");
1215  }
1216  if (type == TID_INT) {
1217  length_type = sizeof(INT);
1218  strcpy(strbktype, "Signed Integer*4");
1219  }
1220  if (type == TID_WORD) {
1221  length_type = sizeof(WORD);
1222  strcpy(strbktype, "Unsigned Integer*2");
1223  }
1224  if (type == TID_SHORT) {
1225  length_type = sizeof(short);
1226  strcpy(strbktype, "Signed Integer*2");
1227  }
1228  if (type == TID_BYTE) {
1229  length_type = sizeof(BYTE);
1230  strcpy(strbktype, "Unsigned Bytes");
1231  }
1232  if (type == TID_SBYTE) {
1233  length_type = sizeof(BYTE);
1234  strcpy(strbktype, "Signed Bytes");
1235  }
1236  if (type == TID_BOOL) {
1237  length_type = sizeof(DWORD);
1238  strcpy(strbktype, "Boolean");
1239  }
1240  if (type == TID_CHAR) {
1241  length_type = sizeof(char);
1242  strcpy(strbktype, "8 bit ASCII");
1243  }
1244  if (type == TID_STRUCT) {
1245  length_type = sizeof(char);
1246  strcpy(strbktype, "STRUCT (not supported->8 bits)");
1247  }
1248  if (type == TID_STRING) {
1249  length_type = sizeof(char);
1250  strcpy(strbktype, "String 8bit ASCII");
1251  }
1252 
1253  printf("\nBank:%s Length: %i(I*1)/%i(I*4)/%i(Type) Type:%s",
1254  bank_name, lrl, lrl >> 2, lrl / (length_type == 0 ? 1 : length_type), strbktype);
1255 
1256  pendbk = pdata + lrl;
1257  while (pdata < pendbk) {
1258  switch (type) {
1259  case TID_DOUBLE:
1260  if (j > 3) {
1261  printf("\n%4i-> ", i);
1262  j = 0;
1263  i += 4;
1264  }
1265  printf("%15.5le ", *((double *) pdata));
1266  pdata = (char *) (((double *) pdata) + 1);
1267  j++;
1268  break;
1269  case TID_FLOAT:
1270  if (j > 7) {
1271  printf("\n%4i-> ", i);
1272  j = 0;
1273  i += 8;
1274  }
1275  if ((dsp_fmt == DSP_DEC) || (dsp_fmt == DSP_UNK))
1276  printf("%8.3e ", *((float *) pdata));
1277  if (dsp_fmt == DSP_HEX)
1278  printf("0x%8.8x ", *((DWORD *) pdata));
1279  pdata = (char *) (((DWORD *) pdata) + 1);
1280  j++;
1281  break;
1282  case TID_UINT64:
1283  if (j > 7) {
1284  printf("\n%4i-> ", i);
1285  j = 0;
1286  i += 8;
1287  }
1288  if (dsp_fmt == DSP_DEC)
1289  printf("%16.1llu ", (long long unsigned) *((uint64_t *) pdata));
1290  if ((dsp_fmt == DSP_HEX) || (dsp_fmt == DSP_UNK))
1291  printf("0x%16.16llx ", (long long unsigned) *((uint64_t *) pdata));
1292  pdata = (char *) (((uint64_t *) pdata) + 1);
1293  j++;
1294  break;
1295  case TID_INT64:
1296  if (j > 7) {
1297  printf("\n%4i-> ", i);
1298  j = 0;
1299  i += 8;
1300  }
1301  if ((dsp_fmt == DSP_DEC) || (dsp_fmt == DSP_UNK))
1302  printf("%16.1lli ", (long long int) *((int64_t *) pdata));
1303  if (dsp_fmt == DSP_HEX)
1304  printf("0x%16.16llx ", (long long unsigned int) *((int64_t *) pdata));
1305  pdata = (char *) (((int64_t *) pdata) + 1);
1306  j++;
1307  break;
1308  case TID_DWORD:
1309  if (j > 7) {
1310  printf("\n%4i-> ", i);
1311  j = 0;
1312  i += 8;
1313  }
1314  if (dsp_fmt == DSP_DEC)
1315  printf("%8.1i ", *((DWORD *) pdata));
1316  if ((dsp_fmt == DSP_HEX) || (dsp_fmt == DSP_UNK))
1317  printf("0x%8.8x ", *((DWORD *) pdata));
1318  pdata = (char *) (((DWORD *) pdata) + 1);
1319  j++;
1320  break;
1321  case TID_INT:
1322  if (j > 7) {
1323  printf("\n%4i-> ", i);
1324  j = 0;
1325  i += 8;
1326  }
1327  if ((dsp_fmt == DSP_DEC) || (dsp_fmt == DSP_UNK))
1328  printf("%8.1i ", *((DWORD *) pdata));
1329  if (dsp_fmt == DSP_HEX)
1330  printf("0x%8.8x ", *((DWORD *) pdata));
1331  pdata = (char *) (((DWORD *) pdata) + 1);
1332  j++;
1333  break;
1334  case TID_WORD:
1335  if (j > 7) {
1336  printf("\n%4i-> ", i);
1337  j = 0;
1338  i += 8;
1339  }
1340  if (dsp_fmt == DSP_DEC)
1341  printf("%5.1i ", *((WORD *) pdata));
1342  if ((dsp_fmt == DSP_HEX) || (dsp_fmt == DSP_UNK))
1343  printf("0x%4.4x ", *((WORD *) pdata));
1344  pdata = (char *) (((WORD *) pdata) + 1);
1345  j++;
1346  break;
1347  case TID_SHORT:
1348  if (j > 7) {
1349  printf("\n%4i-> ", i);
1350  j = 0;
1351  i += 8;
1352  }
1353  if ((dsp_fmt == DSP_DEC) || (dsp_fmt == DSP_UNK))
1354  printf("%5.1i ", *((short *) pdata));
1355  if (dsp_fmt == DSP_HEX)
1356  printf("0x%4.4x ", *((short *) pdata));
1357  pdata = (char *) (((short *) pdata) + 1);
1358  j++;
1359  break;
1360  case TID_BYTE:
1361  case TID_STRUCT:
1362  if (j > 15) {
1363  printf("\n%4i-> ", i);
1364  j = 0;
1365  i += 16;
1366  }
1367  if (dsp_fmt == DSP_DEC)
1368  printf("%4.i ", *((BYTE *) pdata));
1369  if ((dsp_fmt == DSP_HEX) || (dsp_fmt == DSP_UNK))
1370  printf("0x%2.2x ", *((BYTE *) pdata));
1371  pdata++;
1372  j++;
1373  break;
1374  case TID_SBYTE:
1375  if (j > 15) {
1376  printf("\n%4i-> ", i);
1377  j = 0;
1378  i += 16;
1379  }
1380  if ((dsp_fmt == DSP_DEC) || (dsp_fmt == DSP_UNK))
1381  printf("%4.i ", *((BYTE *) pdata));
1382  if (dsp_fmt == DSP_HEX)
1383  printf("0x%2.2x ", *((BYTE *) pdata));
1384  pdata++;
1385  j++;
1386  break;
1387  case TID_BOOL:
1388  if (j > 15) {
1389  printf("\n%4i-> ", i);
1390  j = 0;
1391  i += 16;
1392  }
1393  (*((BOOL *) pdata) != 0) ? printf("Y ") : printf("N ");
1394  pdata = (char *) (((DWORD *) pdata) + 1);
1395  j++;
1396  break;
1397  case TID_CHAR:
1398  case TID_STRING:
1399  if (j > 15) {
1400  printf("\n%4i-> ", i);
1401  j = 0;
1402  i += 16;
1403  }
1404  if (dsp_fmt == DSP_DEC)
1405  printf("%3.i ", *((BYTE *) pdata));
1406  if ((dsp_fmt == DSP_ASC) || (dsp_fmt == DSP_UNK))
1407  printf("%1.1s ", (char *) pdata);
1408  if (dsp_fmt == DSP_HEX)
1409  printf("0x%2.2x ", *((BYTE *) pdata));
1410  pdata++;
1411  j++;
1412  break;
1413  default:
1414  printf("bank type not supported (%d)\n", type);
1415  return;
1416  break;
1417  }
1418  } /* end of bank */
1419  printf("\n");
1420  return;
1421 }
unsigned char BYTE
Definition: mcstd.h:48
#define TID_DOUBLE
Definition: midas.h:350
#define TID_SBYTE
Definition: midas.h:336
#define TID_BOOL
Definition: midas.h:347
#define TID_SHORT
Definition: midas.h:341
#define TID_UINT64
Definition: midas.h:359
#define TID_INT64
Definition: midas.h:358
#define TID_WORD
Definition: midas.h:339
#define TID_BYTE
Definition: midas.h:334
#define TID_STRUCT
Definition: midas.h:355
#define TID_STRING
Definition: midas.h:353
#define TID_CHAR
Definition: midas.h:338
#define TID_INT
Definition: midas.h:345
#define TID_FLOAT
Definition: midas.h:348
#define TID_DWORD
Definition: midas.h:343
#define DSP_UNK
Definition: mdsupport.h:91
char bank_name[4]
Definition: mdump.cxx:29
#define DWORD
Definition: mhdump.cxx:31
DWORD BOOL
Definition: midas.h:105
char name[4]
Definition: midas.h:1222
WORD type
Definition: midas.h:1223
WORD data_size
Definition: midas.h:1224
Here is the caller graph for this function:

◆ midas_bank_display32()

template<typename T >
void midas_bank_display32 ( T *  pbk,
INT  dsp_fmt 
)

Definition at line 1425 of file mdsupport.cxx.

1438 {
1439  char bank_name[5], strbktype[32];
1440  char *pdata, *pendbk;
1441  DWORD length_type = 0, lrl;
1442  INT type, i, j;
1443 
1444  lrl = pbk->data_size; /* in bytes */
1445  type = pbk->type & 0xff;
1446  bank_name[4] = 0;
1447  memcpy(bank_name, (char *) (pbk->name), 4);
1448  pdata = (char *) (pbk + 1);
1449 
1450  j = 64; /* elements within line */
1451  i = 1; /* data counter */
1452  strcpy(strbktype, "Unknown format");
1453  if (type == TID_DOUBLE) {
1454  length_type = sizeof(double);
1455  strcpy(strbktype, "double*8");
1456  }
1457  if (type == TID_FLOAT) {
1458  length_type = sizeof(float);
1459  strcpy(strbktype, "Real*4 (FMT machine dependent)");
1460  }
1461  if (type == TID_UINT64) {
1462  length_type = sizeof(uint64_t);
1463  strcpy(strbktype, "Unsigned Integer*8");
1464  }
1465  if (type == TID_INT64) {
1466  length_type = sizeof(int64_t);
1467  strcpy(strbktype, "Signed Integer*8");
1468  }
1469  if (type == TID_DWORD) {
1470  length_type = sizeof(DWORD);
1471  strcpy(strbktype, "Unsigned Integer*4");
1472  }
1473  if (type == TID_INT) {
1474  length_type = sizeof(INT);
1475  strcpy(strbktype, "Signed Integer*4");
1476  }
1477  if (type == TID_WORD) {
1478  length_type = sizeof(WORD);
1479  strcpy(strbktype, "Unsigned Integer*2");
1480  }
1481  if (type == TID_SHORT) {
1482  length_type = sizeof(short);
1483  strcpy(strbktype, "Signed Integer*2");
1484  }
1485  if (type == TID_BYTE) {
1486  length_type = sizeof(BYTE);
1487  strcpy(strbktype, "Unsigned Bytes");
1488  }
1489  if (type == TID_SBYTE) {
1490  length_type = sizeof(BYTE);
1491  strcpy(strbktype, "Signed Bytes");
1492  }
1493  if (type == TID_BOOL) {
1494  length_type = sizeof(DWORD);
1495  strcpy(strbktype, "Boolean");
1496  }
1497  if (type == TID_CHAR) {
1498  length_type = sizeof(char);
1499  strcpy(strbktype, "8 bit ASCII");
1500  }
1501  if (type == TID_STRUCT) {
1502  length_type = sizeof(char);
1503  strcpy(strbktype, "STRUCT (not supported->8 bits)");
1504  }
1505  if (type == TID_STRING) {
1506  length_type = sizeof(char);
1507  strcpy(strbktype, "String 8bit ASCI");
1508  }
1509 
1510  printf("\nBank:%s Length: %i(I*1)/%i(I*4)/%i(Type) Type:%s",
1511  bank_name, lrl, lrl >> 2, lrl / (length_type == 0 ? 1 : length_type), strbktype);
1512 
1513  pendbk = pdata + lrl;
1514  while (pdata < pendbk) {
1515  switch (type) {
1516  case TID_DOUBLE:
1517  if (j > 3) {
1518  printf("\n%4i-> ", i);
1519  j = 0;
1520  i += 4;
1521  }
1522  printf("%15.5e ", *((double *) pdata));
1523  pdata = (char *) (((double *) pdata) + 1);
1524  j++;
1525  break;
1526  case TID_FLOAT:
1527  if (j > 7) {
1528  printf("\n%4i-> ", i);
1529  j = 0;
1530  i += 8;
1531  }
1532  if ((dsp_fmt == DSP_DEC) || (dsp_fmt == DSP_UNK))
1533  printf("%8.3e ", *((float *) pdata));
1534  if (dsp_fmt == DSP_HEX)
1535  printf("0x%8.8x ", *((DWORD *) pdata));
1536  pdata = (char *) (((DWORD *) pdata) + 1);
1537  j++;
1538  break;
1539  case TID_UINT64:
1540  if (j > 7) {
1541  printf("\n%4i-> ", i);
1542  j = 0;
1543  i += 8;
1544  }
1545  if (dsp_fmt == DSP_DEC)
1546  printf("%16.1llu ", (long long unsigned int) *((uint64_t *) pdata));
1547  if ((dsp_fmt == DSP_HEX) || (dsp_fmt == DSP_UNK))
1548  printf("0x%16.16llx ", (long long unsigned int) *((uint64_t *) pdata));
1549  pdata = (char *) (((uint64_t *) pdata) + 1);
1550  j++;
1551  break;
1552  case TID_INT64:
1553  if (j > 7) {
1554  printf("\n%4i-> ", i);
1555  j = 0;
1556  i += 8;
1557  }
1558  if ((dsp_fmt == DSP_DEC) || (dsp_fmt == DSP_UNK))
1559  printf("%16.1lli ", (long long int) *((int64_t *) pdata));
1560  if (dsp_fmt == DSP_HEX)
1561  printf("0x%16.16llx ", (long long unsigned int) *((int64_t *) pdata));
1562  pdata = (char *) (((int64_t *) pdata) + 1);
1563  j++;
1564  break;
1565  case TID_DWORD:
1566  if (j > 7) {
1567  printf("\n%4i-> ", i);
1568  j = 0;
1569  i += 8;
1570  }
1571  if (dsp_fmt == DSP_DEC)
1572  printf("%8.1i ", *((DWORD *) pdata));
1573  if ((dsp_fmt == DSP_HEX) || (dsp_fmt == DSP_UNK))
1574  printf("0x%8.8x ", *((DWORD *) pdata));
1575  pdata = (char *) (((DWORD *) pdata) + 1);
1576  j++;
1577  break;
1578  case TID_INT:
1579  if (j > 7) {
1580  printf("\n%4i-> ", i);
1581  j = 0;
1582  i += 8;
1583  }
1584  if ((dsp_fmt == DSP_DEC) || (dsp_fmt == DSP_UNK))
1585  printf("%8.1i ", *((DWORD *) pdata));
1586  if (dsp_fmt == DSP_HEX)
1587  printf("0x%8.8x ", *((DWORD *) pdata));
1588  pdata = (char *) (((DWORD *) pdata) + 1);
1589  j++;
1590  break;
1591  case TID_WORD:
1592  if (j > 7) {
1593  printf("\n%4i-> ", i);
1594  j = 0;
1595  i += 8;
1596  }
1597  if (dsp_fmt == DSP_DEC)
1598  printf("%5.1i ", *((WORD *) pdata));
1599  if ((dsp_fmt == DSP_HEX) || (dsp_fmt == DSP_UNK))
1600  printf("0x%4.4x ", *((WORD *) pdata));
1601  pdata = (char *) (((WORD *) pdata) + 1);
1602  j++;
1603  break;
1604  case TID_SHORT:
1605  if (j > 7) {
1606  printf("\n%4i-> ", i);
1607  j = 0;
1608  i += 8;
1609  }
1610  if ((dsp_fmt == DSP_DEC) || (dsp_fmt == DSP_UNK))
1611  printf("%5.1i ", *((short *) pdata));
1612  if (dsp_fmt == DSP_HEX)
1613  printf("0x%4.4x ", *((short *) pdata));
1614  pdata = (char *) (((short *) pdata) + 1);
1615  j++;
1616  break;
1617  case TID_BYTE:
1618  case TID_STRUCT:
1619  if (j > 15) {
1620  printf("\n%4i-> ", i);
1621  j = 0;
1622  i += 16;
1623  }
1624  if (dsp_fmt == DSP_DEC)
1625  printf("%4.i ", *((BYTE *) pdata));
1626  if ((dsp_fmt == DSP_HEX) || (dsp_fmt == DSP_UNK))
1627  printf("0x%2.2x ", *((BYTE *) pdata));
1628  pdata++;
1629  j++;
1630  break;
1631  case TID_SBYTE:
1632  if (j > 15) {
1633  printf("\n%4i-> ", i);
1634  j = 0;
1635  i += 16;
1636  }
1637  if ((dsp_fmt == DSP_DEC) || (dsp_fmt == DSP_UNK))
1638  printf("%4.i ", *((BYTE *) pdata));
1639  if (dsp_fmt == DSP_HEX)
1640  printf("0x%2.2x ", *((BYTE *) pdata));
1641  pdata++;
1642  j++;
1643  break;
1644  case TID_BOOL:
1645  if (j > 15) {
1646  printf("\n%4i-> ", i);
1647  j = 0;
1648  i += 16;
1649  }
1650  (*((BOOL *) pdata) != 0) ? printf("Y ") : printf("N ");
1651  pdata = (char *) (((DWORD *) pdata) + 1);
1652  j++;
1653  break;
1654  case TID_CHAR:
1655  case TID_STRING:
1656  if (j > 15) {
1657  printf("\n%4i-> ", i);
1658  j = 0;
1659  i += 16;
1660  }
1661  if (dsp_fmt == DSP_DEC)
1662  printf("%3.i ", *((BYTE *) pdata));
1663  if (dsp_fmt == DSP_ASC || (dsp_fmt == DSP_UNK))
1664  printf("%1.1s ", (char *) pdata);
1665  if (dsp_fmt == DSP_HEX)
1666  printf("0x%2.2x ", *((BYTE *) pdata));
1667  pdata++;
1668  j++;
1669  break;
1670  default:
1671  printf("bank type not supported (%d)\n", type);
1672  return;
1673  break;
1674  }
1675  } /* end of bank */
1676  printf("\n");
1677  return;
1678 }

◆ midas_event_get()

INT midas_event_get ( void **  pevent,
DWORD size 
)

◆ midas_event_skip()

INT midas_event_skip ( INT  evtn)

◆ midas_physrec_get()

INT midas_physrec_get ( void *  prec,
DWORD readn 
)

Definition at line 1127 of file mdsupport.cxx.

1145 {
1146  INT status = 0;
1147 
1148  /* read one block of data */
1149  if (!my.zipfile) {
1150  status = md_dev_os_read(my.handle, my.type, prec, my.size, readn);
1151  } else {
1152  *readn = gzread(filegz, (char *) prec, my.size);
1153  if (*readn <= 0)
1155  else
1156  status = SS_SUCCESS;
1157  }
1158 
1159  if (status != SS_SUCCESS) {
1160  return (MD_DONE);
1161  } else {
1162  /* count blocks */
1163  my.recn++;
1164  return (MD_SUCCESS);
1165  }
1166 }
INT md_dev_os_read(INT handle, INT type, void *prec, DWORD nbytes, DWORD *nread)
Definition: mdsupport.cxx:426
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ filegz

gzFile filegz

Definition at line 72 of file mdsupport.cxx.

◆ filestat

struct stat* filestat

Definition at line 69 of file mdsupport.cxx.

◆ my

MY my

Definition at line 95 of file mdsupport.cxx.

◆ ptopmrd

char* ptopmrd

Definition at line 70 of file mdsupport.cxx.