您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ trace函数代码示例

51自学网 2021-06-03 08:56:13
  C++
这篇教程C++ trace函数代码示例写得很实用,希望能帮到您。

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

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

示例1: Sleep

	/**	 * Signals the current thread to stop processing for the specified time span.	 *	 * @param timeSpan The amount of time to stop processing.	 */	static void Sleep(const TimeSpan& timeSpan) { StackTrace trace(__METHOD__, __FILE__, __LINE__);		if (timeSpan > TimeSpan::Zero()) {			msleep((uint32_t) timeSpan.TotalMilliseconds());			Idle += timeSpan;		}	}
开发者ID:bakerface,项目名称:nitrus,代码行数:11,


示例2: trace

// update observation data index, azimuth/elevation, satellite list ---------void __fastcall TPlot::UpdateObs(int nobs){    AnsiString s;    prcopt_t opt=prcopt_default;    gtime_t time;    sol_t sol={0};    double pos[3],rr[3],e[3],azel[MAXOBS*2]={0},rs[6],dts[2],var;    int i,j,k,svh,per,per_=-1;    char msg[128],name[16];        trace(3,"UpdateObs/n");        delete [] IndexObs; IndexObs=NULL;    delete [] Az; Az=NULL;    delete [] El; El=NULL;    NObs=0;    if (nobs<=0) return;        IndexObs=new int[nobs+1];    Az=new double[Obs.n];    El=new double[Obs.n];        opt.err[0]=900.0;        ReadWaitStart();    ShowLegend(NULL);        for (i=0;i<Obs.n;i=j) {        time=Obs.data[i].time;        for (j=i;j<Obs.n;j++) {            if (timediff(Obs.data[j].time,time)>TTOL) break;        }        IndexObs[NObs++]=i;                for (k=0;k<j-i;k++) {            azel[k*2]=azel[1+k*2]=0.0;        }        if (RcvPos==0) {            pntpos(Obs.data+i,j-i,&Nav,&opt,&sol,azel,NULL,msg);            matcpy(rr,sol.rr,3,1);            ecef2pos(rr,pos);        }        else {            if (RcvPos==1) { // lat/lon/height                for (k=0;k<3;k++) pos[k]=OOPos[k];                pos2ecef(pos,rr);            }            else { // rinex header position                for (k=0;k<3;k++) rr[k]=Sta.pos[k];                ecef2pos(rr,pos);            }            for (k=0;k<j-i;k++) {                azel[k*2]=azel[1+k*2]=0.0;                if (!satpos(time,time,Obs.data[i+k].sat,EPHOPT_BRDC,&Nav,rs,dts,                            &var,&svh)) continue;                if (geodist(rs,rr,e)>0.0) satazel(pos,e,azel+k*2);            }        }        // satellite azel by tle data        for (k=0;k<j-i;k++) {            if (azel[k*2]!=0.0||azel[1+k*2]!=0.0) continue;            satno2id(Obs.data[i+k].sat,name);            if (!tle_pos(time,name,"","",&TLEData,NULL,rs)) continue;            if (geodist(rs,rr,e)>0.0) satazel(pos,e,azel+k*2);        }        for (k=0;k<j-i;k++) {            Az[i+k]=azel[  k*2];            El[i+k]=azel[1+k*2];            if (Az[i+k]<0.0) Az[i+k]+=2.0*PI;        }        per=(i+1)*100/Obs.n;        if (per!=per_) {            ShowMsg(s.sprintf("updating azimuth/elevation... (%d%%)",(per_=per)));            Application->ProcessMessages();        }    }    IndexObs[NObs]=Obs.n;        UpdateSatList();        ReadWaitEnd();}
开发者ID:jpieper,项目名称:RTKLIB,代码行数:83,


示例3: min_hit

