当前位置: 首页>>代码示例>>C++>>正文


C++ TRACEMS1函数代码示例

本文整理汇总了C++中TRACEMS1函数的典型用法代码示例。如果您正苦于以下问题:C++ TRACEMS1函数的具体用法?C++ TRACEMS1怎么用?C++ TRACEMS1使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TRACEMS1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: get_app0

METHODDEF       boolean get_app0(j_decompress_ptr cinfo)
/* Process an APP0 marker */
{
#define JFIF_LEN 14
	INT32           length;
	UINT8           b[JFIF_LEN];
	int             buffp;

	INPUT_VARS(cinfo);

	INPUT_2BYTES(cinfo, length, return FALSE);
	length -= 2;

	/* See if a JFIF APP0 marker is present */

	if(length >= JFIF_LEN)
	{
		for(buffp = 0; buffp < JFIF_LEN; buffp++)
			INPUT_BYTE(cinfo, b[buffp], return FALSE);
		length -= JFIF_LEN;

		if(b[0] == 0x4A && b[1] == 0x46 && b[2] == 0x49 && b[3] == 0x46 && b[4] == 0)
		{
			/* Found JFIF APP0 marker: check version */
			/* Major version must be 1, anything else signals an incompatible change.
			 * We used to treat this as an error, but now it's a nonfatal warning,
			 * because some bozo at Hijaak couldn't read the spec.
			 * Minor version should be 0..2, but process anyway if newer.
			 */
			if(b[5] != 1)
				WARNMS2(cinfo, JWRN_JFIF_MAJOR, b[5], b[6]);
			else if(b[6] > 2)
				TRACEMS2(cinfo, 1, JTRC_JFIF_MINOR, b[5], b[6]);
			/* Save info */
			cinfo->saw_JFIF_marker = TRUE;
			cinfo->density_unit = b[7];
			cinfo->X_density = (b[8] << 8) + b[9];
			cinfo->Y_density = (b[10] << 8) + b[11];
			TRACEMS3(cinfo, 1, JTRC_JFIF, cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
			if(b[12] | b[13])
				TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, b[12], b[13]);
			if(length != ((INT32) b[12] * (INT32) b[13] * (INT32) 3))
				TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)length);
		}
		else
		{
			/* Start of APP0 does not match "JFIF" */
			TRACEMS1(cinfo, 1, JTRC_APP0, (int)length + JFIF_LEN);
		}
	}
	else
	{
开发者ID:redrumrobot,项目名称:dretchstorm,代码行数:52,代码来源:jdmarker.c

示例2: open_ems_store

LOCAL           boolean open_ems_store(j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed)
{
	EMScontext      ctx;

	/* Is EMS driver there? */
	if(!jems_available())
		return FALSE;

	/* Get status, make sure EMS is OK */
	ctx.ax = 0x4000;
	jems_calldriver((EMScontext far *) & ctx);
	if(HIBYTE(ctx.ax) != 0)
		return FALSE;

	/* Get version, must be >= 4.0 */
	ctx.ax = 0x4600;
	jems_calldriver((EMScontext far *) & ctx);
	if(HIBYTE(ctx.ax) != 0 || LOBYTE(ctx.ax) < 0x40)
		return FALSE;

	/* Try to allocate requested space */
	ctx.ax = 0x4300;
	ctx.bx = (unsigned short)((total_bytes_needed + EMSPAGESIZE - 1L) / EMSPAGESIZE);
	jems_calldriver((EMScontext far *) & ctx);
	if(HIBYTE(ctx.ax) != 0)
		return FALSE;

	/* Succeeded, save the handle and away we go */
	info->handle.ems_handle = ctx.dx;
	info->read_backing_store = read_ems_store;
	info->write_backing_store = write_ems_store;
	info->close_backing_store = close_ems_store;
	TRACEMS1(cinfo, 1, JTRC_EMS_OPEN, ctx.dx);
	return TRUE;				/* succeeded */
}
开发者ID:SinSiXX,项目名称:Rogue-Reborn,代码行数:35,代码来源:jmemdos.c

示例3: open_xms_store

open_xms_store (j_common_ptr cinfo, backing_store_ptr info,
		long total_bytes_needed)
{
  XMScontext ctx;

  /* Get address of XMS driver */
  jxms_getdriver((XMSDRIVER far *) & xms_driver);
  if (xms_driver == NULL)
    return FALSE;		/* no driver to be had */

  /* Get version number, must be >= 2.00 */
  ctx.ax = 0x0000;
  jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
  if (ctx.ax < (unsigned short) 0x0200)
    return FALSE;

  /* Try to get space (expressed in kilobytes) */
  ctx.dx = (unsigned short) ((total_bytes_needed + 1023L) >> 10);
  ctx.ax = 0x0900;
  jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
  if (ctx.ax != 1)
    return FALSE;

  /* Succeeded, save the handle and away we go */
  info->handle.xms_handle = ctx.dx;
  info->read_backing_store = read_xms_store;
  info->write_backing_store = write_xms_store;
  info->close_backing_store = close_xms_store;
  TRACEMS1(cinfo, 1, JTRC_XMS_OPEN, ctx.dx);
  return TRUE;			/* succeeded */
}
开发者ID:deepmatrix,项目名称:blaxxun-cc3d,代码行数:31,代码来源:jmemdos.c

示例4: select_ncolors

/*LOCAL*/static void create_colormap (j_decompress_ptr cinfo)
{
	my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
	JSAMPARRAY colormap;		/* Created colormap */
	int total_colors;		/* Number of distinct output colors */
	int i, j, k, nci, blksize, blkdist, ptr, val;

	/* Select number of colors for each component */
	total_colors = select_ncolors(cinfo, cquantize->Ncolors);

	/* Report selected color counts */
	if (cinfo->out_color_components == 3)
	{	TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS,
			 total_colors, cquantize->Ncolors[0],
			 cquantize->Ncolors[1], cquantize->Ncolors[2]);
	}
	else
	{	TRACEMS1(cinfo, 1, JTRC_QUANT_NCOLORS, total_colors);
	}
	/* Allocate and fill in the colormap. */
	/* The colors are ordered in the map in standard row-major order, */
	/* i.e. rightmost (highest-indexed) color changes most rapidly. */

	colormap = (*cinfo->mem->alloc_sarray)
		((j_common_ptr) cinfo, JPOOL_IMAGE,
		 (JDIMENSION) total_colors, (JDIMENSION) cinfo->out_color_components);

	/* blksize is number of adjacent repeated entries for a component */
	/* blkdist is distance between groups of identical entries for a component */
	blkdist = total_colors;

	for (i = 0; i < cinfo->out_color_components; i++)
	{
		/* fill in colormap entries for i'th color component */
		nci = cquantize->Ncolors[i]; /* # of distinct values for this color */
		blksize = blkdist / nci;
		for (j = 0; j < nci; j++)
		{
			/* Compute j'th output value (out of nci) for component */
			val = output_value(cinfo, i, j, nci-1);
			/* Fill in all colormap entries that have this value of this component */
			for (ptr = j * blksize; ptr < total_colors; ptr += blkdist)
			{
				/* fill in blksize entries beginning at ptr */
				for (k = 0; k < blksize; k++)
				{	colormap[i][ptr+k] = (JSAMPLE) val; 	}
			}
		}
		blkdist = blksize;		/* blksize of this color is blkdist of next */
	}

	/* Save the colormap in private storage,
	 * where it will survive color quantization mode changes.
	 */
	cquantize->sv_colormap	= colormap;
	cquantize->sv_actual	= total_colors;
}
开发者ID:GovanifY,项目名称:kene-touhou-mohofu,代码行数:57,代码来源:jquant1.c

