Esempio n. 1
0
static int
nds_snmp_scan(LibHalContext *ctx, char *parent, char *community, char *network)
{
	time_t start;

	HAL_DEBUG(("nds_snmp_scan(0x%8.8x, %s, %s, %s)",
			ctx, NP(parent), NP(community), NP(network)));
	HAL_DEBUG(("NetworkDiscovery snmp scan initated"));

	/* scan for devices */
	time(&start);
	if (network == NULL) {
		GList *elem, *list = broadcast_addresses();

		for (elem = list; elem != NULL; elem = g_list_next(elem)) {
			scan_for_devices_using_snmp(ctx, parent, community,
						(char *)elem->data);
			free(elem->data);
		}
		g_list_free(list);
	} else
		scan_for_devices_using_snmp(ctx, parent, community, network);

	/* remove devices that haven't been seen since before this scan */
	scan_for_stale_devices(ctx, start);

	HAL_DEBUG(("NetworkDiscovery snmp scan completed"));

	return (0);
}
Esempio n. 2
0
static int
nds_EnablePrinterScanningViaSNMP(LibHalContext *ctx, char *parent, int interval,
		char *community, char *network)
{
	HAL_DEBUG(("NetworkDiscovery.EnablePrinterScanningViaSNMP(0x%8.8x, %s, %d, %s, %s)",
			ctx, NP(parent), interval, NP(community), NP(network)));

	/* are we already discoverying network devices ? */
	if (snmp_cb_data != NULL) {
		snmp_cb_data->enabled = FALSE; /* cancel it */
	}

	/* setup for network device discovery */
	if ((snmp_cb_data = calloc(1, sizeof (*snmp_cb_data))) != NULL) {
		snmp_cb_data->ctx = ctx;
		snmp_cb_data->enabled = TRUE;
		snmp_cb_data->parent = STRDUP(parent);
		snmp_cb_data->community = STRDUP(community);
		snmp_cb_data->network = STRDUP(network);

		/* prime the pump with an initial scan */
		nds_snmp_scan(ctx, parent, community, network);

		/* add a regular network scan */
		g_timeout_add(interval * 1000, nds_snmp_scan_cb, snmp_cb_data);
	}

	return (0);
}
Esempio n. 3
0
int
main(int ac, char *av[])
{
	int i;

	for (i = 1; av[i] != NULL; i++) {
		char *hostname = av[i], *manufacturer = NULL, *model = NULL,
		     *description = NULL, *serial_no = NULL,
		     **command_set = NULL, *uri = NULL;
		int rc;

		rc = snmp_printer_info(hostname, &manufacturer, &model,
				&description, &serial_no, &command_set, &uri);
		printf("SNMP data for %s...(%d)\n", hostname, rc);
		printf("\tvendor = %s\n", NP(manufacturer));
		printf("\tproduct = %s\n", NP(model));
		printf("\tdescription = %s\n", NP(description));
		printf("\tserial = %s\n", NP(serial_no));
		printf("\tdevice = %s\n", NP(uri));

		if (command_set != NULL) {
			int j;

			printf("\tcommand set = \n");
			for (j = 0; command_set[j] != NULL; j++)
				printf("\t\t%s\n", command_set[j]);
		}
	}

	return (0);
}
Esempio n. 4
0
static void wifi_rtsp_clearsource(struct wifi_source * src) 
{
    WIFI_SOURCE_STATE old = src->state;
    NP("tandy: [%s:%d:%s], time=%d,src->state=%d\n",__FILE__,__LINE__,__func__,time(NULL),src->state);
    //if (src->state < WIFI_SOURCE_TEARDOWN && 
	//	src->state > WIFI_SOURCE_DISCONNECTED) {
	//	src->state = WIFI_SOURCE_TEARDOWN;
	g_hdcpThreadState = EM_HDCP_THREAD_STATE_STOP;
	if (1) {//the wifi_rtsp_clearsource come from
		if (src->change_callback) 
	    	src->change_callback(old, WIFI_SOURCE_TEARDOWN);
    }    
	NP("tandy: [%s:%d:%s], time=%d\n",__FILE__,__LINE__,__func__,time(NULL));
    src->audiotype = S_MEDIA_TYPE_NONE;
    src->channelnum = -1;
    src->sampleRate = -1;
    src->bitspersample = -1;
    src->rtsp_pending_method = WIFI_TRIGGER_NONE;
    src->intflag = 0;
    close(src->srcnfd);
    src->srcnfd = -1;
    if (src->presentation_url) {
        free(src->presentation_url);
        src->presentation_url = NULL;
    }
    if (src->session_id) {
        free(src->session_id);
        src->session_id = NULL;
    }
    if (src->uibcfd > 0) {
        close(src->uibcfd);
        src->uibcfd = -1;
    }
    if (src->i2c_listenport > 0) {
        close(src->i2c_listenport);
        src->i2c_listenport = -1;
    }
    if (src->i2c_dataport > 0) {
        close(src->i2c_dataport);
        src->i2c_dataport = -1;
    }
    if (src->hdcp2_listenport > 0) {
        close(src->hdcp2_listenport);
        src->hdcp2_listenport = -1;
    }
    if (src->hdcp2_dataport > 0) {
        close(src->hdcp2_dataport);
        src->hdcp2_dataport = -1;
    }
	if (src->friendly_name) {
		free(src->friendly_name);
		src->friendly_name = NULL;
	}
	remove("/tmp/p2pstatus");
	src->state = WIFI_SOURCE_DISCONNECTED;    
	src->badSocket = 0;
}
Esempio n. 5
0
static int
nds_ScanForPrintersViaSNMP(LibHalContext *ctx, char *parent, char *community,
		char *network)
{
	time_t start, stop;

	HAL_DEBUG(("NetworkDiscovery.ScanForPrintersViaSNMP(0x%8.8x, %s, %s, %s)",
			ctx, NP(parent), NP(community), NP(network)));

	return (nds_snmp_scan(ctx, parent, community, network));
}
Esempio n. 6
0
void OSystem_GP32::warpMouse(int x, int y) {
	NP("OSys::warpMouse()");
	//assert(x > 0 && x < _screenWidth);
	//assert(y > 0 && y < _screenHeight);
	_mouseX = x;
	_mouseY = y;
}
Esempio n. 7
0
SEXP wink_true_coincidences( SEXP data1, SEXP data2, SEXP windows, SEXP Rdelta )
{
    parameters param;
    if( !param.load(data1,data2,windows,Rdelta,NULL,false) )
        return R_NilValue;
    
    //==========================================================================
    // create the return vector
    //==========================================================================
    SEXP Rval;
    PROTECT(Rval = allocVector(INTSXP,param.num_windows) );
    int *ans = INTEGER(Rval);

    try 
    {
        //======================================================================
        // transform R data intro C++ objects
        //======================================================================
        wink::c_matrix     M1(param.nrow1,param.ncol1);
        wink::c_matrix     M2(param.nrow2,param.ncol2);
        
        M1.loadR( REAL(data1) );
        M2.loadR( REAL(data2) );
        
        //======================================================================
        // make C++ neuro_pair, init random generator
        //======================================================================
        wink::neuro_pair   NP(M1,M2,param.B);
        
                
        //======================================================================
        // outer loop on windows
        //======================================================================
        for( size_t i=0; i < param.num_windows; ++i )
        {
            //------------------------------------------------------------------
            // get the boundaries
            //------------------------------------------------------------------
            const double a = param.ptr_windows[0+2*i];
            const double b = param.ptr_windows[1+2*i];
            
            //------------------------------------------------------------------
            // call the integrated function
            //------------------------------------------------------------------
            const size_t true_coinc = NP.true_coincidences_on(a,b,param.delta);            
            ans[i] = true_coinc;
        }
        UNPROTECT(1);
        
        return Rval;
        
    }
    catch(...)
    {
        Rprintf("Exception in wink_true_coincidences");
    }
    return R_NilValue;
}
Esempio n. 8
0
inline 
typename ICR::EnsembleLearning::Discrete<T>::NP_t
ICR::EnsembleLearning::Discrete<T>::CalcNP2Data(moments_parameter Dirichlet)
{
  //the log probs are provided by Dirichlet, need to pass them on
  //Want to simply copy these
  NP_t NP(Dirichlet.size());
  PARALLEL_COPY(Dirichlet.begin(), Dirichlet.end(), NP.begin());
  return  NP;
}
Esempio n. 9
0
inline 
typename ICR::EnsembleLearning::Discrete<T>::NP_t
ICR::EnsembleLearning::Discrete<T>::CalcNP2Prior(moments_parameter Discrete)
{
  //The probabilities are provided by Discrete and need to be passsed onto Prior
  // Want to simply foward these:
  NP_t NP(Discrete.size());
  PARALLEL_COPY(Discrete.begin(), Discrete.end(), NP.begin());
  return NP;
}
Esempio n. 10
0
bool OSystem_GP32::setSoundCallback(SoundProc proc, void *param) {
	NP("OSys::setSoundCallback()");

	GPSOUNDBUF gpSoundBuf;

	ConfMan.setBool("FM_medium_quality", (g_vars.fmQuality == FM_QUALITY_MED));
	ConfMan.setBool("FM_high_quality", (g_vars.fmQuality == FM_QUALITY_HI));
	//ConfMan.set("output_rate", (int)g_vars.sampleRate);

	if (ConfMan.hasKey("output_rate"))
		_samplesPerSec = ConfMan.getInt("output_rate");
		
	_samplesPerSec = (int)g_vars.sampleRate; //hack
	
	if (_samplesPerSec == 0) {
		return false;
	}

	if (_samplesPerSec < 0)
		_samplesPerSec = SAMPLES_PER_SEC;

	// Originally, we always used 2048 samples. This loop will produce the
	// same result at 22050 Hz, and should hopefully produce something
	// sensible for other frequencies. Note that it must be a power of two.

	uint32 samples = 0x8000;

	for (;;) {
		if ((1000 * samples) / _samplesPerSec < 100)
			break;
		samples >>= 1;
	}

	switch(_samplesPerSec) {
		case 44100:
		case 22050:
		case 11025:
			break;
		default:
			_samplesPerSec = 11025;
	}

	gpSoundBuf.freq = _samplesPerSec;
	gpSoundBuf.format = 16;
	gpSoundBuf.channels = 2;
	gpSoundBuf.samples = samples;
	gpSoundBuf.userdata = param;
	gpSoundBuf.callback = proc;
	gp_soundBufStart(&gpSoundBuf);

	// For Safety...
	GPDEBUG("_samplesPerSec = %d, samples = %d", _samplesPerSec, samples);
	gp_delay(1000);
	return true;
}
Esempio n. 11
0
void OSystem_GP32::grabOverlay(OverlayColor *buf, int pitch) {
	NP("OSys::grabOverlay()");
	int h = _overlayHeight;
	OverlayColor *src = _overlayBuffer;

	do {
		memcpy(buf, src, _overlayWidth * sizeof(OverlayColor));
		src += _overlayWidth;
		buf += pitch;
	} while (--h);
}
Esempio n. 12
0
static int wifi_rtsp_outbound(unsigned short port, in_addr_t addr) {
    struct sockaddr_in out;
    //NP("tandylo: [%s:%d:%s],port=%d\n",__FILE__,__LINE__,__func__,port);
    int netfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if (netfd < 0) {
    	NP("tandylo: [%s:%d:%s],port=%d\n",__FILE__,__LINE__,__func__,port);
      return netfd;
    }
    bzero(&out,sizeof(out));
    out.sin_port = htons(port);
    out.sin_family = AF_INET;
    out.sin_addr.s_addr = addr;
    //NP("tandylo: [%s:%d:%s],port=%d\n",__FILE__,__LINE__,__func__,port);
    if (connect (netfd, (struct sockaddr*) &out, sizeof(out)) < 0) {
    	NP("tandylo: [%s:%d:%s],error %s(%d)\n",__FILE__,__LINE__,__func__,strerror(errno),errno);
      close(netfd);      
      return -1;
    }
    return netfd;
}
//void fullBirthStageTest() {
TEST(fullBirthStageTest,fullBirthStageTest_OK){
    int numSubpopulations = 100;    //***changed numSubpopulations to 100***
    vector<double> meanCommunityCultureValues(numSubpopulations);
    vector<vector<Agent> > NP(numSubpopulations);
    vector<vector<Agent> > P(numSubpopulations);


	/*Birth Parameters*/

	int minPopsize = 10; /*Maximum popsize when no adaptive knowledge*/
	double fecundityCurvature = 10;
	double growthRateR = 0.04*20; //should vary between 0.005 and 0.04 multiplied by generation length
	double geneticMutationRate = 0.001;
	int brainMutationValue = 1;

	/*Learning Parameters*/
	double adaptKnowDeviation = 0.1;
	double lossyLearningValue = .9; //0 = Complete loss, 1 = No loss
	double obliqueLearningDeviation = 0.5;
	double learningBiasDeviation = 0.5;
	double indivLearningDeviation = 0.5;
	double indivLearningMean = 0.5;

	/*Migration Parameters*/
	double migrationRate = 0.1;

	/*Selection Parameters*/
	double maxBrainCost = 20;
	double deathRateLambda = 1.0;

	/*Initial values*/
	int initBrain = 1;
	double initAdaptKnowledge = 0.0;
	double initIndivLearning = 1.0; //0 = complete social learner, 1 = complete individual learner
	double initObliqueLearning = 0.0;
	double initLearningBias = 0.0;
	double initPopSize = 10;

    initializePopulation(numSubpopulations, initPopSize, initBrain,
			initIndivLearning, initObliqueLearning, initLearningBias,initAdaptKnowledge, P);

    birthStage(numSubpopulations, P, meanCommunityCultureValues,
				growthRateR, minPopsize, fecundityCurvature, geneticMutationRate,
				brainMutationValue, indivLearningDeviation, obliqueLearningDeviation,
				learningBiasDeviation, lossyLearningValue, adaptKnowDeviation,
				indivLearningMean, NP);

ASSERT_FALSE(NP.empty());
ASSERT_EQ(NP.size(), P.size());
ASSERT_TRUE(meanCommunityCultureValues.size() == numSubpopulations);



}
Esempio n. 14
0
bool OSystem_GP32::showMouse(bool visible) {
	NP("OSys::showMouse()");
	if (_mouseVisible == visible)
		return visible;

	bool last = _mouseVisible;
	_mouseVisible = visible;

	updateScreen();

	return last;
}
Esempio n. 15
0
		void trans()//坐标变换函数 
		{
			double x1,y1,ang;
			x1=T1.GetX();
			y1=T1.GetY();
			ang=T1.GetDeg();
			//冯一飞同学在下面写变换矩阵的求解及世界坐标系下坐标值求解的实现,并幅值给P2,其中 x1 y1 ang 是工件坐标系相对于世界坐标系的变换量 
			MatrixXd TF(3,3),P(3,1),NP(3,1);//P表示工件坐标系下点坐标,NP表示通过变换矩阵转换后的点坐标,TF为变换矩阵 
			TF(0,0)=cos(ang);
			TF(0,1)=sin(ang);
			TF(0,2)=-x1;
			TF(1,0)=-sin(ang);
			TF(1,1)=cos(ang);
			TF(1,2)=-y1;
			TF(2.0)=TF(2,1)=0;
			TF(2,2)=1;
			P(0,0)=p1.getpx();
			P(1,0)=p1.getpy();
			P(2,0)=1;
			NP=TF*P;
			p2.setp(NP(0,0),NP(1,0));
		}
