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


C++ MESSAGE函数代码示例

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


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

示例1: str_write_solution

int str_write_solution(double* x, double* lam_eq, double* lam_ieq,CallBackDataPtr cbd)
{
	int row = cbd->row_node_id;
	int col = cbd->col_node_id;
	assert(row == col);
	MESSAGE("write_solution  -- row " << row <<" col "<<col);
	if(row == 0)
	{
		PRINT_ARRAY("node = 0 - x ", x, 2);
		PRINT_ARRAY("node = 0 - eq ", lam_eq, 1);
		PRINT_ARRAY("node = 0 - ieq ", lam_ieq , 0);
	}
	else if(row == 1 || row == 2)
	{
		PRINT_ARRAY("node = "<<row<<" - x ", x, 2);
		PRINT_ARRAY("node = "<<row<<" - eq ", lam_eq, 0);
		PRINT_ARRAY("node = "<<row<<" - ieq ", lam_ieq , 1);
	}
	else
	{
		assert(false);
	}
	return 1;
}
开发者ID:nychiang,项目名称:PIPS,代码行数:24,代码来源:parmodel2.cpp

示例2: apbconfig_save

void apbconfig_save( apb_station_config_t* sc , const char* filename )
{

	
	//Assumes that filesystem has been initalized (mounted)
	uint8_t return_value = 0;
	uint32_t bytes_written = 0;
	FIL fout;
	MESSAGE("filename we are trying to open: %s\n\r", filename);
	return_value = f_open(&fout, filename, FA_WRITE|FA_CREATE_ALWAYS); //Overwrites old configuration
	if(return_value == FR_OK)
	{	
		return_value = f_write(&fout, sc, sizeof(*sc), &bytes_written);
		if(return_value != FR_OK)
		{
			MESSAGE("f_write failed with %u\n\r", return_value);
		}
		if(bytes_written != sizeof(*sc))
			MESSAGE("%d bytes written, should have been %d\n\r", bytes_written, sizeof(*sc));
		return_value = f_close(&fout);
		if(return_value == FR_OK)
		{
			MESSAGE("apbconfig saved\n\r");
			return;
		}
		else
		{
			MESSAGE("f_close failed with %u\n\r", return_value); 
		}
	
	}
	else
	{
		MESSAGE("f_open in apbconfig_save failed, return value: %d\n\r", return_value);

	}
}
开发者ID:swen3027,项目名称:APB_R2,代码行数:37,代码来源:apbconfig.c

示例3: MESSAGE

GEOM_IOperations::~GEOM_IOperations()
{
  delete _solver;
  MESSAGE("GEOM_IOperations::~GEOM_IOperations");
}
开发者ID:triggerfish1,项目名称:pythonocc,代码行数:5,代码来源:GEOM_IOperations.cpp

示例4: MEDouvrir

med_idt
MEDouvrir(char *nom, med_mode_acces mode_acces)
{
  med_idt fid=0; 

  /*
   * On inhibe le gestionnaire d'erreur HDF
   */
  _MEDmodeErreurVerrouiller();

  /*
   * On ouvre le fichier MED sous HDF
   */
  switch(mode_acces)
    {
    case MED_LECTURE :
      if (access(nom,F_OK)) {

	MESSAGE("Impossible d'accéder aux fichier :");
	SSCRUTE(nom);
	return -1;
	
      } else { 
	if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)  return -1;
	/*_MEDsetModeAcces(fid,MED_LECTURE);*/
      };
      break;

    case MED_LECTURE_ECRITURE : 
      if (access(nom,F_OK)) {
	  if ((fid = _MEDfichierCreer(nom,mode_acces)) < 0)
	    return -1;
      } else 
	if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)
	  return -1;
      break;

    case MED_LECTURE_AJOUT    :
      if (access(nom,F_OK))
	{
	  if ((fid = _MEDfichierCreer(nom,mode_acces)) < 0)
	    return -1;
	}
      else 
	if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)
	  return -1;
      break;
      
    case MED_CREATION :
      if ((fid = _MEDfichierCreer(nom,MED_LECTURE_ECRITURE)) < 0)
	return -1;
      break;

    default :
      return -1;
    }

if (MEDcheckVersion(fid) < 0) {
	if (fid >0) _MEDfichierFermer(fid); 
        return -1;
}

  return fid;
}
开发者ID:vejmarie,项目名称:libMED,代码行数:64,代码来源:MEDouvrir.c

示例5: Edit