示例5: get_app0

METHODDEF boolean
get_app0 (j_decompress_ptr cinfo)
/* Process an APP0 marker */
{
#define JFIF_LEN 14
  INT32 length;
  UINT8 b[JFIF_LEN];
  int buffp;
  INPUT_VARS(cinfo);

  INPUT_2BYTES(cinfo, length, return FALSE);
  length -= 2;

  /* See if a JFIF APP0 marker is present */

  if (length >= JFIF_LEN) {
    for (buffp = 0; buffp < JFIF_LEN; buffp++)
      INPUT_BYTE(cinfo, b[buffp], return FALSE);
    length -= JFIF_LEN;

    if (b[0]==0x4A && b[1]==0x46 && b[2]==0x49 && b[3]==0x46 && b[4]==0) {
      /* Found JFIF APP0 marker: check version */
      /* Major version must be 1 */
      if (b[5] != 1)
	ERREXIT2(cinfo, JERR_JFIF_MAJOR, b[5], b[6]);
      /* Minor version should be 0..2, but try to process anyway if newer */
      if (b[6] > 2)
	TRACEMS2(cinfo, 1, JTRC_JFIF_MINOR, b[5], b[6]);
      /* Save info */
      cinfo->saw_JFIF_marker = TRUE;
      cinfo->density_unit = b[7];
      cinfo->X_density = (b[8] << 8) + b[9];
      cinfo->Y_density = (b[10] << 8) + b[11];
      TRACEMS3(cinfo, 1, JTRC_JFIF,
	       cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
      if (b[12] | b[13])
	TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, b[12], b[13]);
      if (length != ((INT32) b[12] * (INT32) b[13] * (INT32) 3))
	TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) length);
    } else {
      /* Start of APP0 does not match "JFIF" */
      TRACEMS1(cinfo, 1, JTRC_APP0, (int) length + JFIF_LEN);
    }
  } else {
开发者ID:Jonnyliu,项目名称:Rmtsvc,代码行数:44,代码来源:jdmarker.c

示例6: close_xms_store

close_xms_store (j_common_ptr cinfo, backing_store_ptr info)
{
  XMScontext ctx;

  ctx.dx = info->handle.xms_handle;
  ctx.ax = 0x0a00;
  jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
  TRACEMS1(cinfo, 1, JTRC_XMS_CLOSE, info->handle.xms_handle);
  /* we ignore any error return from the driver */
}
开发者ID:deepmatrix,项目名称:blaxxun-cc3d,代码行数:10,代码来源:jmemdos.c

示例7: close_ems_store

close_ems_store (j_common_ptr cinfo, backing_store_ptr info)
{
  EMScontext ctx;

  ctx.ax = 0x4500;
  ctx.dx = info->handle.ems_handle;
  jems_calldriver((EMScontext far *) & ctx);
  TRACEMS1(cinfo, 1, JTRC_EMS_CLOSE, info->handle.ems_handle);
  /* we ignore any error return from the driver */
}
开发者ID:deepmatrix,项目名称:blaxxun-cc3d,代码行数:10,代码来源:jmemdos.c

示例8: close_file_store

METHODDEF void
close_file_store (backing_store_ptr info)
{
  jdos_close(info->handle.file_handle);	/* close the file */
  remove(info->temp_name);	/* delete the file */
/* If your system doesn't have remove(), try unlink() instead.
 * remove() is the ANSI-standard name for this function, but
 * unlink() was more common in pre-ANSI systems.
 */
  TRACEMS1(methods, 1, "Closed DOS file %d", info->handle.file_handle);
}
开发者ID:OS2World,项目名称:APP-GRAPHICS-X11-XLOADIMAGE,代码行数:11,代码来源:jmemdos.c

示例9: close_ems_store

METHODDEF void
close_ems_store (backing_store_ptr info)
{
  EMScontext ctx;

  ctx.ax = 0x4500;
  ctx.dx = info->handle.ems_handle;
  jems_calldriver((EMScontext far *) & ctx);
  TRACEMS1(methods, 1, "Freed EMS handle %u", info->handle.ems_handle);
  /* we ignore any error return from the driver */
}
开发者ID:OS2World,项目名称:APP-GRAPHICS-X11-XLOADIMAGE,代码行数:11,代码来源:jmemdos.c

示例10: close_xms_store

METHODDEF void
close_xms_store (backing_store_ptr info)
{
  XMScontext ctx;

  ctx.dx = info->handle.xms_handle;
  ctx.ax = 0x0a00;
  jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
  TRACEMS1(methods, 1, "Freed XMS handle %u", info->handle.xms_handle);
  /* we ignore any error return from the driver */
}
开发者ID:OS2World,项目名称:APP-GRAPHICS-X11-XLOADIMAGE,代码行数:11,代码来源:jmemdos.c

示例11: read_synamps_push_keys

/* This subroutine encapsulates the coding of the different event codes
 * into a unified signed code */
LOCAL void
read_synamps_push_keys(transform_info_ptr tinfo, long position, int TrigVal, int KeyPad, int KeyBoard, enum NEUROSCAN_ACCEPTVALUES Accept) {
 struct read_synamps_storage * const local_arg=(struct read_synamps_storage *)tinfo->methods->local_storage;
 int code;
 if (Accept!=0 && (Accept<NAV_DCRESET || Accept>NAV_STARTSTOP)) {
  TRACEMS2(tinfo->emethods, 0, "read_synamps_push_keys: Unknown Accept value %d at position %d!\n", MSGPARM(Accept), MSGPARM(position));
  return;
 }
 code=TrigVal-KeyPad+neuroscan_accept_translation[Accept];
 if (code==0) {
  /* At least in Edit 4.x, KeyPad F2 is written as KeyBoard=0 with everything else 0 too... */
  code= -(((KeyBoard&0xf)+1)<<4);
 }
 if (code==0) {
  TRACEMS1(tinfo->emethods, 0, "read_synamps_push_keys: Trigger with trigcode 0 at position %d!\n", MSGPARM(position));
 } else {
  push_trigger(&local_arg->triggers, position, code, NULL);
 }
}
开发者ID:berndf,项目名称:avg_q,代码行数:21,代码来源:read_synamps.c

示例12: get_mfxepoch

/*{{{  get_mfxepoch(transform_info_ptr tinfo)*/
METHODDEF DATATYPE *
get_mfxepoch(transform_info_ptr tinfo) {
 struct get_mfxepoch_storage *local_arg=(struct get_mfxepoch_storage *)tinfo->methods->local_storage;
 transform_argument *args=tinfo->methods->arguments;
 DATATYPE *newepoch;
 int again=FALSE;
 long epochlength;

 if (local_arg->epochs--==0) return NULL;

 do {
  again=FALSE;
  if ((newepoch=(DATATYPE *)mfx_getepoch(local_arg->fileptr, &epochlength, local_arg->beforetrig-local_arg->offset, local_arg->aftertrig+local_arg->offset, local_arg->trigname, args[ARGS_TRIGCODE].arg.i))==NULL) {
   /* MFX_READERR4 is the normal end-of-file 'error' */
   TRACEMS1(tinfo->emethods, (mfx_lasterr==MFX_READERR4 ? 1 : 0), "get_mfxepoch: mfx error >%s<\n", MSGPARM(mfx_errors[mfx_lasterr]));
   /* If the error was due to the beforetrig time being too long, try to
    * skip this epoch and try the next one */
   if (mfx_lasterr==MFX_NEGSEEK) {
    again=TRUE;
    mfx_seektrigger(local_arg->fileptr, local_arg->trigname, args[ARGS_TRIGCODE].arg.i);
    TRACEMS(tinfo->emethods, 1, "get_mfxepoch: Retrying...\n");
   }
  }
 } while (again);
 if (newepoch!=NULL) {
  /* TOUCH TINFO ONLY IF GETEPOCH WAS SUCCESSFUL */
  get_mfxinfo(local_arg->fileptr, tinfo);
  tinfo->z_label=NULL;
  tinfo->nr_of_points=epochlength;
  tinfo->length_of_output_region=epochlength*tinfo->nr_of_channels;
  tinfo->beforetrig=local_arg->beforetrig;
  tinfo->aftertrig=tinfo->nr_of_points-tinfo->beforetrig;
  tinfo->multiplexed=TRUE;
  tinfo->sfreq=1.0/(local_arg->fileptr)->fileheader.sample_period;
  tinfo->data_type=TIME_DATA;
  tinfo->itemsize=1;	/* Still, mfx doesn't support tuple data */
  tinfo->leaveright=0;
  tinfo->nrofaverages=1;
 }
 return newepoch;
}
开发者ID:berndf,项目名称:avg_q,代码行数:42,代码来源:get_mfxepoch.c

示例13: get_sos

LOCAL boolean
get_sos (j_decompress_ptr cinfo)
/* Process a SOS marker */
{
  INT32 length;
  int i, ci, n, c, cc, ccc;
  jpeg_component_info * compptr;
  INPUT_VARS(cinfo);

  if (! cinfo->marker->saw_SOF)
    ERREXIT(cinfo, JERR_SOS_NO_SOF);

  INPUT_2BYTES(cinfo, length, return FALSE);

  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */

  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
    ERREXIT(cinfo, JERR_BAD_LENGTH);

  TRACEMS1(cinfo, 1, JTRC_SOS, n);

  cinfo->comps_in_scan = n;

  /* Collect the component-spec parameters */

  for (i = 0; i < n; i++) {
    INPUT_BYTE(cinfo, cc, return FALSE);
    INPUT_BYTE(cinfo, c, return FALSE);
    
    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
	 ci++, compptr++) {
      if (cc == compptr->component_id)
	goto id_found;
    }

    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);

  id_found:

    cinfo->cur_comp_info[i] = compptr;
    compptr->dc_tbl_no = (c >> 4) & 15;
    compptr->ac_tbl_no = (c     ) & 15;
    
    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
	     compptr->dc_tbl_no, compptr->ac_tbl_no);
  }

  /* Collect the additional scan parameters Ss, Se, Ah/Al.
   * Currently we just validate that they are right for sequential JPEG.
   * This ought to be an error condition, but we make it a warning because
   * there are some baseline files out there with all zeroes in these bytes.
   * (Thank you, Logitech :-(.)
   */
  INPUT_BYTE(cinfo, c, return FALSE);
  INPUT_BYTE(cinfo, cc, return FALSE);
  INPUT_BYTE(cinfo, ccc, return FALSE);
  if (c != 0 || cc != DCTSIZE2-1 || ccc != 0)
    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);

  /* Prepare to scan data & restart markers */
  cinfo->marker->next_restart_num = 0;

  INPUT_SYNC(cinfo);
  return TRUE;
}
开发者ID:Jonnyliu,项目名称:Rmtsvc,代码行数:65,代码来源:jdmarker.c