Esempio n. 16
0
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
GLOBAL ISM32
validate_TSS
       	    	    	                    
IFN3(
	IU16, selector,	/* (I) selector to be checked */
	IU32 *, descr_addr,	/* (O) address of related descriptor */
	BOOL, is_switch	/* (I) if true we are in task switch */
    )


   {
   BOOL is_ok = TRUE;
   IU8 AR;
   ISM32 super;

   /* must be in GDT */
   if ( selector_outside_GDT(selector, descr_addr) )
      {
      is_ok = FALSE;
      }
   else
      {
      /* is it really an available TSS segment (is_switch false) or
	 is it really a busy TSS segment (is_switch true) */
      AR = spr_read_byte((*descr_addr)+5);
      super = descriptor_super_type((IU16)AR);
      if ( ( !is_switch &&
	     (super == AVAILABLE_TSS || super == XTND_AVAILABLE_TSS) )
	   ||
           ( is_switch &&
	     (super == BUSY_TSS || super == XTND_BUSY_TSS) ) )
	 ;   /* ok */
      else
	 is_ok = FALSE;
      }
   
   /* handle invalid TSS */
   if ( !is_ok )
      {
      if ( is_switch )
	 TS(selector, FAULT_VALTSS_SELECTOR);
      else
	 GP(selector, FAULT_VALTSS_SELECTOR);
      }

   /* must be present */
   if ( GET_AR_P(AR) == NOT_PRESENT )
      NP(selector, FAULT_VALTSS_NP);

   return super;
   }