Color Scene::trace(const Ray &ray, int steps,double eta1){    // Find hit object and distance    Hit min_hit(std::numeric_limits<double>::infinity(),Vector());    Object *obj = NULL;    for (unsigned int i = 0; i < objects.size(); ++i) {        Hit hit(objects[i]->intersect(ray));        if (hit.t<min_hit.t) {            min_hit = hit;            obj = objects[i];        }    }    // No hit? Return background color.    if (!obj) return Color(0.0, 0.0, 0.0);    Material *material = obj->material;            //the hit objects material    Point hit = ray.at(min_hit.t);                 //the hit point    Vector N = min_hit.N;                          //the normal at hit point    Vector V = -ray.D;                             //the view vector    /****************************************************    * This is where you should insert the color    * calculation (Phong model).    *    * Given: material, hit, N, V, lights[]    * Sought: color    *    * Hints: (see triple.h)    *        Triple.dot(Vector) dot product    *        Vector+Vector      vector sum    *        Vector-Vector      vector difference    *        Point-Point        yields vector    *        Vector.normalize() normalizes vector, returns length    *        double*Color        scales each color component (r,g,b)    *        Color*Color        dito    *        pow(a,b)           a to the power of b    ****************************************************/    // extract and/or declare variables    // for lighting calculations    Color ambient = Color(1.0,1.0,1.0); // ambient colour    Color base = material->color; // material colour    double ka = material->ka; // ambient intensity;    double kd = material->kd; // diffuse intensity    double ks = material->ks; // specular intensity    double e = material->n; // exponent of specular highlight size    double reflect = material->reflect; // reflect coefficient    double refract = material->refract; // refraction coefficient    double eta2 = material->eta; // refraction index    if(eta1 == eta2){      eta2 = AIR_ETA;    }    // get reflected ray    Vector vec_ref = ray.D - (2.0 *(ray.D.dot(N))*N); // reflect ray direction    Ray ray_ref(hit,vec_ref); //reflect ray    // jiggle the ray    jiggle(ray_ref);    // hack    Vector frac_n;    if(ray.D.dot(N) < 0.0){      frac_n = N;    }else{      frac_n = -N;    }    // get refracted ray    bool frac_flag;    Vector frac_dir = fractf(eta1,eta2,ray.D,frac_n); // direction of refraction    Ray ray_frac(hit,frac_dir); // ray going out of the material    if(frac_dir.length_2() > 0.0 && refract > 0.0){      frac_flag = true;    }else{      frac_flag = false;    }    // jiggle the ray    jiggle(ray_frac);    Color c_ref; // colour of reflected ray    Color c_frac; // colour of refracted ray    // recursively trace reflected/refracted rays up to steps times    if(steps > 0){      if(reflect > 0.0) c_ref = trace(ray_ref,steps-1,eta1);      if(frac_flag) c_frac = trace(ray_frac, steps-1,eta2);    }    Color color = ka * base * ambient; // set ambient colour    for(unsigned int i = 0;i<lights.size();i++){      bool shaded = false; // flag if the current light cast a shadow      Vector L = hit - lights[i]->position; // vector of light direction      Vector SL = lights[i]->position - hit; // vector of shadow feeler      L.normalize();      SL.normalize();      // get shadow feelers//.........这里部分代码省略.........
开发者ID:SGBon,项目名称:CSCI-3090,代码行数:101,


示例4: dbSave

int dbSave(int did, char_t *filename, int flags){	int			row, column, nColumns, nRows, fd, rc;	int			*colTypes, *pRow, nRet, tid;	char_t		*path, *tmpFile, *tmpNum;	char_t		**colNames;	dbTable_t	*pTable;	trace(5, T("DB: About to save database to file/n"));	a_assert(dbMaxTables > 0);/* *	First write to a temporary file, then switch around later. */	fmtAlloc(&tmpFile, FNAMESIZE, T("%s/data.tmp"), basicGetProductDir());	if ((fd = gopen(tmpFile, 		O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0666)) < 0) {		trace(1, T("WARNING: Failed to open file %s/n"), tmpFile);		bfree(B_L, tmpFile);		return -1;	}	nRet = 0;	for (tid = 0; (tid < dbMaxTables) && (nRet != -1); tid++) {		pTable = dbListTables[tid];		if (pTable) {/* *			Print the TABLE=tableName directive to the file */			rc = dbWriteKeyValue(fd, KEYWORD_TABLE, pTable->name);			nColumns = pTable->nColumns;			nRows = pTable->nRows;			for (row = 0; (row < nRows) && (nRet == 0); row++) {				pRow = pTable->rows[row];/* *				if row is NULL, the row has been deleted, so don't *				write it out. */				if ((pRow == NULL) || (pRow[0] == '/0') || 					(*(char_t *)(pRow[0]) == '/0')) {					continue;				}/* *				Print the ROW=rowNumber directive to the file */				fmtAlloc(&tmpNum, 20, T("%d"), row);						rc = dbWriteKeyValue(fd, KEYWORD_ROW, tmpNum);				bfreeSafe(B_L, tmpNum);				colNames = pTable->columnNames;				colTypes = pTable->columnTypes;/* *				Print the key-value pairs (COLUMN=value) for data cells */				for (column = 0; (column < nColumns) && (rc >= 0); 					column++, colNames++, colTypes++) {					if (*colTypes == T_STRING) {						rc = dbWriteKeyValue(fd, *colNames, 							(char_t *)(pRow[column]));					} else {						fmtAlloc(&tmpNum, 20, T("%d"), pRow[column]);								rc = dbWriteKeyValue(fd, *colNames, tmpNum);						bfreeSafe(B_L, tmpNum);					}				}				if (rc < 0) {					trace(1, T("WARNING: Failed to write to file %s/n"), 						tmpFile);					nRet = -1;				}			}		}	}	gclose(fd);/* *	Replace the existing file with the temporary file, if no errors */	if (nRet == 0) {		fmtAlloc(&path, FNAMESIZE, T("%s/%s"), basicGetProductDir(), filename);		gunlink(path);		if (grename(tmpFile, path) != 0) {			trace(1, T("WARNING: Failed to rename %s to %s/n"), tmpFile, path);			nRet = -1;		}		bfree(B_L, path);	}	bfree(B_L, tmpFile);	return nRet;//.........这里部分代码省略.........
开发者ID:houzhenggang,项目名称:MT,代码行数:101,


示例5: answer

staticintanswer(void){    return trace(&mats[NMATS-1]);}
开发者ID:srikk595,项目名称:Operating-Systems-OS161,代码行数:6,


示例6: bar

Tracer bar(Tracer const &t){	Tracer trace("bar");	t.show();	return trace;}
开发者ID:PeterSommerlad,项目名称:CPlusPlusLecture,代码行数:5,


示例7: Time

		/**		 * The time that the delegate should be invoked.		 * Since the event loop is blocking, it is not guaranteed that the delegate will be invoked exactly at that time.		 *		 * @return The time the delegate should be invoked.		 */		const DateTime& Time() const { StackTrace trace(__METHOD__, __FILE__, __LINE__);			return _time;		}
开发者ID:bakerface,项目名称:nitrus,代码行数:9,


示例8: test_info

static void test_info(void){    DWORD hdl, retval;    PVOID pVersionInfo = NULL;    BOOL boolret;    VS_FIXEDFILEINFO *pFixedVersionInfo;    UINT uiLength;    char VersionString[MAX_PATH];    static CHAR backslash[] = "//";    DWORDLONG dwlVersion;    hdl = 0x55555555;    SetLastError(MY_LAST_ERROR);    retval = GetFileVersionInfoSizeA( "kernel32.dll", &hdl);    ok( retval,	"GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x/n",	retval);    ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),	"Last error wrong! NO_ERROR/0x%08x (NT4)  expected, got %u/n",	MY_LAST_ERROR, GetLastError());    ok( hdl == 0L,	"Handle wrong! 0L expected, got 0x%08x/n", hdl);    if ( retval == 0 || hdl != 0)        return;    pVersionInfo = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, retval );    ok(pVersionInfo != 0, "HeapAlloc failed/n" );    if (pVersionInfo == 0)        return;    if (0)    {    /* this test crashes on WinNT4     */    boolret = GetFileVersionInfoA( "kernel32.dll", 0, retval, 0);    ok (!boolret, "GetFileVersionInfoA should have failed: GetLastError = %u/n", GetLastError());    ok ((GetLastError() == ERROR_INVALID_DATA) || (GetLastError() == ERROR_BAD_PATHNAME) ||	(GetLastError() == NO_ERROR),        "Last error wrong! ERROR_INVALID_DATA/ERROR_BAD_PATHNAME (ME)/"	"NO_ERROR (95) expected, got %u/n",        GetLastError());    }    boolret = GetFileVersionInfoA( "kernel32.dll", 0, retval, pVersionInfo );    ok (boolret, "GetFileVersionInfoA failed: GetLastError = %u/n", GetLastError());    if (!boolret)        goto cleanup;    boolret = VerQueryValueA( pVersionInfo, NULL, (LPVOID *)&pFixedVersionInfo, &uiLength );    ok (boolret || GetLastError() == NO_ERROR /* Win98 */,       "VerQueryValueA failed: GetLastError = %u/n", GetLastError());    boolret = VerQueryValueA( pVersionInfo, "", (LPVOID *)&pFixedVersionInfo, &uiLength );    ok (boolret, "VerQueryValueA failed: GetLastError = %u/n", GetLastError());    boolret = VerQueryValueA( pVersionInfo, backslash, (LPVOID *)&pFixedVersionInfo, &uiLength );    ok (boolret, "VerQueryValueA failed: GetLastError = %u/n", GetLastError());    if (!boolret)        goto cleanup;    dwlVersion = (((DWORDLONG)pFixedVersionInfo->dwFileVersionMS) << 32) +        pFixedVersionInfo->dwFileVersionLS;    VersionDwordLong2String(dwlVersion, VersionString);    trace("kernel32.dll version: %s/n", VersionString);    if (0)    {    /* this test crashes on WinNT4     */    boolret = VerQueryValueA( pVersionInfo, backslash, (LPVOID *)&pFixedVersionInfo, 0);    ok (boolret, "VerQueryValue failed: GetLastError = %u/n", GetLastError());    }cleanup:    HeapFree( GetProcessHeap(), 0, pVersionInfo);}
开发者ID:lucianolorenti,项目名称:wine,代码行数:79,


示例9: FutureEventHandler

		/**		 * Creates a new future event handler.		 *		 * @param time The time that the delegate should be invoked.		 * @param delegate The delegate to invoke.		 */		FutureEventHandler(const DateTime& time, const Delegate<void ()>& delegate) : _time(time), _delegate(delegate) { StackTrace trace(__METHOD__, __FILE__, __LINE__);		}
开发者ID:bakerface,项目名称:nitrus,代码行数:9,


示例10: trace

		/**		 * Deletes the future event handler.		 */		virtual ~FutureEventHandler() { StackTrace trace(__METHOD__, __FILE__, __LINE__);		}
开发者ID:bakerface,项目名称:nitrus,代码行数:6,


示例11: UnitTest

	/**	 * Performs unit testing on functions in this class to ensure expected operation.	 */	static void UnitTest() { StackTrace trace(__METHOD__, __FILE__, __LINE__);	}
开发者ID:bakerface,项目名称:nitrus,代码行数:6,


示例12: Invoke

	/**	 * Schedules a delegate to be executed as soon as the thread is capable.	 *	 * @param delegate The delegate to invoke.	 */	static void Invoke(const Delegate<void ()>& delegate) { StackTrace trace(__METHOD__, __FILE__, __LINE__);		Thread::SetTimeout(TimeSpan::Zero(), delegate);	}