示例14: get_sos

get_sos (j_decompress_ptr cinfo)
/* Process a SOS marker */
{
  INT32 length;
  int i, ci, n, c, cc;
  jpeg_component_info * compptr;
  INPUT_VARS(cinfo);

  if (! cinfo->marker->saw_SOF)
    ERREXIT(cinfo, JERR_SOS_NO_SOF);

  INPUT_2BYTES(cinfo, length, return FALSE);

  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */

  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
    ERREXIT(cinfo, JERR_BAD_LENGTH);

  TRACEMS1(cinfo, 1, JTRC_SOS, n);

  cinfo->comps_in_scan = n;

  /* Collect the component-spec parameters */

  for (i = 0; i < n; i++) {
    INPUT_BYTE(cinfo, cc, return FALSE);
    INPUT_BYTE(cinfo, c, return FALSE);
    
    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
	 ci++, compptr++) {
      if (cc == compptr->component_id)
	goto id_found;
    }

    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);

  id_found:

    cinfo->cur_comp_info[i] = compptr;
    compptr->dc_tbl_no = (c >> 4) & 15;
    compptr->ac_tbl_no = (c     ) & 15;
    
    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
	     compptr->dc_tbl_no, compptr->ac_tbl_no);
  }

  /* Collect the additional scan parameters Ss, Se, Ah/Al. */
  INPUT_BYTE(cinfo, c, return FALSE);
  cinfo->Ss = c;
  INPUT_BYTE(cinfo, c, return FALSE);
  cinfo->Se = c;
  INPUT_BYTE(cinfo, c, return FALSE);
  cinfo->Ah = (c >> 4) & 15;
  cinfo->Al = (c     ) & 15;

  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
	   cinfo->Ah, cinfo->Al);

  /* Prepare to scan data & restart markers */
  cinfo->marker->next_restart_num = 0;

  /* Count another SOS marker */
  cinfo->input_scan_number++;

  INPUT_SYNC(cinfo);
  return TRUE;
}
开发者ID:deepakantony,项目名称:vispack,代码行数:67,代码来源:jdmarker.c