int Edit(DirEntry * dir_entry, char *file_path)
{
  char *command_line;
  int  result = -1;
  char *file_p_aux=NULL;
  char cwd[PATH_LENGTH + 1];
  char path[PATH_LENGTH + 1];


  if( mode != DISK_MODE && mode != USER_MODE )
  {
    beep();
    return( -1 );
  }

  if( access( file_path, R_OK ) )
  {
    (void) sprintf( message, 
		    "Edit not possible!*\"%s\"*%s", 
		    file_path, 
		    strerror(errno) 
		  );
    MESSAGE( message );
    ESCAPE;
  }

  if( ( file_p_aux = (char *)malloc( COMMAND_LINE_LENGTH ) ) == NULL )
  {
    ERROR_MSG( "Malloc failed*ABORT" );
    exit( 1 );
  }
  StrCp(file_p_aux, file_path);

  if( ( command_line = (char *)malloc( COMMAND_LINE_LENGTH ) ) == NULL )
  {
    ERROR_MSG( "Malloc failed*ABORT" );
    exit( 1 );
  }
  (void) strcpy( command_line, EDITOR );
  (void) strcat( command_line, " \"" );
  (void) strcat( command_line, file_p_aux );
  (void) strcat( command_line, "\"" );
  free( file_p_aux);

  /*  result = SystemCall(command_line);
    --crb3 29apr02: perhaps finally eliminate the problem with jstar writing new
    files to the ytree starting cwd. new code grabbed from execute.c.
    --crb3 01oct02: move Getcwd operation within the IF DISKMODE stuff.
  */                                                                              

  if (mode == DISK_MODE)
  {
    if (Getcwd(cwd, PATH_LENGTH) == NULL)
    {
            WARNING("Getcwd failed*\".\"assumed");
            (void) strcpy(cwd, ".");
    }

    if (chdir(GetPath(dir_entry, path)))
    {
            (void) sprintf(message, "Can't change directory to*\"%s\"", path);
            MESSAGE(message);
    }else{
            result = SystemCall(command_line);
    }
    if(chdir(cwd))
    {
            (void) sprintf(message, "Can't change directory to*\"%s\"", cwd);
            MESSAGE(message);
    }
  }else{
    result = SystemCall(command_line);
  }                                                                         
  free( command_line );
 
FNC_XIT:

  return( result );
}
开发者ID:AaronDP,项目名称:ytree_adbshell,代码行数:79,代码来源:edit.c

示例6: ImportIGES