开发者ID:bakerface,项目名称:nitrus,代码行数:8,


示例13: SetTimeout

	/**	 * Schedules a delegate to be executed after the specified amount of time passed.	 *	 * @param timeout The duration to wait before executing the delegate.	 * @param delegate The delegate to invoke.	 */	static void SetTimeout(const TimeSpan& timeout, const Delegate<void ()>& delegate) { StackTrace trace(__METHOD__, __FILE__, __LINE__);		FutureEvents.push(FutureEventHandler(DateTime::Utc() + timeout, delegate));	}
开发者ID:bakerface,项目名称:nitrus,代码行数:9,


示例14: decode_bds_d1

/* decode BeiDou D1 ephemeris --------------------------------------------------* decode BeiDou D1 ephemeris (IGSO/MEO satellites) (ref [3] 5.2)* args   : unsigned char *buff I beidou D1 subframe bits*                                  buff[ 0- 37]: subframe 1 (300 bits)*                                  buff[38- 75]: subframe 2*                                  buff[76-113]: subframe 3*          eph_t    *eph    IO  ephemeris structure* return : status (1:ok,0:error)*-----------------------------------------------------------------------------*/extern int decode_bds_d1(const unsigned char *buff, eph_t *eph){    double toc_bds,sqrtA;    unsigned int toe1,toe2,sow1,sow2,sow3;    int i,frn1,frn2,frn3;        trace(3,"decode_bds_d1:/n");        i=8*38*0; /* subframe 1 */    frn1       =getbitu (buff,i+ 15, 3);    sow1       =getbitu2(buff,i+ 18, 8,i+30,12);    eph->svh   =getbitu (buff,i+ 42, 1); /* SatH1 */    eph->iodc  =getbitu (buff,i+ 43, 5); /* AODC */    eph->sva   =getbitu (buff,i+ 48, 4);    eph->week  =getbitu (buff,i+ 60,13); /* week in BDT */    toc_bds    =getbitu2(buff,i+ 73, 9,i+ 90, 8)*8.0;    eph->tgd[0]=getbits (buff,i+ 98,10)*0.1*1E-9;    eph->tgd[1]=getbits2(buff,i+108, 4,i+120, 6)*0.1*1E-9;    eph->f2    =getbits (buff,i+214,11)*P2_66;    eph->f0    =getbits2(buff,i+225, 7,i+240,17)*P2_33;    eph->f1    =getbits2(buff,i+257, 5,i+270,17)*P2_50;    eph->iode  =getbitu (buff,i+287, 5); /* AODE */        i=8*38*1; /* subframe 2 */    frn2       =getbitu (buff,i+ 15, 3);    sow2       =getbitu2(buff,i+ 18, 8,i+30,12);    eph->deln  =getbits2(buff,i+ 42,10,i+ 60, 6)*P2_43*SC2RAD;    eph->cuc   =getbits2(buff,i+ 66,16,i+ 90, 2)*P2_31;    eph->M0    =getbits2(buff,i+ 92,20,i+120,12)*P2_31*SC2RAD;    eph->e     =getbitu2(buff,i+132,10,i+150,22)*P2_33;    eph->cus   =getbits (buff,i+180,18)*P2_31;    eph->crc   =getbits2(buff,i+198, 4,i+210,14)*P2_6;    eph->crs   =getbits2(buff,i+224, 8,i+240,10)*P2_6;    sqrtA      =getbitu2(buff,i+250,12,i+270,20)*P2_19;    toe1       =getbitu (buff,i+290, 2); /* TOE 2-MSB */    eph->A     =sqrtA*sqrtA;        i=8*38*2; /* subframe 3 */    frn3       =getbitu (buff,i+ 15, 3);    sow3       =getbitu2(buff,i+ 18, 8,i+30,12);    toe2       =getbitu2(buff,i+ 42,10,i+ 60, 5); /* TOE 5-LSB */    eph->i0    =getbits2(buff,i+ 65,17,i+ 90,15)*P2_31*SC2RAD;    eph->cic   =getbits2(buff,i+105, 7,i+120,11)*P2_31;    eph->OMGd  =getbits2(buff,i+131,11,i+150,13)*P2_43*SC2RAD;    eph->cis   =getbits2(buff,i+163, 9,i+180, 9)*P2_31;    eph->idot  =getbits2(buff,i+189,13,i+210, 1)*P2_43*SC2RAD;    eph->OMG0  =getbits2(buff,i+211,21,i+240,11)*P2_31*SC2RAD;    eph->omg   =getbits2(buff,i+251,11,i+270,21)*P2_31*SC2RAD;    eph->toes  =merge_two_u(toe1,toe2,15)*8.0;        /* check consistency of subframe numbers, sows and toe/toc */    if (frn1!=1||frn2!=2||frn3!=3) {        trace(3,"decode_bds_d1 error: frn=%d %d %d/n",frn1,frn2,frn3);        return 0;    }    if (sow2!=sow1+6||sow3!=sow2+6) {        trace(3,"decode_bds_d1 error: sow=%d %d %d/n",sow1,sow2,sow3);        return 0;    }    if (toc_bds!=eph->toes) {        trace(3,"decode_bds_d1 error: toe=%.0f toc=%.0f/n",eph->toes,toc_bds);        return 0;    }    eph->ttr=bdt2gpst(bdt2time(eph->week,sow1));      /* bdt -> gpst */    if      (eph->toes>sow1+302400.0) eph->week++;    else if (eph->toes<sow1-302400.0) eph->week--;    eph->toe=bdt2gpst(bdt2time(eph->week,eph->toes)); /* bdt -> gpst */    eph->toc=bdt2gpst(bdt2time(eph->week,toc_bds));   /* bdt -> gpst */    return 1;}
开发者ID:Allidylls,项目名称:RTKLIB,代码行数:79,


示例15: test_info_size