示例15: read_freiburg_init

/*{{{  read_freiburg_init(transform_info_ptr tinfo) {*/
METHODDEF void
read_freiburg_init(transform_info_ptr tinfo) {
 struct read_freiburg_storage *local_arg=(struct read_freiburg_storage *)tinfo->methods->local_storage;
 transform_argument *args=tinfo->methods->arguments;
 struct stat statbuf;

 /*{{{  Process options*/
 local_arg->fromepoch=(args[ARGS_FROMEPOCH].is_set ? args[ARGS_FROMEPOCH].arg.i : 1);
 local_arg->epochs=(args[ARGS_EPOCHS].is_set ? args[ARGS_EPOCHS].arg.i : -1);
 /*}}}  */
 local_arg->channelnames=NULL;
 local_arg->uV_per_bit=NULL;
 growing_buf_init(&local_arg->segment_table); /* This sets buffer_start=NULL */
 local_arg->nr_of_channels=0;

 if (args[ARGS_CONTINUOUS].is_set) {
  /*{{{  Open a continuous (sleep, Bernd Tritschler) file*/
  FILE *infile;
  local_arg->in_channels= &sleep_channels[0];

  if (stat(args[ARGS_IFILE].arg.s, &statbuf)!= 0 || !S_ISREG(statbuf.st_mode)) {
   /* File does not exist or isn't a regular file: Try BT format */
#ifdef __GNUC__
   char co_name[strlen(args[ARGS_IFILE].arg.s)+4];
   char coa_name[strlen(args[ARGS_IFILE].arg.s)+5];
#else
   char co_name[MAX_PATHLEN];
   char coa_name[MAX_PATHLEN];
#endif
   char coa_buf[MAX_COALINE];
   FILE *coafile;

   strcpy(co_name, args[ARGS_IFILE].arg.s); strcat(co_name, ".co");
   if((infile=fopen(co_name,"rb"))==NULL) {
    ERREXIT1(tinfo->emethods, "read_freiburg_init: Can't open file %s\n", MSGPARM(co_name));
   }
   local_arg->infile=infile;
   if (args[ARGS_REPAIR_OFFSET].is_set) {
    fseek(infile, args[ARGS_REPAIR_OFFSET].arg.i, SEEK_SET);
   } else {
   if (read_struct((char *)&local_arg->btfile, sm_BT_file, infile)==0) {
    ERREXIT1(tinfo->emethods, "read_freiburg_init: Header read error in file %s\n", MSGPARM(co_name));
   }
#  ifndef LITTLE_ENDIAN
   change_byteorder((char *)&local_arg->btfile, sm_BT_file);
#  endif
   }
   strcpy(coa_name, args[ARGS_IFILE].arg.s); strcat(coa_name, ".coa");
   if((coafile=fopen(coa_name,"rb"))==NULL) {
    TRACEMS1(tinfo->emethods, 0, "read_freiburg_init: No file %s found\n", MSGPARM(coa_name));
   } else {
    while (!feof(coafile)) {
     Bool repeat;
     fgets(coa_buf, MAX_COALINE-1, coafile);
     do {
      repeat=FALSE;
      if (strncmp(coa_buf, "Channel_Table ", 14)==0) {
       int havechannels=0, stringlength=0;
       long tablepos=ftell(coafile);
       char *innames;
       while (!feof(coafile)) {
	char *eol;
	fgets(coa_buf, MAX_COALINE-1, coafile);
	if (!isdigit(*coa_buf)) break;
	if (strncmp(coa_buf, "0 0 ", 4)==0) {
	 /* Empty channel descriptors: Don't generate channelnames */
	} else {
	 for (eol=coa_buf+strlen(coa_buf)-1; eol>=coa_buf && (*eol=='\n' || *eol=='\r'); eol--) *eol='\0';
	 /* This includes 1 for the zero at the end: */
	 stringlength+=strlen(strrchr(coa_buf, ' '));
	}
	havechannels++;
       }
       if (havechannels==0) continue;	/* Channel table is unuseable */
       local_arg->nr_of_channels=havechannels;
       innames=NULL;
       if ((stringlength!=0 && 
	   ((local_arg->channelnames=(char **)malloc(havechannels*sizeof(char *)))==NULL || 
	    (innames=(char *)malloc(stringlength))==NULL)) ||
	   (local_arg->uV_per_bit=(float *)malloc(havechannels*sizeof(float)))==NULL) {
	ERREXIT(tinfo->emethods, "read_freiburg_init: Error allocating .coa memory\n");
       }
       fseek(coafile, tablepos, SEEK_SET);
       havechannels=0;
       while (!feof(coafile)) {
	char *eol;
	fgets(coa_buf, MAX_COALINE-1, coafile);
	if (!isdigit(*coa_buf)) break;
	for (eol=coa_buf+strlen(coa_buf)-1; eol>=coa_buf && (*eol=='\n' || *eol=='\r'); eol--) *eol='\0';
	if (innames!=NULL) {
	 strcpy(innames, strrchr(coa_buf, ' ')+1);
	 local_arg->channelnames[havechannels]=innames;
	 innames+=strlen(innames)+1;
	}
	/* The sensitivity in .coa files is given as nV/Bit */
	local_arg->uV_per_bit[havechannels]=atoi(strchr(coa_buf, ' ')+1)/1000.0;
	if (local_arg->uV_per_bit[havechannels]==0.0) {
	 local_arg->uV_per_bit[havechannels]=0.086;
	 TRACEMS1(tinfo->emethods, 1, "read_freiburg_init: Sensitivity for channel %d set to 86 nV/Bit\n", MSGPARM(havechannels));
//.........这里部分代码省略.........
开发者ID:berndf,项目名称:avg_q,代码行数:101,代码来源:read_freiburg.c


注:本文中的TRACEMS1函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。