SALOME_WNT_EXPORT
  TopoDS_Shape ImportIGES (const TCollection_AsciiString& theFileName,
                       const TCollection_AsciiString& theFormatName,
                       TCollection_AsciiString&       theError,
		               const TDF_Label&               theShapeLabel)
  {
    IGESControl_Reader aReader;
    TopoDS_Shape aResShape;
    Interface_Static::SetCVal("xstep.cascade.unit","M");
    try {
      IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString());

      if (status == IFSelect_RetDone) {

        if( theFormatName == "IGES_UNIT" ) {
	  Handle(IGESData_IGESModel) aModel = 
	    Handle(IGESData_IGESModel)::DownCast(aReader.Model());
	  gp_Pnt P(1.0,0.0,0.0);
	  if(!aModel.IsNull()) {
	    Handle(TCollection_HAsciiString) aUnitName = 
	      aModel->GlobalSection().UnitName();
	    //cout<<"aUnitName = "<<aUnitName->ToCString()<<endl;
	    //cout<<"aUnitFlag = "<<aModel->GlobalSection().UnitFlag()<<endl;
	    if( aUnitName->String()=="MM" ) {
	      P = gp_Pnt(0.001,0.0,0.0);
	    }
	    else if( aUnitName->String()=="CM" ) {
	      P = gp_Pnt(0.01,0.0,0.0);
	    }
	  }
	  BRep_Builder B;
	  TopoDS_Vertex V;
	  B.MakeVertex(V,P,1.e-7);
	  aResShape = V;
	  return aResShape;
	}
	if( theFormatName == "IGES_SCALE" ) {
	  //cout<<"need re-scale a model"<<endl;
	  // set UnitFlag to 'meter'
	  Handle(IGESData_IGESModel) aModel = 
	    Handle(IGESData_IGESModel)::DownCast(aReader.Model());
	  if(!aModel.IsNull()) {
	    IGESData_GlobalSection aGS = aModel->GlobalSection();
	    aGS.SetUnitFlag(6);
	    aModel->SetGlobalSection(aGS);
	  }
	}

        MESSAGE("ImportIGES : all Geometry Transfer");
        //OCC 5.1.2 porting
        //     aReader.Clear();
        //     aReader.TransferRoots(false);
        aReader.ClearShapes();
        aReader.TransferRoots();

        MESSAGE("ImportIGES : count of shapes produced = " << aReader.NbShapes());
        aResShape = aReader.OneShape();

        // BEGIN: Store names of sub-shapes from file
        Handle(Interface_InterfaceModel) Model = aReader.WS()->Model();
        Handle(XSControl_TransferReader) TR = aReader.WS()->TransferReader();
        if (!TR.IsNull()) {
          Handle(Transfer_TransientProcess) TP = /*TransientProcess();*/TR->TransientProcess();
          Standard_Integer nb = Model->NbEntities();
          for (Standard_Integer i = 1; i <= nb; i++) {
            Handle(IGESData_IGESEntity) ent = Handle(IGESData_IGESEntity)::DownCast(Model->Value(i));
            if (ent.IsNull() || ! ent->HasName()) continue;

            // find target shape
            Handle(Transfer_Binder) binder = TP->Find(ent);
            if (binder.IsNull()) continue;
            TopoDS_Shape S = TransferBRep::ShapeResult(binder);
            if (S.IsNull()) continue;

            // create label and set shape
            TDF_Label L;
            TDF_TagSource aTag;
            L = aTag.NewChild(theShapeLabel);
            TNaming_Builder tnBuild (L);
            tnBuild.Generated(S);

            // set a name
            TCollection_AsciiString string = ent->NameValue()->String();
            string.LeftAdjust();
            string.RightAdjust();
            TCollection_ExtendedString str (string);
            TDataStd_Name::Set(L, str);
          }
        }
        // END: Store names
      } else {
//        switch (status) {
//        case IFSelect_RetVoid:
//          theError = "Nothing created or No data to process";
//          break;
//        case IFSelect_RetError:
//          theError = "Error in command or input data";
//          break;
//        case IFSelect_RetFail:
//          theError = "Execution was run, but has failed";
//.........这里部分代码省略.........
开发者ID:dbarbier,项目名称:pythonocc,代码行数:101,代码来源:ExchangeIGES_Import.cpp

示例7: x_process_events

static void x_process_events(void *data)
{
	XEvent event;
	XEvent last_event;
	struct graphics_device *gd;
	int last_was_mouse;


#ifdef SC_DEBUG
	MESSAGE("x_process_event\n");
#endif
	last_was_mouse=0;
	while (XPending(x_display))
	{
		XNextEvent(x_display,&event);
		if (last_was_mouse&&(event.type==ButtonPress||event.type==ButtonRelease))  /* this is end of mouse move block --- call mouse handler */
		{
			int a,b;

			last_was_mouse=0;
#ifdef X_DEBUG
			MESSAGE("(MotionNotify event)\n");
			{
				unsigned char txt[256];
				sprintf(txt,"x=%d y=%d\n",last_event.xmotion.x,last_event.xmotion.y);
				MESSAGE(txt);
			}
#endif
			gd=x_find_gd(&(last_event.xmotion.window));
			if (!gd)break;
			a=B_LEFT;
			b=B_MOVE;
			if ((last_event.xmotion.state)&Button1Mask)
			{
				a=B_LEFT;
				b=B_DRAG;
#ifdef X_DEBUG
				MESSAGE("left button/drag\n");
#endif
			}
			if ((last_event.xmotion.state)&Button2Mask)
			{
				a=B_MIDDLE;
				b=B_DRAG;
#ifdef X_DEBUG	
				MESSAGE("middle button/drag\n");
#endif
			}
			if ((last_event.xmotion.state)&Button3Mask)
			{
				a=B_RIGHT;
				b=B_DRAG;
#ifdef X_DEBUG
				MESSAGE("right button/drag\n");
#endif
			}
			x_clip_number(&(last_event.xmotion.x),gd->size.x1,gd->size.x2);
			x_clip_number(&(last_event.xmotion.y),gd->size.y1,gd->size.y2);
			gd->mouse_handler(gd,last_event.xmotion.x,last_event.xmotion.y,a|b);
		}

		switch(event.type)
		{
			case GraphicsExpose:  /* redraw uncovered area during scroll */
			{
				struct rect r;

#ifdef X_DEBUG
				MESSAGE("(GraphicsExpose event)\n");
#endif
				gd=x_find_gd(&(event.xgraphicsexpose.drawable));
				if (!gd)break;
				r.x1=event.xgraphicsexpose.x;
				r.y1=event.xgraphicsexpose.y;
				r.x2=event.xgraphicsexpose.x+event.xgraphicsexpose.width;
				r.y2=event.xgraphicsexpose.y+event.xgraphicsexpose.height;
				gd->redraw_handler(gd,&r);
			}
			break;
			
			case Expose:   /* redraw part of the window */
			{
				struct rect r;

#ifdef X_DEBUG
				MESSAGE("(Expose event)\n");
#endif

				gd=x_find_gd(&(event.xexpose.window));
				if (!gd)break;
				r.x1=event.xexpose.x;
				r.y1=event.xexpose.y;
				r.x2=event.xexpose.x+event.xexpose.width;
				r.y2=event.xexpose.y+event.xexpose.height;
				gd->redraw_handler(gd,&r);
			}
			break;

			case ConfigureNotify:   /* resize window */
#ifdef X_DEBUG
//.........这里部分代码省略.........
开发者ID:lince,项目名称:ginga-srpp,代码行数:101,代码来源:x.c

示例8: Init

static int Init(int argc, const char **argv)

{
    int i;
    int fl1, nor1, noc1, fl2, nor2, noc2;
    char fn[LAT_MAXBASENAME+20];

    /* Initialize global data
       ---------------------- */
    memset(&TKInfo,0,sizeof(TKInfo));
    memset(TkiName,0,sizeof(TkiName));
    memset(CfIsLinked,0,sizeof(CfIsLinked));

    /* Initialize the MeatAxe library
       ------------------------------ */
    if ((App = AppAlloc(&AppInfo,argc,argv)) == NULL)
	return -1;
    opt_s = AppGetOption(App,"-s");
    if (AppGetArguments(App,3,3) != 3)
	return -1;
    strcpy(TkiName,App->ArgV[0]);

    /* Read info files
       --------------- */
    strncpy(TKInfo.NameM,App->ArgV[1],sizeof(TKInfo.NameM));
    strncpy(TKInfo.NameN,App->ArgV[2],sizeof(TKInfo.NameN));
    if (Lat_ReadInfo(&InfoM,App->ArgV[1]) != 0)
    {
	MTX_ERROR1("Error reading %s.cfinfo",App->ArgV[1]);
	return -1;
    }
    if (Lat_ReadInfo(&InfoN,App->ArgV[2]) != 0)
    {
	MTX_ERROR1("Error reading %s.cfinfo",App->ArgV[2]);
	return -1;
    }


    /* Initialize the TKInfo structure
       ------------------------------- */
    TKInfo.NCf = 0;
    for (i = 0; i < LAT_MAXCF; ++i)
	TKInfo.CfIndex[0][i] = TKInfo.CfIndex[1][i] = -1;

    /* Some additional checks on input files
       ------------------------------------- */
    if (InfoM.Field != InfoN.Field)
    {
	MTX_ERROR4("Incompatible representations: %s is over GF(%d), "
	   "%s is over GF(%d)",InfoM.BaseName,InfoM.Field,InfoN.BaseName,
	   InfoN.Field);
	return -1;
    }
    if (InfoM.NGen != InfoN.NGen)
    {
	MTX_ERROR4("Incompatible representations: %s has %d generators, "
	   "%s has %d generators",InfoM.BaseName,InfoM.NGen,InfoN.BaseName,
	   InfoN.NGen);
	return -1;
    }

    /* Print start message
       ------------------- */
    sprintf(fn,"%s.1",InfoM.BaseName);
    fclose(FfReadHeader(fn,&fl1,&nor1,&noc1));
    sprintf(fn,"%s.1",InfoN.BaseName);
    fclose(FfReadHeader(fn,&fl2,&nor2,&noc2));
    MESSAGE(0,("Beginning pre-condensation of dimension %d x %d = %d\n",
	nor1,nor2,nor1*nor2));
    return 0;
}
开发者ID:momtx,项目名称:meataxe,代码行数:71,代码来源:precond.c

示例9: irport_open


//.........这里部分代码省略.........
	}

	self = dev->priv;
	spin_lock_init(&self->lock);

	/* Need to store self somewhere */
	dev_self[i] = self;
	self->priv = self;
	self->index = i;

	/* Initialize IO */
	self->io.sir_base  = iobase;
        self->io.sir_ext   = IO_EXTENT;
        self->io.irq       = irq;
        self->io.fifo_size = 16;		/* 16550A and compatible */

	/* Initialize QoS for this device */
	irda_init_max_qos_capabilies(&self->qos);
	
	self->qos.baud_rate.bits = IR_9600|IR_19200|IR_38400|IR_57600|
		IR_115200;

	self->qos.min_turn_time.bits = qos_mtt_bits;
	irda_qos_bits_to_value(&self->qos);
	
	/* Bootstrap ZeroCopy Rx */
	self->rx_buff.truesize = IRDA_SKB_MAX_MTU;
	self->rx_buff.skb = __dev_alloc_skb(self->rx_buff.truesize,
					    GFP_KERNEL);
	if (self->rx_buff.skb == NULL) {
		ERROR("%s(), can't allocate memory for "
		      "receive buffer!\n", __FUNCTION__);
		goto err_out3;
	}
	skb_reserve(self->rx_buff.skb, 1);
	self->rx_buff.head = self->rx_buff.skb->data;
	/* No need to memset the buffer, unless you are really pedantic */

	/* Finish setup the Rx buffer descriptor */
	self->rx_buff.in_frame = FALSE;
	self->rx_buff.state = OUTSIDE_FRAME;
	self->rx_buff.data = self->rx_buff.head;

	/* Specify how much memory we want */
	self->tx_buff.truesize = 4000;
	
	/* Allocate memory if needed */
	if (self->tx_buff.truesize > 0) {
		self->tx_buff.head = (__u8 *) kmalloc(self->tx_buff.truesize, 
						      GFP_KERNEL);
		if (self->tx_buff.head == NULL) {
			ERROR("%s(), can't allocate memory for "
			      "transmit buffer!\n", __FUNCTION__);
			goto err_out4;
		}
		memset(self->tx_buff.head, 0, self->tx_buff.truesize);
	}	
	self->tx_buff.data = self->tx_buff.head;

	self->netdev = dev;
	/* Keep track of module usage */
	SET_MODULE_OWNER(dev);

	/* May be overridden by piggyback drivers */
	self->interrupt    = irport_interrupt;
	self->change_speed = irport_change_speed;

	/* Override the network functions we need to use */
	dev->hard_start_xmit = irport_hard_xmit;
	dev->tx_timeout	     = irport_timeout;
	dev->watchdog_timeo  = HZ;  /* Allow time enough for speed change */
	dev->open            = irport_net_open;
	dev->stop            = irport_net_close;
	dev->get_stats	     = irport_net_get_stats;
	dev->do_ioctl        = irport_net_ioctl;

	/* Make ifconfig display some details */
	dev->base_addr = iobase;
	dev->irq = irq;

	if (register_netdev(dev)) {
		ERROR("%s(), register_netdev() failed!\n", __FUNCTION__);
		goto err_out5;
	}
	MESSAGE("IrDA: Registered device %s (irport io=0x%X irq=%d)\n",
		dev->name, iobase, irq);

	return self;
 err_out5:
	kfree(self->tx_buff.head);
 err_out4:
	kfree_skb(self->rx_buff.skb);
 err_out3:
	free_netdev(dev);
	dev_self[i] = NULL;
 err_out2:
	release_region(iobase, IO_EXTENT);
 err_out1:
	return NULL;
}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:101,代码来源:irport.c

示例10: convertImages

void convertImages(Arguments* args){
    char** mask = NULL;
    TwoPoints source, dest;
    FILE* eyeList;
    char line[ FILE_LINE_LENGTH ];
    char filename[MAX_FILENAME_LENGTH];
    char imagename[MAX_FILENAME_LENGTH];
    char suffix[MAX_FILENAME_LENGTH];
    int i;

    scaleArgs(args, args->scale);

    dest.x1 = args->eyeLx;
    dest.y1 = args->eyeLy;
    dest.x2 = args->eyeRx;
    dest.y2 = args->eyeRy;

    /* Prepare file suffix encoding preprocessing settings, blank if not requested */
    if (args->configSuffix) {
        sprintf(suffix,"_%s", imageSuffix(args)); }
    else {
        suffix[0] = '\0'; }	

    if(args->maskType == CL_YES){
        MESSAGE("Creating Mask.");
        mask = generateMask(args->sizeWidth, args->sizeHeight, args->ellipseX, args->ellipseY, args->ellipseA, args->ellipseB);
    }

    eyeList = fopen(args->eyeFile,"r");
    DEBUG_CHECK(eyeList,"Error opening eye coordinates file");

    for(i = 1;;i++){
        Image pgm;
        Image geo;
        Matrix transform;

        fgets(line, FILE_LINE_LENGTH, eyeList);
        if(feof(eyeList)) break;

        if(sscanf(line,"%s %lf %lf %lf %lf",filename, &(source.x1), &(source.y1), &(source.x2), &(source.y2)) != 5){
            printf("Error parsing line %d of eye coordinate file. Exiting...",i);
            exit(1);
        }

        /* shift the eye coordinates if neccessary */
        source.x1 += args->shiftX;
        source.y1 += args->shiftY;
        source.x2 += args->shiftX;
        source.y2 += args->shiftY;

        sprintf(imagename,"%s\\%s.pgm",args->inputDir,filename);

        MESSAGE1ARG("Processing image: %s",filename);

        pgm = readPGMImage(imagename);

        if(args->histType == HIST_PRE){
            DEBUG(1,"   Performing Pre Histogram Equalization.");
            histEqual(pgm,256);
        }

        if(args->preNormType == CL_YES){
            DEBUG(1,"   Performing Pre Pixel Normalization.");
            ZeroMeanOneStdDev(pgm);
        }

        if(args->preEdge){
            smoothImageEdge(pgm, args->preEdge);
        }

        if(args->geoType == CL_YES){
            DEBUG(1,"   Performing Geometric Normalization.");
            transform = generateTransform(&source,&dest,args->reflect);
            geo = transformImage(pgm,args->sizeWidth,args->sizeHeight,transform);
        }
        else{
            transform = makeIdentityMatrix(3);
            geo = transformImage(pgm,args->sizeWidth,args->sizeHeight,transform);
        }

        if(args->noise != 0.0){
            DEBUG(1,"   Adding Gausian Noise.");
            gaussianNoise(geo,args->noise);
        }


        if(args->histType == HIST_POST){
            DEBUG(1,"   Performing Post Histogram Equalization.");
            histEqualMask(geo,256, (const char**) mask);
        }

        if(args->nrmType == CL_YES){
            DEBUG(1,"   Performing final value normalization and Applying Mask.");
            ZeroMeanOneStdDevMasked(geo, (const char **) mask);
        }
        else{
            DEBUG(1,"   No Value Normalization. Just Applying Mask.");
            applyMask(geo, (const char **) mask);
        }

//.........这里部分代码省略.........
开发者ID:prashanthbuv,项目名称:facerec,代码行数:101,代码来源:csuPreprocessNormalize.c

示例11: normal_not_failsafe

//==========================================================================
bool SplineSurface::search_for_normal(bool interval_in_u,
				      double fixed_parameter,
				      double interval_start, // normal is not defined here
				      double interval_end,
				      Point& normal) const
//==========================================================================
{
    // We want to find the closest defined normal to the point on the surface with
    // the parameter values (interval_start, fixed_parameter) if interval_in_u = true,
    // or to the parameter values (fixed_parameter, interval_start) if interval_in_u = false.
    // We suppose that the normal for that point has been detected as undefined.
    
    const int INTERVAL_PARTITION = 10;
    double running_parameter = interval_start;
    double& u = interval_in_u ? running_parameter : fixed_parameter;
    double& v = interval_in_u ? fixed_parameter : running_parameter;

    // first a quick check - if we can find a normal in immediate vincinity to the
    // point (within the DEFAULT_PARAMETER_EPSILON value), we will return it.
    if (interval_end - interval_start > 0) {
	running_parameter += DEFAULT_PARAMETER_EPSILON;
    } else {
	running_parameter -= DEFAULT_PARAMETER_EPSILON;
    }
    bool normal_defined = false;
    try { 
      normal_defined = normal_not_failsafe(normal, u, v);
    } catch ( ... ) {
      MESSAGE("Failed finding normal, trying a new method.");
    }
    if (normal_defined) {
	return true;
    }
    // if we got here, our little 'wiggling' of the moving parameter did not produce
    // a valid normal.  We will do a more thorough search.

    // trying to locate a defined normal at some moderate distance from the 
    // "difficult" point
    double stepsize = (interval_end - interval_start) / double(INTERVAL_PARTITION);
    int i;
    for (i = 1; i <= INTERVAL_PARTITION; ++i) {
	running_parameter = interval_start + i * stepsize;
	try { 
	  normal_defined = normal_not_failsafe(normal, u, v);
	} catch ( ... ) {
	  MESSAGE("Failed finding normal, trying a new method.");
	}
	if (normal_defined) { 
	    break;
	}
    }
    if (i > INTERVAL_PARTITION) {
	// we didn't find any defined normal in this interval at all
	return false;
    }

    // restricting interval
    interval_end = running_parameter; // as detected in the above loop
    // trying to find the value of running_parameter that is as close as possible
    // to interval_start while still with a defined normal.
    Point tentative_normal;
    while (fabs(running_parameter - interval_start) > DEFAULT_PARAMETER_EPSILON) {
	running_parameter = (interval_start + interval_end) * 0.5;
	bool tentative_normal_defined = false;
	try { 
	    tentative_normal_defined =
		normal_not_failsafe(tentative_normal, u, v);
	} catch ( ... ) {
	    MESSAGE("Failed finding normal, trying a new method.");
	}
	if (!tentative_normal_defined) {
	    // we have gotten so close to the original point that the normal
	    // has become undefined.  Keep previous normal
	    break;
	} else {
	    interval_end = running_parameter; // shrinking interval
	    normal = tentative_normal; // this normal was defined, and closer to orig. point
	}
    }
    
    // we have now found a defined normal that should be as close to the original point as
    // possible
    return true;
}
开发者ID:SINTEF-Geometry,项目名称:GoTools,代码行数:85,代码来源:GSSnormal.C

示例12: _text

SMESH_Exception::SMESH_Exception( void ): /*exception() ,*/ _text(0)
{
	MESSAGE( "You must use the standard builder: SMESH_Exception::SMESH_Exception( const char *text )" ) ;
	INTERRUPTION(1) ;
}
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:5,代码来源:SMESH_Exception.cpp

示例13: MakeWindow

/*=======================================================================================*/
bool MakeWindow( bool *_FullScreenFlag , const int _nWinMode )
{

	WNDCLASSEX wc;											// ウィンドウクラスの定義
	
	// ウィンドウクラスの定義
	wc.cbSize = sizeof(WNDCLASSEX);							// 構造体のサイズ
	wc.style = CS_DBLCLKS;									// スタイル
	wc.lpfnWndProc = WindowProc;							// ウインドウ関数
	wc.cbClsExtra = 0;										// エキストラクラス情報 
	wc.cbWndExtra = 0;										// エキストラウィンドウ情報
	wc.hInstance = CAPP->hInst;								// インスタンスハンドル
	wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);				// ラージアイコン
	wc.hIconSm = LoadIcon(NULL, IDI_WINLOGO);				// スモールアイコン 
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);				// マウスカーソル
	wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);	// 背景色 
	wc.lpszMenuName = NULL;									// メインメニュー名
	wc.lpszClassName = WINDOW_NAME;							// ウィンドウクラス名

	// ウィンドウクラスの登録
	if ( !RegisterClassEx( &wc ) )
	{
		ErrorMessage( "ウィンドウの登録に失敗しました。\n" );
		return false;
	}

	// スクリーンの解像度を取得
	int ScreenSizeWidth  = GetSystemMetrics( SM_CXSCREEN );
	int ScreenSizeHeight = GetSystemMetrics( SM_CYSCREEN );
	POINT WindowPos;
	WindowPos.x = ( ScreenSizeWidth  - WINDOW_WIDTH  ) / 2;
	WindowPos.y = ( ScreenSizeHeight - WINDOW_HEIGHT ) / 2;

	// ウィンドウの作成
	CAPP->hWnd = CreateWindow(
		WINDOW_NAME,						// 作成するウィンドウ名
		GAME_TITLE.c_str(),					// ウィンドウのタイトル
		WS_OVERLAPPEDWINDOW,				// ウィンドウタイプを標準タイプに	
		WindowPos.x + WINDOW_POSITION_X ,	// ウィンドウの位置(X座標)
		WindowPos.y + WINDOW_POSITION_Y ,	// ウィンドウの位置(Y座標)						
		WINDOW_WIDTH,						// ウィンドウの幅
		WINDOW_HEIGHT,						// ウィンドウの高さ			
		NULL,								// 親ウィンドウのハンドル
		NULL,								// メニューのハンドル
		CAPP->hInst,						// インスタンスハンドル 
		NULL);								// 追加情報 


	// ウィンドウの表示
#ifdef _DEBUG
	ShowWindow( CAPP->hWnd , bFullScreen ? ( SW_SHOW ) : ( _nWinMode ) );
#else
	int Select;
	Select = MESSAGE( "フルスクリーンで起動しますか?" );
	*_FullScreenFlag = Select == IDYES ? ( true ) : ( false );
	ShowWindow( CAPP->hWnd , Select == IDYES ? ( SW_SHOW ) : ( _nWinMode ) );
#endif

	// ウィンドウの更新
	UpdateWindow( CAPP->hWnd );

	return true;

}
开发者ID:yamamuro,项目名称:i_think.co.github.io,代码行数:65,代码来源:Main.cpp

示例14: rakia_codec_param_parse_generic

/**
 * rakia_codec_param_parse_generic:
 * @fmtp: a string value with the parameter description
 * @out: the parameter map to populate
 *
 * Parses parameters formatted as a semicolon separated list of
 * <replaceable>parameter</replaceable><literal>=</literal><replaceable>value</replaceable>
 * pairs, as recommended in IETF RFC 4855 Section 3.
 */
static void
rakia_codec_param_parse_generic (const gchar *fmtp, TpMediaStreamType media_type,
    RakiaSipCodec *codec)
{
  GMatchInfo *match = NULL;
  gint pos;
  gint value_start;
  gint value_end;

  if (fmtp == NULL)
    return;

  pos = 0;

  /* Fast path for trivial cases, not involving the regex engine */
  while (g_ascii_isspace (fmtp[pos]))
    ++pos;
  if (!fmtp[pos])
    return;

  g_assert (fmtp_attr_regex != NULL);

  g_regex_match_full (fmtp_attr_regex,
      fmtp, -1, pos, G_REGEX_MATCH_ANCHORED, &match, NULL);

  while (g_match_info_matches (match))
    {
      gchar *name;
      gchar *value;

      name = g_match_info_fetch_named (match, FMTP_MATCH_NAME_PARAM);

      g_match_info_fetch_named_pos (match, FMTP_MATCH_NAME_VALUE,
          &value_start, &value_end);

      if (value_end - 1 > value_start
          && fmtp[value_start] == '\"' && fmtp[value_end - 1] == '\"')
        {
          value = rakia_unquote_string (fmtp + value_start,
                                        value_end - value_start);
        }
      else
        {
          value = g_strndup (fmtp + value_start,
                             value_end - value_start);
        }

      rakia_sip_codec_add_param (codec, name, value);

      g_match_info_fetch_pos (match, 0, NULL, &pos);
      if (!fmtp[pos])
        break;

      g_match_info_next (match, NULL);
    }

  g_match_info_free (match);

  if (fmtp[pos])
    MESSAGE ("failed to parse part of format parameters"
               " as an attribute-value list: %s", &fmtp[pos]);
}
开发者ID:freedesktop-unofficial-mirror,项目名称:telepathy__telepathy-rakia,代码行数:71,代码来源:codec-param-formats.c

示例15: thread_init

/***********************************************************************
 *           thread_init
 *
 * Setup the initial thread.
 *
 * NOTES: The first allocated TEB on NT is at 0x7ffde000.
 */
HANDLE thread_init(void)
{
    TEB *teb;
    void *addr;
    SIZE_T size, info_size;
    HANDLE exe_file = 0;
    LARGE_INTEGER now;
    NTSTATUS status;
    struct ntdll_thread_data *thread_data;
    static struct debug_info debug_info;  /* debug info for initial thread */

    virtual_init();

    /* reserve space for shared user data */

    addr = (void *)0x7ffe0000;
    size = 0x10000;
    status = NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size,
                                      MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE );
    if (status)
    {
        MESSAGE( "wine: failed to map the shared user data: %08x\n", status );
        exit(1);
    }
    user_shared_data = addr;

    /* allocate and initialize the PEB */

    addr = NULL;
    size = sizeof(*peb);
    NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 1, &size,
                             MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE );
    peb = addr;

    peb->ProcessParameters  = &params;
    peb->TlsBitmap          = &tls_bitmap;
    peb->TlsExpansionBitmap = &tls_expansion_bitmap;
    peb->FlsBitmap          = &fls_bitmap;
    peb->LdrData            = &ldr;
    params.CurrentDirectory.DosPath.Buffer = current_dir;
    params.CurrentDirectory.DosPath.MaximumLength = sizeof(current_dir);
    params.wShowWindow = 1; /* SW_SHOWNORMAL */
    ldr.Length = sizeof(ldr);
    RtlInitializeBitMap( &tls_bitmap, peb->TlsBitmapBits, sizeof(peb->TlsBitmapBits) * 8 );
    RtlInitializeBitMap( &tls_expansion_bitmap, peb->TlsExpansionBitmapBits,
                         sizeof(peb->TlsExpansionBitmapBits) * 8 );
    RtlInitializeBitMap( &fls_bitmap, peb->FlsBitmapBits, sizeof(peb->FlsBitmapBits) * 8 );
    InitializeListHead( &peb->FlsListHead );
    InitializeListHead( &ldr.InLoadOrderModuleList );
    InitializeListHead( &ldr.InMemoryOrderModuleList );
    InitializeListHead( &ldr.InInitializationOrderModuleList );
#ifdef __APPLE__
    peb->Reserved[0] = get_dyld_image_info_addr();
#endif

    /* allocate and initialize the initial TEB */

    signal_alloc_thread( &teb );
    teb->Peb = peb;
    teb->Tib.StackBase = (void *)~0UL;
    teb->StaticUnicodeString.Buffer = teb->StaticUnicodeBuffer;
    teb->StaticUnicodeString.MaximumLength = sizeof(teb->StaticUnicodeBuffer);

    thread_data = (struct ntdll_thread_data *)teb->SpareBytes1;
    thread_data->request_fd = -1;
    thread_data->reply_fd   = -1;
    thread_data->wait_fd[0] = -1;
    thread_data->wait_fd[1] = -1;
    thread_data->debug_info = &debug_info;
    InsertHeadList( &tls_links, &teb->TlsLinks );

    signal_init_thread( teb );
    virtual_init_threading();

    debug_info.str_pos = debug_info.strings;
    debug_info.out_pos = debug_info.output;
    debug_init();

    /* setup the server connection */
    server_init_process();
    info_size = server_init_thread( peb );

    /* create the process heap */
    if (!(peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL )))
    {
        MESSAGE( "wine: failed to create the process heap\n" );
        exit(1);
    }

    /* allocate user parameters */
    if (info_size)
    {
        init_user_process_params( info_size, &exe_file );
//.........这里部分代码省略.........
开发者ID:Dimillian,项目名称:wine,代码行数:101,代码来源:thread.c


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