static void test_info_size(void){   DWORD hdl, retval;    char mypath[MAX_PATH] = "";    SetLastError(MY_LAST_ERROR);    retval = GetFileVersionInfoSizeA( NULL, NULL);    ok( !retval,	"GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08x/n",	retval);    EXPECT_INVALID__NOT_FOUND;    hdl = 0x55555555;    SetLastError(MY_LAST_ERROR);    retval = GetFileVersionInfoSizeA( NULL, &hdl);    ok( !retval,	"GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08x/n",	retval);    EXPECT_INVALID__NOT_FOUND;    ok( hdl == 0L,	"Handle wrong! 0L expected, got 0x%08x/n", hdl);    SetLastError(MY_LAST_ERROR);    retval = GetFileVersionInfoSizeA( "", NULL);    ok( !retval,	"GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08x/n",	retval);    EXPECT_BAD_PATH__NOT_FOUND;    hdl = 0x55555555;    SetLastError(MY_LAST_ERROR);    retval = GetFileVersionInfoSizeA( "", &hdl);    ok( !retval,	"GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08x/n",	retval);    EXPECT_BAD_PATH__NOT_FOUND;    ok( hdl == 0L,	"Handle wrong! 0L expected, got 0x%08x/n", hdl);    SetLastError(MY_LAST_ERROR);    retval = GetFileVersionInfoSizeA( "kernel32.dll", NULL);    ok( retval,	"GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x/n",	retval);    ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),	"Last error wrong! NO_ERROR/0x%08x (NT4)  expected, got %u/n",	MY_LAST_ERROR, GetLastError());    hdl = 0x55555555;    SetLastError(MY_LAST_ERROR);    retval = GetFileVersionInfoSizeA( "kernel32.dll", &hdl);    ok( retval,	"GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x/n",	retval);    ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),	"Last error wrong! NO_ERROR/0x%08x (NT4)  expected, got %u/n",	MY_LAST_ERROR, GetLastError());    ok( hdl == 0L,	"Handle wrong! 0L expected, got 0x%08x/n", hdl);    SetLastError(MY_LAST_ERROR);    retval = GetFileVersionInfoSizeA( "notexist.dll", NULL);    ok( !retval,	"GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08x/n",	retval);    ok( (ERROR_FILE_NOT_FOUND == GetLastError()) ||	(ERROR_RESOURCE_DATA_NOT_FOUND == GetLastError()) ||	(MY_LAST_ERROR == GetLastError()) ||	(ERROR_SUCCESS == GetLastError()), /* win2k */	"Last error wrong! ERROR_FILE_NOT_FOUND/ERROR_RESOURCE_DATA_NOT_FOUND "	"(XP)/0x%08x (NT4) expected, got %u/n", MY_LAST_ERROR, GetLastError());    /* test a currently loaded executable */    if(GetModuleFileNameA(NULL, mypath, MAX_PATH)) {	hdl = 0x55555555;	SetLastError(MY_LAST_ERROR);	retval = GetFileVersionInfoSizeA( mypath, &hdl);	ok( retval,            "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x/n",	    retval);	ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),            "Last error wrong! NO_ERROR/0x%08x (NT4)  expected, got %u/n",	    MY_LAST_ERROR, GetLastError());	ok( hdl == 0L,            "Handle wrong! 0L expected, got 0x%08x/n", hdl);    }    else	trace("skipping GetModuleFileNameA(NULL,..) failed/n");    /* test a not loaded executable */    if(GetSystemDirectoryA(mypath, MAX_PATH)) {	lstrcatA(mypath, "//regsvr32.exe");	if(INVALID_FILE_ATTRIBUTES == GetFileAttributesA(mypath))	    trace("GetFileAttributesA(%s) failed/n", mypath);	else {	    hdl = 0x55555555;	    SetLastError(MY_LAST_ERROR);	    retval = GetFileVersionInfoSizeA( mypath, &hdl);	    ok( retval,		"GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x/n",//.........这里部分代码省略.........
开发者ID:lucianolorenti,项目名称:wine,代码行数:101,


示例16: websUrlHandlerRequest

int websUrlHandlerRequest(webs_t wp){	websUrlHandlerType	*sp;	int					i, first;	a_assert(websValid(wp));/* *	Delete the socket handler as we don't want to start reading any *	data on the connection as it may be for the next pipelined HTTP/1.1 *	request if using Keep Alive */	socketDeleteHandler(wp->sid);	wp->state = WEBS_PROCESSING;	websStats.handlerHits++;		websSetRequestPath(wp, websGetDefaultDir(), NULL);/* *	Eliminate security hole */ 	websCondenseMultipleChars(wp->path, '/');	websCondenseMultipleChars(wp->url, '/');	/* Fix by Luigi Auriemma 19 Jan 2004 */	/* http://aluigi.altervista.org/adv/goahead-adv2.txt */	if ((wp->path[0] != '/') || strchr(wp->path, '//')) {		websError(wp, 400, T("Bad request"));		return 0;	}/* *	We loop over each handler in order till one accepts the request.  *	The security handler will handle the request if access is NOT allowed. */	first = 1;	for (i = 0; i < websUrlHandlerMax; i++) {		sp = &websUrlHandler[i];		if (sp->handler && gstrncmp(sp->urlPrefix, wp->path, sp->len) == 0) {			if (first) {				websSetEnv(wp);				first = 0;			}			if ((*sp->handler)(wp, sp->urlPrefix, sp->webDir, sp->arg, 					wp->url, wp->path, wp->query)) {				return 1;			}			if (!websValid(wp)) {				trace(0, 				T("webs: handler %s called websDone, but didn't return 1/n"),					sp->urlPrefix);				return 1;			}		}	}/* *	If no handler processed the request, then return an error. Note: It is  *	the handlers responsibility to call websDone */	if (i >= websUrlHandlerMax) {      /*       * 13 Mar 03 BgP       * preventing a cross-site scripting exploit		websError(wp, 200, T("No handler for this URL %s"), wp->url);       */		websError(wp, 200, T("No handler for this URL"));	}	return 0;}
开发者ID:LIUSHILI,项目名称:Graduationceremony,代码行数:69,


示例17: test_SIPLoad

static void test_SIPLoad(void){    BOOL ret;    GUID subject;    static GUID dummySubject = { 0xdeadbeef, 0xdead, 0xbeef, { 0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef }};    static GUID unknown      = { 0xC689AABA, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }}; /* WINTRUST.DLL */    static GUID unknown2     = { 0xDE351A43, 0x8E59, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }}; /* WINTRUST.DLL */    /* The next SIP is available on Windows and on Wine */    static GUID unknown3     = { 0x000C10F1, 0x0000, 0x0000, { 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 }}; /* MSISIP.DLL */    SIP_DISPATCH_INFO sdi;    HMODULE hCrypt;    /* All NULL */    SetLastError(0xdeadbeef);    ret = CryptSIPLoad(NULL, 0, NULL);    ok ( !ret, "Expected CryptSIPLoad to fail/n");    ok ( GetLastError() == ERROR_INVALID_PARAMETER,        "Expected ERROR_INVALID_PARAMETER, got 0x%08x/n", GetLastError());    /* Only pSipDispatch NULL */    SetLastError(0xdeadbeef);    ret = CryptSIPLoad(&subject, 0, NULL);    ok ( !ret, "Expected CryptSIPLoad to fail/n");    ok ( GetLastError() == ERROR_INVALID_PARAMETER,        "Expected ERROR_INVALID_PARAMETER, got 0x%08x/n", GetLastError());    /* No NULLs, but nonexistent pgSubject */    SetLastError(0xdeadbeef);    memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));    sdi.cbSize = sizeof(SIP_DISPATCH_INFO);    sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;    ret = CryptSIPLoad(&dummySubject, 0, &sdi);    ok ( !ret, "Expected CryptSIPLoad to fail/n");    ok ( GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN,        "Expected TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08x/n", GetLastError());    ok( sdi.pfGet == (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected no change to the function pointer/n");    hCrypt = GetModuleHandleA("crypt32.dll");    funcCryptSIPGetSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPGetSignedDataMsg");    funcCryptSIPPutSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPPutSignedDataMsg");    funcCryptSIPCreateIndirectData = (void*)GetProcAddress(hCrypt, "CryptSIPCreateIndirectData");    funcCryptSIPVerifyIndirectData = (void*)GetProcAddress(hCrypt, "CryptSIPVerifyIndirectData");    funcCryptSIPRemoveSignedDataMsg = (void*)GetProcAddress(hCrypt, "CryptSIPRemoveSignedDataMsg");    /* All OK */    SetLastError(0xdeadbeef);    memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));    sdi.cbSize = sizeof(SIP_DISPATCH_INFO);    sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;    ret = CryptSIPLoad(&unknown, 0, &sdi);    ok ( ret, "Expected CryptSIPLoad to succeed/n");    /* On native the last error will always be ERROR_PROC_NOT_FOUND as native searches for the function DllCanUnloadNow     * in WINTRUST.DLL (in this case). This function is not available in WINTRUST.DLL.     * For now there's no need to implement this is Wine as I doubt any program will rely on     * this last error when the call succeeded.     */    ok( sdi.pfGet != (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected a function pointer to be loaded./n");    /* The function addresses returned by CryptSIPLoad are actually the addresses of     * crypt32's own functions. A function calling these addresses will end up first     * calling crypt32 functions which in its turn call the equivalent in the SIP     * as dictated by the given GUID.     */    if (funcCryptSIPGetSignedDataMsg && funcCryptSIPPutSignedDataMsg && funcCryptSIPCreateIndirectData &&        funcCryptSIPVerifyIndirectData && funcCryptSIPRemoveSignedDataMsg)        ok (sdi.pfGet == funcCryptSIPGetSignedDataMsg &&            sdi.pfPut == funcCryptSIPPutSignedDataMsg &&            sdi.pfCreate == funcCryptSIPCreateIndirectData &&            sdi.pfVerify == funcCryptSIPVerifyIndirectData &&            sdi.pfRemove == funcCryptSIPRemoveSignedDataMsg,            "Expected function addresses to be from crypt32/n");    else        trace("Couldn't load function pointers/n");    /* All OK, but different GUID (same SIP though) */    SetLastError(0xdeadbeef);    memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));    sdi.cbSize = sizeof(SIP_DISPATCH_INFO);    sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;    ret = CryptSIPLoad(&unknown2, 0, &sdi);    ok ( ret, "Expected CryptSIPLoad to succeed/n");    /* This call on its own would have resulted in an ERROR_PROC_NOT_FOUND, but the previous     * call to CryptSIPLoad already loaded wintrust.dll. As this information is cached,     * CryptSIPLoad will not try to search for the already mentioned DllCanUnloadNow.     */    ok( sdi.pfGet != (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected a function pointer to be loaded./n");    /* All OK, but other SIP */    SetLastError(0xdeadbeef);    memset(&sdi, 0, sizeof(SIP_DISPATCH_INFO));    sdi.cbSize = sizeof(SIP_DISPATCH_INFO);    sdi.pfGet = (pCryptSIPGetSignedDataMsg)0xdeadbeef;    ret = CryptSIPLoad(&unknown3, 0, &sdi);    if (ret)    {        /* The SIP is known so we can safely assume that the next tests can be done */        /* As msisip.dll is not checked yet by any of the previous calls, the         * function DllCanUnloadNow will be checked again in msisip.dll (it's not present)         *///.........这里部分代码省略.........
开发者ID:AlexSteel,项目名称:wine,代码行数:101,


示例18: foo

void foo(Tracer t){	Tracer trace("foo");	t.show();}
开发者ID:PeterSommerlad,项目名称:CPlusPlusLecture,代码行数:4,


示例19: trace

void CocoFontsCache::init(){    if(FT_Init_FreeType(&ftLibrary)) { trace("Could not initialize FreeType library!/n"); }    else { trace("FreeType OK!/n"); }}
开发者ID:Czou,项目名称:Coconut2D,代码行数:5,


示例20: dbSearchStr

int dbSearchStr(int did, char_t *tablename, 	char_t *colName, char_t *value, int flags){	int			tid, nRows, nColumns, column;   int match = 0;	dbTable_t	*pTable;	a_assert(tablename);	a_assert(colName);	a_assert(value);	tid = dbGetTableId(0, tablename);	a_assert(tid >= 0);	if ((tid >= 0) && (tid < dbMaxTables) && (dbListTables[tid] != NULL)) {		pTable = dbListTables[tid];	} else {		return DB_ERR_TABLE_NOT_FOUND;	}		nColumns = pTable->nColumns;	nRows = pTable->nRows;	column = GetColumnIndex(tid, colName);	a_assert (column >= 0);	if (column >= 0) {		char_t	*compareVal;		int		row, *pRow;/* *		Scan through rows until we find a match. *		Note that some of these rows may be deleted! */		row = 0;		while (row < nRows) {			pRow = pTable->rows[row];			if (pRow) {				compareVal = (char_t *)(pRow[column]);             if (NULL != compareVal)            {              if (DB_CASE_INSENSITIVE == flags)              {                 match = gstricmp(compareVal, value);              }              else              {                 match = gstrcmp(compareVal, value);              }              if (0 == match)              {                 return row;              }            }			}			row++;		}	} else { /* *		Return -2 if search column was not found */		trace(3, T("DB: Unable to find column <%s> in table <%s>/n"), 			colName, tablename);		return DB_ERR_COL_NOT_FOUND;	}	return -1;}
开发者ID:houzhenggang,项目名称:MT,代码行数:66,


示例21: cecrdr

static voidcecrdr(void *vp){	Proc *up = externup();	Block *bp;	Conn *cp;	If *ifc;	Pkt *p;	ifc = vp;	if(waserror())		goto exit;	discover(ifc, 0);	for(;;){		bp = ifc->d->bread(ifc->dc, 1514, 0); // do we care about making the MTU non magic?		if(bp == nil)			nexterror();		p = (Pkt *)bp->rp;		if(p->etype[0] != 0xbc || p->etype[1] != 0xbc){			freeb(bp);			continue;		}		trace(bp);		cp = findconn(p->src, p->conn);		if(cp == nil){			cecprint("cec: out of connection structures/n");			freeb(bp);			continue;		}		if (waserror()){			freeb(bp);			qunlock(cp);			continue;		}		switch(p->type){		case Tinita:			if(cp->bp){				cecprint("cec: reset with bp!? ask quanstro/n");				freeb(cp->bp);				cp->bp = 0;			}			inita(cp, ifc, p);			break;		case Tinitb:			cecprint("cec: unexpected initb/n");			break;		case Tinitc:			if(cp->state == Cinitb){				ack(cp);				if(cp->passwd[0]){					cp->state = Clogin;					conputs(cp, "password: ");					start(cp);				}else					cp->state = Copen;			}			break;		case Tdata:			incoming(cp, ifc, p);			break;		case Tack:			if(cp->state == Clogin || cp->state == Copen){				ack(cp);				start(cp);			}			break;		case Tdiscover:			discover(ifc, p);			break;		case Toffer:			// cecprint("cec: unexpected offer/n"); from ourselves.			break;		case Treset:			if(cp->bp)				freeb(cp->bp);			cp->bp = 0;			cp->state = Cunused;			break;		default:			cecprint("bad cec type: %d/n", p->type);			break;		}		nexterror();	}exit:	for(cp = conn; cp < conn+nelem(conn); cp++)		if(cp->ifc == ifc){			if(cp->bp)				freeb(cp->bp);			memset(cp, 0, sizeof *cp);			break;		}	memset(ifc, 0, sizeof *ifc);	pexit("cec exiting", 1);}
开发者ID:dalmonian,项目名称:harvey,代码行数:98,


示例22: dbLoad

int dbLoad(int did, char_t *filename, int flags){	gstat_t		sbuf;	char_t		*buf, *keyword, *value, *path, *ptr;	char_t		*tablename;	int			fd, tid, row;	dbTable_t	*pTable;    a_assert(did >= 0);	fmtAlloc(&path, FNAMESIZE, T("%s/%s"), basicGetProductDir(), filename);	trace(4, T("DB: About to read data file <%s>/n"), path);	if (gstat(path, &sbuf) < 0) {		trace(3, T("DB: Failed to stat persistent data file./n"));		bfree(B_L, path);		return -1;	}	fd = gopen(path, O_RDONLY | O_BINARY, 0666);	bfree(B_L, path);	if (fd < 0) {		trace(3, T("DB: No persistent data file present./n"));		return -1;	}	if (sbuf.st_size <= 0) {		trace(3, T("DB: Persistent data file is empty./n"));		gclose(fd);		return -1;	}/* *	Read entire file into temporary buffer */	buf = balloc(B_L, sbuf.st_size + 1);#ifdef CE	if (readAscToUni(fd, &buf, sbuf.st_size) != (int)sbuf.st_size) {#else	if (gread(fd, buf, sbuf.st_size) != (int)sbuf.st_size) {#endif		trace(3, T("DB: Persistent data read failed./n"));		bfree(B_L, buf);		gclose(fd);		return -1;	}	gclose(fd);	*(buf + sbuf.st_size) = '/0';	row = -1;	tid = -1;	pTable = NULL;	ptr = gstrtok(buf, T("/n"));	tablename = NULL;	do {		if (crack(ptr, &keyword, &value) < 0) {			trace(5, T("DB: Failed to crack line %s/n"), ptr);			continue;		}		a_assert(keyword && *keyword);		if (gstrcmp(keyword, KEYWORD_TABLE) == 0) {/* *			Table name found, check to see if it's registered */			if (tablename) {				bfree(B_L, tablename);			}			tablename = bstrdup(B_L, value);			tid = dbGetTableId(did, tablename);			if (tid >= 0) {				pTable = dbListTables[tid];			} else {				pTable = NULL;			}		} else if (gstrcmp(keyword, KEYWORD_ROW) == 0) {/* *			Row/Record indicator found, add a new row to table */			if (tid >= 0) {				int nRows = dbGetTableNrow(did, tablename);				if (dbSetTableNrow(did, tablename, nRows + 1) == 0) {					row = nRows;				}			}		} else if (row != -1) {/* *			some other data found, assume it's a COLUMN=value */			int nColumn = GetColumnIndex(tid, keyword);			if ((nColumn >= 0) && (pTable != NULL)) {//.........这里部分代码省略.........
开发者ID:houzhenggang,项目名称:MT,代码行数:101,


示例23: decode_bds_d2

/* decode BeiDou D2 ephemeris --------------------------------------------------* decode BeiDou D2 ephemeris (GEO satellites) (ref [3] 5.3)* args   : unsigned char *buff I beidou D2 subframe 1 page bits*                                  buff[  0- 37]: page 1 (300 bits)*                                  buff[ 38- 75]: page 2*                                  ...*                                  buff[342-379]: page 10*          eph_t    *eph    IO  ephemeris structure* return : status (1:ok,0:error)*-----------------------------------------------------------------------------*/extern int decode_bds_d2(const unsigned char *buff, eph_t *eph){    double toc_bds,sqrtA;    unsigned int f1p4,cucp5,ep6,cicp7,i0p8,OMGdp9,omgp10;    unsigned int sow1,sow3,sow4,sow5,sow6,sow7,sow8,sow9,sow10;    int i,f1p3,cucp4,ep5,cicp6,i0p7,OMGdp8,omgp9;    int pgn1,pgn3,pgn4,pgn5,pgn6,pgn7,pgn8,pgn9,pgn10;        trace(3,"decode_bds_d2:/n");        i=8*38*0; /* page 1 */    pgn1       =getbitu (buff,i+ 42, 4);    sow1       =getbitu2(buff,i+ 18, 8,i+ 30,12);    eph->svh   =getbitu (buff,i+ 46, 1); /* SatH1 */    eph->iodc  =getbitu (buff,i+ 47, 5); /* AODC */    eph->sva   =getbitu (buff,i+ 60, 4);    eph->week  =getbitu (buff,i+ 64,13); /* week in BDT */    toc_bds    =getbitu2(buff,i+ 77, 5,i+ 90,12)*8.0;    eph->tgd[0]=getbits (buff,i+102,10)*0.1*1E-9;    eph->tgd[1]=getbits (buff,i+120,10)*0.1*1E-9;        i=8*38*2; /* page 3 */    pgn3       =getbitu (buff,i+ 42, 4);    sow3       =getbitu2(buff,i+ 18, 8,i+ 30,12);    eph->f0    =getbits2(buff,i+100,12,i+120,12)*P2_33;    f1p3       =getbits (buff,i+132,4);        i=8*38*3; /* page 4 */    pgn4       =getbitu (buff,i+ 42, 4);    sow4       =getbitu2(buff,i+ 18, 8,i+ 30,12);    f1p4       =getbitu2(buff,i+ 46, 6,i+ 60,12);    eph->f2    =getbits2(buff,i+ 72,10,i+ 90, 1)*P2_66;    eph->iode  =getbitu (buff,i+ 91, 5); /* AODE */    eph->deln  =getbits (buff,i+ 96,16)*P2_43*SC2RAD;    cucp4      =getbits (buff,i+120,14);        i=8*38*4; /* page 5 */    pgn5       =getbitu (buff,i+ 42, 4);    sow5       =getbitu2(buff,i+ 18, 8,i+ 30,12);    cucp5      =getbitu (buff,i+ 46, 4);    eph->M0    =getbits3(buff,i+ 50, 2,i+ 60,22,i+ 90, 8)*P2_31*SC2RAD;    eph->cus   =getbits2(buff,i+ 98,14,i+120, 4)*P2_31;    ep5        =getbits (buff,i+124,10);        i=8*38*5; /* page 6 */    pgn6       =getbitu (buff,i+ 42, 4);    sow6       =getbitu2(buff,i+ 18, 8,i+ 30,12);    ep6        =getbitu2(buff,i+ 46, 6,i+ 60,16);    sqrtA      =getbitu3(buff,i+ 76, 6,i+ 90,22,i+120,4)*P2_19;    cicp6      =getbits (buff,i+124,10);    eph->A     =sqrtA*sqrtA;        i=8*38*6; /* page 7 */    pgn7       =getbitu (buff,i+ 42, 4);    sow7       =getbitu2(buff,i+ 18, 8,i+ 30,12);    cicp7      =getbitu2(buff,i+ 46, 6,i+ 60, 2);    eph->cis   =getbits (buff,i+ 62,18)*P2_31;    eph->toes  =getbitu2(buff,i+ 80, 2,i+ 90,15)*8.0;    i0p7       =getbits2(buff,i+105, 7,i+120,14);        i=8*38*7; /* page 8 */    pgn8       =getbitu (buff,i+ 42, 4);    sow8       =getbitu2(buff,i+ 18, 8,i+ 30,12);    i0p8       =getbitu2(buff,i+ 46, 6,i+ 60, 5);    eph->crc   =getbits2(buff,i+ 65,17,i+ 90, 1)*P2_6;    eph->crs   =getbits (buff,i+ 91,18)*P2_6;    OMGdp8     =getbits2(buff,i+109, 3,i+120,16);        i=8*38*8; /* page 9 */    pgn9       =getbitu (buff,i+ 42, 4);    sow9       =getbitu2(buff,i+ 18, 8,i+ 30,12);    OMGdp9     =getbitu (buff,i+ 46, 5);    eph->OMG0  =getbits3(buff,i+ 51, 1,i+ 60,22,i+ 90, 9)*P2_31*SC2RAD;    omgp9      =getbits2(buff,i+ 99,13,i+120,14);        i=8*38*9; /* page 10 */    pgn10      =getbitu (buff,i+ 42, 4);    sow10      =getbitu2(buff,i+ 18, 8,i+ 30,12);    omgp10     =getbitu (buff,i+ 46, 5);    eph->idot  =getbits2(buff,i+ 51, 1,i+ 60,13)*P2_43*SC2RAD;        /* check consistency of page numbers, sows and toe/toc */    if (pgn1!=1||pgn3!=3||pgn4!=4||pgn5!=5||pgn6!=6||pgn7!=7||pgn8!=8||pgn9!=9||        pgn10!=10) {        trace(3,"decode_bds_d2 error: pgn=%d %d %d %d %d %d %d %d %d/n",              pgn1,pgn3,pgn4,pgn5,pgn6,pgn7,pgn8,pgn9,pgn10);        return 0;    }    if (sow3!=sow1+6||sow4!=sow3+3||sow5!=sow4+3||sow6!=sow5+3||        sow7!=sow6+3||sow8!=sow7+3||sow9!=sow8+3||sow10!=sow9+3) {//.........这里部分代码省略.........
开发者ID:Allidylls,项目名称:RTKLIB,代码行数:101,


示例24: decode_glostr

/* decode glonass ephemeris strings --------------------------------------------* decode glonass ephemeris string (ref [2])* args   : unsigned char *buff I glonass navigation data string bits in frames*                                (without hamming and time mark)*                                  buff[ 0- 9]: string #1 (77 bits)*                                  buff[10-19]: string #2*                                  buff[20-29]: string #3*                                  buff[30-39]: string #4*          geph_t *geph  IO     glonass ephemeris message* return : status (1:ok,0:error)* notes  : geph->tof should be set to frame time witin 1/2 day before calling*          geph->frq is set to 0*-----------------------------------------------------------------------------*/extern int decode_glostr(const unsigned char *buff, geph_t *geph){    double tow,tod,tof,toe;    int P,P1,P2,P3,P4,tk_h,tk_m,tk_s,tb,ln,NT,slot,M,week;    int i=1,frn1,frn2,frn3,frn4;        trace(3,"decode_glostr:/n");        /* frame 1 */    frn1        =getbitu(buff,i, 4);           i+= 4+2;    P1          =getbitu(buff,i, 2);           i+= 2;    tk_h        =getbitu(buff,i, 5);           i+= 5;    tk_m        =getbitu(buff,i, 6);           i+= 6;    tk_s        =getbitu(buff,i, 1)*30;        i+= 1;    geph->vel[0]=getbitg(buff,i,24)*P2_20*1E3; i+=24;    geph->acc[0]=getbitg(buff,i, 5)*P2_30*1E3; i+= 5;    geph->pos[0]=getbitg(buff,i,27)*P2_11*1E3; i+=27+4;        /* frame 2 */    frn2        =getbitu(buff,i, 4);           i+= 4;    geph->svh   =getbitu(buff,i, 3);           i+= 3;    P2          =getbitu(buff,i, 1);           i+= 1;    tb          =getbitu(buff,i, 7);           i+= 7+5;    geph->vel[1]=getbitg(buff,i,24)*P2_20*1E3; i+=24;    geph->acc[1]=getbitg(buff,i, 5)*P2_30*1E3; i+= 5;    geph->pos[1]=getbitg(buff,i,27)*P2_11*1E3; i+=27+4;        /* frame 3 */    frn3        =getbitu(buff,i, 4);           i+= 4;    P3          =getbitu(buff,i, 1);           i+= 1;    geph->gamn  =getbitg(buff,i,11)*P2_40;     i+=11+1;    P           =getbitu(buff,i, 2);           i+= 2;    ln          =getbitu(buff,i, 1);           i+= 1;    geph->vel[2]=getbitg(buff,i,24)*P2_20*1E3; i+=24;    geph->acc[2]=getbitg(buff,i, 5)*P2_30*1E3; i+= 5;    geph->pos[2]=getbitg(buff,i,27)*P2_11*1E3; i+=27+4;        /* frame 4 */    frn4        =getbitu(buff,i, 4);           i+= 4;    geph->taun  =getbitg(buff,i,22)*P2_30;     i+=22;    geph->dtaun =getbitg(buff,i, 5)*P2_30;     i+= 5;    geph->age   =getbitu(buff,i, 5);           i+= 5+14;    P4          =getbitu(buff,i, 1);           i+= 1;    geph->sva   =getbitu(buff,i, 4);           i+= 4+3;    NT          =getbitu(buff,i,11);           i+=11;    slot        =getbitu(buff,i, 5);           i+= 5;    M           =getbitu(buff,i, 2);        if (frn1!=1||frn2!=2||frn3!=3||frn4!=4) {        trace(3,"decode_glostr error: frn=%d %d %d %d %d/n",frn1,frn2,frn3,frn4);        return 0;    }    if (!(geph->sat=satno(SYS_GLO,slot))) {        trace(2,"decode_glostr error: slot=%d/n",slot);        return 0;    }    geph->frq=0;    geph->iode=tb;    tow=time2gpst(gpst2utc(geph->tof),&week);    tod=fmod(tow,86400.0); tow-=tod;    tof=tk_h*3600.0+tk_m*60.0+tk_s-10800.0; /* lt->utc */    if      (tof<tod-43200.0) tof+=86400.0;    else if (tof>tod+43200.0) tof-=86400.0;    geph->tof=utc2gpst(gpst2time(week,tow+tof));    toe=tb*900.0-10800.0; /* lt->utc */    if      (toe<tod-43200.0) toe+=86400.0;    else if (toe>tod+43200.0) toe-=86400.0;    geph->toe=utc2gpst(gpst2time(week,tow+toe)); /* utc->gpst */    return 1;}
开发者ID:Allidylls,项目名称:RTKLIB,代码行数:83,


示例25: init_raw

/* initialize receiver raw data control ----------------------------------------* initialize receiver raw data control struct and reallocate obsevation and* epheris buffer* args   : raw_t  *raw   IO     receiver raw data control struct* return : status (1:ok,0:memory allocation error)*-----------------------------------------------------------------------------*/extern int init_raw(raw_t *raw){    const double lam_glo[NFREQ]={CLIGHT/FREQ1_GLO,CLIGHT/FREQ2_GLO};    gtime_t time0={0};    obsd_t data0={{0}};    eph_t  eph0 ={0,-1,-1};    alm_t  alm0 ={0,-1};    geph_t geph0={0,-1};    seph_t seph0={0};    sbsmsg_t sbsmsg0={0};    lexmsg_t lexmsg0={0};    int i,j,sys;        trace(3,"init_raw:/n");        raw->time=raw->tobs=time0;    raw->ephsat=0;    raw->sbsmsg=sbsmsg0;    raw->msgtype[0]='/0';    for (i=0;i<MAXSAT;i++) {        for (j=0;j<380  ;j++) raw->subfrm[i][j]=0;        for (j=0;j<NFREQ;j++) raw->lockt[i][j]=0.0;        for (j=0;j<NFREQ;j++) raw->halfc[i][j]=0;        raw->icpp[i]=raw->off[i]=raw->prCA[i]=raw->dpCA[i]=0.0;    }    for (i=0;i<MAXOBS;i++) raw->freqn[i]=0;    raw->lexmsg=lexmsg0;    raw->icpc=0.0;    raw->nbyte=raw->len=0;    raw->iod=raw->flag=raw->tbase=raw->outtype=0;    raw->tod=-1;    for (i=0;i<MAXRAWLEN;i++) raw->buff[i]=0;    raw->opt[0]='/0';    raw->receive_time=0.0;    raw->plen=raw->pbyte=raw->page=raw->reply=0;    raw->week=0;        raw->obs.data =NULL;    raw->obuf.data=NULL;    raw->nav.eph  =NULL;    raw->nav.alm  =NULL;    raw->nav.geph =NULL;    raw->nav.seph =NULL;        if (!(raw->obs.data =(obsd_t *)malloc(sizeof(obsd_t)*MAXOBS))||        !(raw->obuf.data=(obsd_t *)malloc(sizeof(obsd_t)*MAXOBS))||        !(raw->nav.eph  =(eph_t  *)malloc(sizeof(eph_t )*MAXSAT))||        !(raw->nav.alm  =(alm_t  *)malloc(sizeof(alm_t )*MAXSAT))||        !(raw->nav.geph =(geph_t *)malloc(sizeof(geph_t)*NSATGLO))||        !(raw->nav.seph =(seph_t *)malloc(sizeof(seph_t)*NSATSBS*2))) {        free_raw(raw);        return 0;    }    raw->obs.n =0;    raw->obuf.n=0;    raw->nav.n =MAXSAT;    raw->nav.na=MAXSAT;    raw->nav.ng=NSATGLO;    raw->nav.ns=NSATSBS*2;    for (i=0;i<MAXOBS   ;i++) raw->obs.data [i]=data0;    for (i=0;i<MAXOBS   ;i++) raw->obuf.data[i]=data0;    for (i=0;i<MAXSAT   ;i++) raw->nav.eph  [i]=eph0;    for (i=0;i<MAXSAT   ;i++) raw->nav.alm  [i]=alm0;    for (i=0;i<NSATGLO  ;i++) raw->nav.geph [i]=geph0;    for (i=0;i<NSATSBS*2;i++) raw->nav.seph [i]=seph0;    for (i=0;i<MAXSAT;i++) for (j=0;j<NFREQ;j++) {        if (!(sys=satsys(i+1,NULL))) continue;        raw->nav.lam[i][j]=sys==SYS_GLO?lam_glo[j]:lam_carr[j];    }    raw->sta.name[0]=raw->sta.marker[0]='/0';    raw->sta.antdes[0]=raw->sta.antsno[0]='/0';    raw->sta.rectype[0]=raw->sta.recver[0]=raw->sta.recsno[0]='/0';    raw->sta.antsetup=raw->sta.itrf=raw->sta.deltype=0;    for (i=0;i<3;i++) {        raw->sta.pos[i]=raw->sta.del[i]=0.0;    }    raw->sta.hgt=0.0;    return 1;}
开发者ID:Allidylls,项目名称:RTKLIB,代码行数:85,


示例26: hydro_godunov

//.........这里部分代码省略.........    if (!H.nstep && idim == 1) {      /* LM -- HERE a more secure implementation should be used: a new parameter ? */    }    // if (H.mype == 1) fprintf(fic, "Hydro computes slices./n");    for (j = Hmin; j < Hmax; j += Hstep) {      // we try to compute many slices each pass      int jend = j + Hstep;      if (jend >= Hmax)        jend = Hmax;      int slices = jend - j;    // numbre of slices to compute      // fprintf(stderr, "Godunov idim=%d, j=%d %d /n", idim, j, slices);      if (clear) Dmemset((H.nxyt) * H.nxystep * H.nvar, (real_t *) dq, 0);      start = cclock();      gatherConservativeVars(idim, j, H.imin, H.imax, H.jmin, H.jmax, H.nvar, H.nxt, H.nyt, H.nxyt, slices, Hstep, uold,                             u);      end = cclock();      functim[TIM_GATCON] += ccelaps(start, end);      if (H.prt) {fprintf(fic, "ConservativeVars %d %d %d %d %d %d/n", H.nvar, H.nxt, H.nyt, H.nxyt, slices, Hstep);}      PRINTARRAYV2(fic, u, Hdimsize, "u", H);      if (clear) Dmemset((H.nxyt) * H.nxystep * H.nvar, (real_t *) dq, 0);      // Convert to primitive variables      start = cclock();      constoprim(Hdimsize, H.nxyt, H.nvar, H.smallr, slices, Hstep, u, q, e);      end = cclock();      functim[TIM_CONPRI] += ccelaps(start, end);      PRINTARRAY(fic, e, Hdimsize, "e", H);      PRINTARRAYV2(fic, q, Hdimsize, "q", H);      start = cclock();      equation_of_state(0, Hdimsize, H.nxyt, H.nvar, H.smallc, H.gamma, slices, Hstep, e, q, c);      end = cclock();      functim[TIM_EOS] += ccelaps(start, end);      PRINTARRAY(fic, c, Hdimsize, "c", H);      PRINTARRAYV2(fic, q, Hdimsize, "q", H);      // Characteristic tracing      if (H.iorder != 1) {	start = cclock();        slope(Hdimsize, H.nvar, H.nxyt, H.slope_type, slices, Hstep, q, dq);	end = cclock();	functim[TIM_SLOPE] += ccelaps(start, end);        PRINTARRAYV2(fic, dq, Hdimsize, "dq", H);      }      if (clear) Dmemset(H.nxyt * H.nxystep * H.nvar, (real_t *) qxm, 0);      if (clear) Dmemset(H.nxyt * H.nxystep * H.nvar, (real_t *) qxp, 0);      if (clear) Dmemset(H.nxyt * H.nxystep * H.nvar, (real_t *) qleft, 0);      if (clear) Dmemset(H.nxyt * H.nxystep * H.nvar, (real_t *) qright, 0);      if (clear) Dmemset(H.nxyt * H.nxystep * H.nvar, (real_t *) flux, 0);      if (clear) Dmemset(H.nxyt * H.nxystep * H.nvar, (real_t *) qgdnv, 0);      start = cclock();      trace(dtdx, Hdimsize, H.scheme, H.nvar, H.nxyt, slices, Hstep, q, dq, c, qxm, qxp);      end = cclock();      functim[TIM_TRACE] += ccelaps(start, end);      PRINTARRAYV2(fic, qxm, Hdimsize, "qxm", H);      PRINTARRAYV2(fic, qxp, Hdimsize, "qxp", H);      start = cclock();      qleftright(idim, H.nx, H.ny, H.nxyt, H.nvar, slices, Hstep, qxm, qxp, qleft, qright);      end = cclock();      functim[TIM_QLEFTR] += ccelaps(start, end);      PRINTARRAYV2(fic, qleft, Hdimsize, "qleft", H);      PRINTARRAYV2(fic, qright, Hdimsize, "qright", H);      start = cclock();      riemann(Hndim_1, H.smallr, H.smallc, H.gamma, H.niter_riemann, H.nvar, H.nxyt, slices, Hstep, qleft, qright, qgdnv, sgnm, Hw);      end = cclock();      functim[TIM_RIEMAN] += ccelaps(start, end);      PRINTARRAYV2(fic, qgdnv, Hdimsize, "qgdnv", H);      start = cclock();      cmpflx(Hdimsize, H.nxyt, H.nvar, H.gamma, slices, Hstep, qgdnv, flux);      end = cclock();      functim[TIM_CMPFLX] += ccelaps(start, end);      PRINTARRAYV2(fic, flux, Hdimsize, "flux", H);      PRINTARRAYV2(fic, u, Hdimsize, "u", H);      start = cclock();      updateConservativeVars(idim, j, dtdx, H.imin, H.imax, H.jmin, H.jmax, H.nvar, H.nxt, H.nyt, H.nxyt, slices, Hstep,                             uold, u, flux);      end = cclock();      functim[TIM_UPDCON] += ccelaps(start, end);      PRINTUOLD(fic, H, Hv);    }                           // for j    if (H.prt) {      // printf("[%d] After pass %d/n", H.mype, idim);      PRINTUOLD(fic, H, Hv);    }  }  if ((H.t + dt >= H.tend) || (H.nstep + 1 >= H.nstepmax)) {    /* LM -- HERE a more secure implementation should be used: a new parameter ? */  }}                               // hydro_godunov
开发者ID:kghoracle,项目名称:Hydro,代码行数:101,


示例27: Utilization

	/**	 * Returns the thread utilization.	 *	 * @return A value in between zero and one, where zero means the thread was completely idle, and one means the thread was completely busy.	 */	static double Utilization() { StackTrace trace(__METHOD__, __FILE__, __LINE__);		double duration = (DateTime::Utc() - Started).TotalMilliseconds();		return (duration - Idle.TotalMilliseconds()) / duration;	}
开发者ID:bakerface,项目名称:nitrus,代码行数:9,



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


C++ traceEvent函数代码示例
C++ tr_torrentInfo函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。