Esempio n. 17
0
void OSystem_GP32::setPalette(const byte *colors, uint start, uint num) {
	NP("OSys::setPalette()");
	const byte *b = colors;
	uint i;
	uint16 *base = _currentPalette + start;
	for (i = 0; i < num; i++) {
		base[i] = gp_RGBTo16(b[0], b[1], b[2]);
		b += 4;
	}

//	if (start < _paletteDirtyStart)
//		_paletteDirtyStart = start;

//	if (start + num > _paletteDirtyEnd)
//		_paletteDirtyEnd = start + num;
}
Esempio n. 18
0
void OSystem_GP32::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale) {
	NP("OSys::setMouseCursor()");
	_mouseWidth = w;
	_mouseHeight = h;

	_mouseHotspotX = hotspotX;
	_mouseHotspotY = hotspotY;

	_mouseKeyColor = keycolor;

	if (_mouseBuf)
		free(_mouseBuf);

	_mouseBuf = (byte *)malloc(w * h);
	memcpy(_mouseBuf, buf, w * h);
}
Esempio n. 19
0
OSystem_GP32::OSystem_GP32() :
		_screenWidth(0), _screenHeight(0), _gameScreen(NULL), _hwScreen(NULL),
		_overlayVisible(false), _forceFull(false), _adjustAspectRatio(false),
		/*_paletteDirtyStart(0), _paletteDirtyEnd(0),*/
		_mouseBuf(NULL), _mouseHeight(0), _mouseWidth(0), _mouseKeyColor(0),
		_mouseHotspotX(0), _mouseHotspotY(0) {
	NP("OSys::OSystem_GP32()");
	// allocate palette storage
	memset(_currentPalette, 0, 256 * sizeof(uint16));

	memset(&_km, 0, sizeof(_km));

	// HACK: bring mouse cursor to center
	_mouseX = 160;
	_mouseY = 120;
}
Esempio n. 20
0
static bool addAllCoggan() {
    RideMetricFactory::instance().addMetric(NP());
    QVector<QString> deps;
    deps.append("coggan_np");
    RideMetricFactory::instance().addMetric(IntensityFactor(), &deps);
    deps.append("coggan_if");
    RideMetricFactory::instance().addMetric(TSS(), &deps);
    deps.clear();
    deps.append("coggan_np");
    deps.append("average_power");
    RideMetricFactory::instance().addMetric(VI(), &deps);
    deps.clear();
    deps.append("coggan_np");
    deps.append("average_hr");
    RideMetricFactory::instance().addMetric(EfficiencyFactor(), &deps);
    return true;
}
Esempio n. 21
0
// Clear overlay with game screen
//TODO: Optimize?
void OSystem_GP32::clearOverlay() {
	NP("OSys::clearOverlay()");
	if (!_overlayVisible)
		return;

	uint8 *s = _gameScreen;
	OverlayColor *d = _overlayBuffer;
	uint8 c;
	for (int y = 0; y < _overlayHeight; y++) {
		for (int x = 0; x < _overlayWidth; x++) {
			c = *s;
			*d++ = _currentPalette[c];
			s++;
		}
	}

	_forceFull = true;
}
Esempio n. 22
0
void OSystem_GP32::setTimerCallback(TimerProc callback, int interval) {
	NP("OSys::setTimerCallback()");

	int timerNo = 1;

	if (callback == NULL) {
		GpTimerKill(timerNo);
		return;
	}

	if (GpTimerOptSet(timerNo, interval, 0, _timerCallbackVoid) == GPOS_ERR_ALREADY_USED) {
		error("Timer slot is already used");
	}

	_timerInterval = interval;
	_timerCallback = callback;

	GpTimerSet(timerNo);
}
Esempio n. 23
0
bool wifi_rtsp_quit() 
{
    if (argth&&irtsp_thread_run==1) {
    	NP("tandy: [%s:%d:%s], time=%d\n",__FILE__,__LINE__,__func__,time(NULL));
        argth->quit = true;
    }
	int iter = 100;
	do
	{
		if(irtsp_thread_run == 0) break;
		usleep(100000);
	}
	while(--iter);

	argth = NULL;

    ALOGI("Wifi RTSP quit... good bye \n");
    return true;
}
Esempio n. 24
0
void OSystem_GP32::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
	NP("OSys::copyRectToOverlay()");

	//Clip the coordinates
	if (x < 0) {
		w += x;
		buf -= x;
		x = 0;
	}

	if (y < 0) {
		h += y;
		buf -= y * pitch;
		y = 0;
	}

	if (w > _overlayWidth - x) {
		w = _overlayWidth - x;
	}

	if (h > _overlayHeight - y) {
		h = _overlayHeight - y;
	}

	if (w <= 0 || h <= 0)
		return;

	
	OverlayColor *dst = _overlayBuffer + y * _overlayWidth + x;
	if (_overlayWidth == pitch && pitch == w) {
		memcpy(dst, buf, h * w * sizeof(OverlayColor));
	} else {
		do {
			memcpy(dst, buf, w * sizeof(OverlayColor));
			buf += pitch;
			dst += _overlayWidth;
		} while (--h);
	}
}
Esempio n. 25
0
int OCCWire::project(OCCBase *face) {
    Handle(TopTools_HSequenceOfShape) wires = new TopTools_HSequenceOfShape;
    Handle(TopTools_HSequenceOfShape) edges = new TopTools_HSequenceOfShape;
    TopExp_Explorer ex;
    try {
        BRepOffsetAPI_NormalProjection NP(face->getShape());
        NP.SetLimit(Standard_True);
        NP.Add(this->getWire());
        NP.Build();
        if (!NP.IsDone())
            StdFail_NotDone::Raise("project operation failed");
        
        for (ex.Init(NP.Shape(), TopAbs_EDGE); ex.More(); ex.Next()) {
            if (!ex.Current().IsNull()) {
                edges->Append(TopoDS::Edge(ex.Current()));
            }
        }
        ShapeAnalysis_FreeBounds::ConnectEdgesToWires(edges,Precision::Confusion(),Standard_True,wires);
        if (wires->Length() != 1)
            StdFail_NotDone::Raise("project operation created empty result");
        
        this->setShape(wires->Value(1));
        
        // possible fix shape
        if (!this->fixShape())
            StdFail_NotDone::Raise("Shapes not valid");
        
    } catch(Standard_Failure &err) {
        Handle_Standard_Failure e = Standard_Failure::Caught();
        const Standard_CString msg = e->GetMessageString();
        if (msg != NULL && strlen(msg) > 1) {
            setErrorMessage(msg);
        } else {
            setErrorMessage("Failed to project wire");
        }
        return 0;
    }
    return 1;
}
Esempio n. 26
0
void OSystem_GP32::initSize(uint width, uint height) {
	NP("OSys::initSize()");

	if (width == _screenWidth && height == _screenHeight)
		return;

	_screenWidth = width;
	_screenHeight = height;

	if (height != 200)
		_adjustAspectRatio = false;

	_overlayWidth = width;
	_overlayHeight = height;
//	_overlayWidth = 320;
//	_overlayHeight = 240;

	// Create the surface that contains the 8 bit game data
	_gameScreen = new uint8[_screenWidth * _screenHeight];

	// Create the surface that contains the scaled graphics in 16 bit mode
	_tmpScreen = frameBuffer2;

	// Create the surface that is connected with hardware screen
	_hwScreen = frameBuffer1;

	_overlayBuffer = new OverlayColor[_overlayWidth * _overlayHeight];

	_km.x_max = _screenWidth - 1;
	_km.y_max = _screenHeight - 1;
	_km.x = _mouseX;
	_km.y = _mouseY;
	_km.delay_time = 25;
	_km.last_time = 0;

	// Clear Screen
	gp_fillRect(_hwScreen, 0, 0, 320, 240, 0xFFFF);
}
Esempio n. 27
0
void OSystem_GP32::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) {
	NP("OSys::copyRectToScreen()");
	//Clip the coordinates
	if (x < 0) {
		w += x;
		src -= x;
		x = 0;
	}

	if (y < 0) {
		h += y;
		src -= y * pitch;
		y = 0;
	}

	if (w > _screenWidth - x) {
		w = _screenWidth - x;
	}

	if (h > _screenHeight - y) {
		h = _screenHeight - y;
	}

	if (w <= 0 || h <= 0)
		return;
	
	byte *dst = _gameScreen + y * _screenWidth + x;

	if (_screenWidth == pitch && pitch == w) {
		memcpy(dst, src, h * w);
	} else {
		do {
			memcpy(dst, src, w);
			src += pitch;
			dst += _screenWidth;
		} while (--h);
	}
}
Esempio n. 28
0
void ekvdebug (CKTcircuit *ckt, ekvmodel *model, ekvinstance *here)
{
  fprintf(stdout,"voltage: d=%e\n",NP(d));
  fprintf(stdout,"voltage: g=%e\n",NP(g));
  fprintf(stdout,"voltage: s=%e\n",NP(s));
  fprintf(stdout,"voltage: b=%e\n",NP(b));
  fprintf(stdout,"voltage: di=%e\n",NP(di));
  fprintf(stdout,"voltage: si=%e\n",NP(si));
  fprintf(stdout,"Parameter: model: nmos=%i\n",model->nmos);
  fprintf(stdout,"Parameter: model: pmos=%i\n",model->pmos);
  fprintf(stdout,"Parameter: model: MTYPE=%i\n",model->MTYPE);
  fprintf(stdout,"Parameter: model: TNOM=%e\n",model->TNOM);
  fprintf(stdout,"Parameter: model: IMAX=%e\n",model->IMAX);
  fprintf(stdout,"Parameter: model: TOX=%e\n",model->TOX);
  fprintf(stdout,"Parameter: model: NSUB=%e\n",model->NSUB);
  fprintf(stdout,"Parameter: model: VFB=%e\n",model->VFB);
  fprintf(stdout,"Parameter: model: UO=%e\n",model->UO);
  fprintf(stdout,"Parameter: model: VMAX=%e\n",model->VMAX);
  fprintf(stdout,"Parameter: model: THETA=%e\n",model->THETA);
  fprintf(stdout,"Parameter: model: COX=%e\n",model->COX);
  fprintf(stdout,"Parameter: model: XJ=%e\n",model->XJ);
  fprintf(stdout,"Parameter: model: DL=%e\n",model->DL);
  fprintf(stdout,"Parameter: model: DW=%e\n",model->DW);
  fprintf(stdout,"Parameter: model: GAMMA=%e\n",model->GAMMA);
  fprintf(stdout,"Parameter: model: PHI=%e\n",model->PHI);
  fprintf(stdout,"Parameter: model: VTO=%e\n",model->VTO);
  fprintf(stdout,"Parameter: model: KP=%e\n",model->KP);
  fprintf(stdout,"Parameter: model: UCRIT=%e\n",model->UCRIT);
  fprintf(stdout,"Parameter: model: E0=%e\n",model->E0);
  fprintf(stdout,"Parameter: model: LAMBDA=%e\n",model->LAMBDA);
  fprintf(stdout,"Parameter: model: WETA=%e\n",model->WETA);
  fprintf(stdout,"Parameter: model: LETA=%e\n",model->LETA);
  fprintf(stdout,"Parameter: model: Q0=%e\n",model->Q0);
  fprintf(stdout,"Parameter: model: LK=%e\n",model->LK);
  fprintf(stdout,"Parameter: model: IBA=%e\n",model->IBA);
  fprintf(stdout,"Parameter: model: IBB=%e\n",model->IBB);
  fprintf(stdout,"Parameter: model: IBN=%e\n",model->IBN);
  fprintf(stdout,"Parameter: model: TCV=%e\n",model->TCV);
  fprintf(stdout,"Parameter: model: BEX=%e\n",model->BEX);
  fprintf(stdout,"Parameter: model: UCEX=%e\n",model->UCEX);
  fprintf(stdout,"Parameter: model: IBBT=%e\n",model->IBBT);
  fprintf(stdout,"Parameter: model: AVTO=%e\n",model->AVTO);
  fprintf(stdout,"Parameter: model: AKP=%e\n",model->AKP);
  fprintf(stdout,"Parameter: model: AGAMMA=%e\n",model->AGAMMA);
  fprintf(stdout,"Parameter: model: KF=%e\n",model->KF);
  fprintf(stdout,"Parameter: model: AF=%e\n",model->AF);
  fprintf(stdout,"Parameter: model: NQS=%e\n",model->NQS);
  fprintf(stdout,"Parameter: model: SATLIM=%e\n",model->SATLIM);
  fprintf(stdout,"Parameter: model: XQC=%e\n",model->XQC);
  fprintf(stdout,"Parameter: model: HDIF=%e\n",model->HDIF);
  fprintf(stdout,"Parameter: model: RSH=%e\n",model->RSH);
  fprintf(stdout,"Parameter: model: JS=%e\n",model->JS);
  fprintf(stdout,"Parameter: model: JSW=%e\n",model->JSW);
  fprintf(stdout,"Parameter: model: XTI=%e\n",model->XTI);
  fprintf(stdout,"Parameter: model: N=%e\n",model->N);
  fprintf(stdout,"Parameter: model: CJ=%e\n",model->CJ);
  fprintf(stdout,"Parameter: model: CJSW=%e\n",model->CJSW);
  fprintf(stdout,"Parameter: model: PB=%e\n",model->PB);
  fprintf(stdout,"Parameter: model: PBSW=%e\n",model->PBSW);
  fprintf(stdout,"Parameter: model: MJ=%e\n",model->MJ);
  fprintf(stdout,"Parameter: model: MJSW=%e\n",model->MJSW);
  fprintf(stdout,"Parameter: model: FC=%e\n",model->FC);
  fprintf(stdout,"Parameter: model: FCSW=%e\n",model->FCSW);
  fprintf(stdout,"Parameter: model: CGSO=%e\n",model->CGSO);
  fprintf(stdout,"Parameter: model: CGDO=%e\n",model->CGDO);
  fprintf(stdout,"Parameter: model: CGBO=%e\n",model->CGBO);
  fprintf(stdout,"Parameter: instance: L=%e\n",here->L);
  fprintf(stdout,"Parameter: instance: W=%e\n",here->W);
  fprintf(stdout,"Parameter: instance: M=%e\n",here->M);
  fprintf(stdout,"Parameter: instance: AD=%e\n",here->AD);
  fprintf(stdout,"Parameter: instance: AS=%e\n",here->AS);
  fprintf(stdout,"Parameter: instance: PD=%e\n",here->PD);
  fprintf(stdout,"Parameter: instance: PS=%e\n",here->PS);
  fprintf(stdout,"Parameter: instance: NRD=%e\n",here->NRD);
  fprintf(stdout,"Parameter: instance: NRS=%e\n",here->NRS);
  fprintf(stdout,"Parameter: instance: RS=%e\n",here->RS);
  fprintf(stdout,"Parameter: instance: RD=%e\n",here->RD);
  fprintf(stdout,"model: lc=%e\n",model->lc);
  fprintf(stdout,"instance: isat_s=%e\n",here->isat_s);
  fprintf(stdout,"instance: vexp_s=%e\n",here->vexp_s);
  fprintf(stdout,"instance: gexp_s=%e\n",here->gexp_s);
  fprintf(stdout,"instance: isat_d=%e\n",here->isat_d);
  fprintf(stdout,"instance: vexp_d=%e\n",here->vexp_d);
  fprintf(stdout,"instance: gexp_d=%e\n",here->gexp_d);
  fprintf(stdout,"instance: weff=%e\n",here->weff);
  fprintf(stdout,"instance: leff=%e\n",here->leff);
  fprintf(stdout,"instance: np=%e\n",here->np);
  fprintf(stdout,"instance: ns=%e\n",here->ns);
  fprintf(stdout,"instance: lmin=%e\n",here->lmin);
  fprintf(stdout,"instance: rd=%e\n",here->rd);
  fprintf(stdout,"instance: rs=%e\n",here->rs);
  fprintf(stdout,"instance: dvrsce=%e\n",here->dvrsce);
  fprintf(stdout,"instance: vt=%e\n",here->vt);
  fprintf(stdout,"instance: vto_a=%e\n",here->vto_a);
  fprintf(stdout,"instance: kp_a=%e\n",here->kp_a);
  fprintf(stdout,"instance: gamma_a=%e\n",here->gamma_a);
  fprintf(stdout,"instance: ucrit=%e\n",here->ucrit);
  fprintf(stdout,"instance: phi=%e\n",here->phi);
  fprintf(stdout,"instance: ibb=%e\n",here->ibb);
  fprintf(stdout,"instance: vc=%e\n",here->vc);
  fprintf(stdout,"instance: qb0=%e\n",here->qb0);
  fprintf(stdout,"instance: tmp=%e\n",here->tmp);
  fprintf(stdout,"instance: coxt=%e\n",here->coxt);
  fprintf(stdout,"instance: cbs0=%e\n",here->cbs0);
  fprintf(stdout,"instance: cbs0sw=%e\n",here->cbs0sw);
  fprintf(stdout,"instance: cbd0=%e\n",here->cbd0);
  fprintf(stdout,"instance: cbd0sw=%e\n",here->cbd0sw);
  fprintf(stdout,"instance: cgso=%e\n",here->cgso);
  fprintf(stdout,"instance: cgdo=%e\n",here->cgdo);
  fprintf(stdout,"instance: cgbo=%e\n",here->cgbo);
}
Esempio n. 29
0
int VP() { V(); NP(); }
Esempio n. 30
0
int S() { NP(); VP(); }