コード例 #1
0
BOOL CPFAOptimize::JudgeMaxCircle( ComMap& JunKeyMap, int iMostCircle[], vector< CString >& JunPointGather, CString& strMaxCircle )
{
	// 
	ASSERT( NULL != &JunKeyMap );
	ASSERT( NULL != iMostCircle );
	ComMap TempKeyMap;                                  // 辅助元素
	ComMap::iterator ComIt;
    CString strCircle = "";                               // 环的节点信息,节点编号已经排列好了
	CString strTemp = "";
	int i = 0;
	// 把环JunKeyMap中的第二个到最后一个元素节点信息拷贝到TempKeyMap
	// 因为JunKeyMap中的环节点信息重复了开始点, 例如(5,4,6,1,5)
    for( ComIt = JunKeyMap.begin(), ComIt++; ComIt != JunKeyMap.end(); ComIt++ )
    {
		TempKeyMap.push_back( *ComIt );
    }

	sort( TempKeyMap.begin(), TempKeyMap.end() );     // 泛型算法,从小到大把TempKeyMap排序

    // 把排列好的环节点信息放入strCircle中, 例如(1,4,5,6)
	for( ComIt = TempKeyMap.begin(); ComIt != TempKeyMap.end(); ComIt++ )
	{
		strCircle = strCircle + COMPARTMENTATION + _itoa( *ComIt, strTemp.GetBuffer( 4 ), 10 );
	}
		
	// 如果最大环没找到,则要判断现在的环是不是最大环
	if( strMaxCircle.IsEmpty() )
	{
		BOOL bFindMaxCircle = TRUE;

		// 此环是最大环,记下节点信息,直接返回
		if( ( 0 < strCircle.Find( itoStr( iMostCircle[0] ).GetBuffer( 4 ) ) ) && ( 0 < strCircle.Find( itoStr( iMostCircle[1] ).GetBuffer( 4 ) ) )
			&& ( 0 < strCircle.Find( itoStr( iMostCircle[2] ).GetBuffer( 4 ) ) ) && ( 0 < strCircle.Find( itoStr( iMostCircle[3] ).GetBuffer( 4 ) ) ) )
		{
			strMaxCircle = strCircle;
			return TRUE;
		}

	}

	// 如果此环为最大环,那么没必要进行下面的操作了,直接返回
	if( strCircle == strMaxCircle )
	{
		return TRUE;
	}

	for( vector< CString >::const_iterator GatherIt = JunPointGather.begin(); GatherIt != JunPointGather.end(); GatherIt++ )
	{
		if( *GatherIt == strCircle)
		{
			return TRUE;
		}
	}
	
	// 如果此环节点信息没在JunPointGather中, 即这个环没暂时没有重复环
    JunPointGather.push_back( strCircle );
	
	return FALSE;
}
コード例 #2
0
ファイル: PCFPipeFace.cpp プロジェクト: uesoft/AutoPFA
ErrorStatus::FileError PCFPipeFace::Read(PCFPipe *pData, PipePerisist *pModel)
{
	pModel->Key(pData->GetKey());
	pModel->Name(_T("¹ÜµÀ"));
	AcGePoint3d &pts = pData->Start2dPt();
	pModel->StartPtX(GetX(pts));
	pModel->StartPtY(GetY(pts));
	AcGePoint3d &pte = pData->End2dPt();
	pModel->EndPtX(GetX(pte));
	pModel->EndPtY(GetY(pte));
 	pModel->InJunID(itoStr(pData->InJun()));
 	pModel->OutJunID(itoStr(pData->OutJun()));
	pModel->Size(ftoStr(pData->Bore()));

	if( fabs( pData->InDia() - 0.000001 ) < 0.000001 )
	{
		pModel->InDia(pModel->Size());
		pModel->InDiaUnit(_T("mm"));
	}
	else
	{
 	    pModel->InDia(ftoStr(pData->InDia()));
 	    pModel->InDiaUnit(_T("mm"));
	}

 	pModel->Len(ftoStr(pData->GetLen()/1000));
 	pModel->LenUnit(_T("meters"));
 	pModel->WaveSpeed(_T("2600"));
 	pModel->WaveSpeedUnit(_T("meters/sec"));
// 	pModel->B(pData->B());
// 	pModel->Material(pData->Material());
 	
// 	pModel->PipeType(pData->PipeType());
 	pModel->Thick(ftoStr(pData->Thick()));
 	pModel->ThickUnit(_T("mm"));
 	pModel->Elasticity(ftoStr(pData->Elasticity()));
 	pModel->ElasticityUnit(_T("Pascals"));
 	pModel->PossionRatio(ftoStr(pData->PossionRatio()));
// 	pModel->CalcWave(pData->CalcWave());
// 	pModel->SupportType(pData->SupportType());
// 	pModel->C1(pData->C1());
 	pModel->FrictionModel(_T("0"));
 	pModel->Friction(ftoStr(pData->AbsRoughness()));
 	pModel->FrictionUnit(_T("meters"));
// 	pModel->InDiaReduce(pData->InDiaReduce());
// 	pModel->LocalK(pData->LocalK());
	pModel->PipeFactor(_T("1"));
 	pModel->FitFactor(_T("1"));
// 	pModel->InitFlow(pData->InitFlow());
// 	pModel->SectionNum(pData->SectionNum());
// 	pModel->ParaNum(pData->ParaNum());
// 	pModel->PartFull(pData->PartFull());
	return ErrorStatus::eFileOK;
}
コード例 #3
0
ファイル: board.cpp プロジェクト: ngbmameman/snakegame
void Board::redraw() {
    _mainWindow.clear();
    _mainWindow.draw(_snaek);
    _mainWindow.draw(_target);

    //drawText(itoStr(checkDistance(_snaek.getPosition().x, _snaek.getPosition().y)));
    drawText(itoStr(score));
    _mainWindow.display();
    check();
}
コード例 #4
0
ファイル: crrc_gui_main.cpp プロジェクト: mayrit/crrcsim
// description: see header file
void CGUIMain::doHUDCompass(const float field_of_view)
{  
  if (Global::HUDCompass && !isVisible())
  {
    // compass visible..
    puFont stdFont, bigFont;
    if (Video::textureFont)
    {
      stdFont = puFont ( Video::textureFont, Video::window_xsize > 800 ? 20 : 14 );
      bigFont = puFont ( Video::textureFont, Video::window_xsize > 800 ? 24 : 18 );
    }
    else{    
      stdFont = Video::window_xsize > 800 ? PUFONT_HELVETICA_18 : PUFONT_9_BY_15; 
      bigFont = Video::window_xsize > 800 ? PUFONT_TIMES_ROMAN_24 : PUFONT_HELVETICA_18;
    }
    CRRCMath::Vector3 look_dir = Video::looking_pos - player_pos;
    float azimuth = atan2(look_dir.r[0], -look_dir.r[2])*180.0/M_PI;
    float elevation = atan2(look_dir.r[1], sqrt(pow(look_dir.r[0],2) + pow(look_dir.r[2],2)))*180.0/M_PI;
    azimuth = azimuth < 0.0 ? azimuth + 360.0 : azimuth;
    // for some reason the actual field of view is quite smaller than specified by field_of_view
    // and if not corrected this would result in inaccurate compass labels
    float fov_x = 0.66 * field_of_view * Video::window_xsize/Video::window_ysize;
    float fov_y = 0.66 * field_of_view;
    float kx = 1.0/atan(0.5*fov_x/180.0*M_PI);
    float ky = 1.0/atan(0.5*fov_y/180.0*M_PI);
    float step = (int)(fov_x/nCompass);
    if ( step < 1 )
      step = 1;
    else if ( step < 5 )
      step = 5;
    else if ( step < 15 )
      step = 15;
    else if ( step < 30 )
      step = 30;
    else if ( step < 45 )
      step = 45;
    else
      step = 90;
    
    int az0 = (int)(azimuth/step) * step;
    int el0 = (int)(elevation/step) * step;

    for( int i = 0; i <= nCompass; i++ )
    {
      int az = az0 + (i - nCompass/2)*step;
      int xx = Video::window_xsize/2*(1.0 + kx*atan((az - azimuth)/180.0*M_PI));
      az = az < 0 ? az + 360 : az;
      az = az >= 360 ? az - 360 : az;
      if (xx > 0 && xx < Video::window_xsize)
      {
        compass_x[i]->setLabelFont(bigFont); 
        compass_x[i]->setColour(PUCOL_LABEL, 1., 0.1, 0.1, 1.);
        switch (az)
        {
          case 0:
            compass_msg_x[i] = "N";
            break;
          case 45:
            compass_msg_x[i] = "NE";
            break;
          case 90:
            compass_msg_x[i] = "E";
            break;
          case 135:
            compass_msg_x[i] = "SE";
            break;
          case 180:
            compass_msg_x[i] = "S";
            break;
          case 225:
            compass_msg_x[i] = "SW";
            break;
          case 270:
            compass_msg_x[i] = "W";
            break;
          case 315:
            compass_msg_x[i] = "NW";
            break;
          default:
            compass_msg_x[i] = itoStr(az, '0', 3, true);
            compass_x[i]->setLabelFont(stdFont); 
            compass_x[i]->setColour(PUCOL_LABEL, 1., 0.1, 0.1, 0.7);
        }
        compass_x[i]->setPosition(xx, Video::window_ysize); 
        compass_x[i]->setLabel(compass_msg_x[i].c_str()); 
        compass_x[i]->reveal();
      }
      else
        compass_x[i]->hide();
    }

    for( int i = 0; i <= nCompass; i++ )
    {
      int el = el0 + (i - nCompass/2)*step;
      int yy = Video::window_ysize/2*(1.0 + ky*atan((el - elevation)/180.0*M_PI));
      if (yy > 0 && yy < Video::window_ysize)
      {
        if (el == 0)
        {
          compass_msg_y[i] = "0";
          compass_y[i]->setLabelFont(bigFont); 
          compass_y[i]->setColour(PUCOL_LABEL, 1., 0.1, 0.1, 1.);
        }
        else
        {
          compass_msg_y[i] = itoStr(abs(el), '0', 2, true);
          compass_msg_y[i] = (el > 0 ? '+' : '-') + compass_msg_y[i];
          compass_y[i]->setLabelFont(stdFont); 
          compass_y[i]->setColour(PUCOL_LABEL, 1., 0.1, 0.1, 0.7);
        }
        compass_y[i]->setPosition(0, yy); 
        compass_y[i]->setLabel(compass_msg_y[i].c_str()); 
        compass_y[i]->reveal();
      }
      else
        compass_y[i]->hide();
    }
    
    // ..compass visible
  }
  else
  {
    // compass hidden..
    for( int i = 0; i <= nCompass; i++ )
    {
      compass_x[i]->hide();
      compass_y[i]->hide();
    }
    // ..compass hidden
  }
};
コード例 #5
0
ファイル: fase_movimiento.cpp プロジェクト: asce/adoci
void movimiento_t::salida(string numJ) {
    /* Crear el archivo de salida */
    string cad = "accionJ" + numJ + ".sbt";
    string accion;
    ofstream out(cad.c_str());

    //out.open(cad.c_str());
    /* Linea 1: tipo de movimiento */

    switch (tipo_movimiento) {
        case INMOVIL:
            accion = accion + "Inmovil\n";
            break;
        case ANDAR:
            accion = accion + "Andar\n";
            break;
        case CORRER:
            accion = accion + "Correr\n";
            break;
        case SALTAR:
            accion = accion + "Saltar\n";
            break;
    }

    /* Si el movimiento es INMOVIL, terminar aqui­*/
    if (tipo_movimiento == INMOVIL) {
        out << accion;
        out.close();
        return;
    }

    /* Linea 2: Hexagono de destino */
    accion = accion + destino.stringPos() + "\n";

    /* Linea 3: Lado de destino */
    accion = accion + itoStr(lado) + "\n";
    /* Si el movimiento es SALTAR, terminar aqui­ */
    if (tipo_movimiento == SALTAR) {
        out << accion;
        out.close();
        return;
    }

    /* Linea 4: Usar MASC */
    switch (MASC) {
        case true:
            accion = accion + "True\n";
            break;
        case false:
            accion = accion + "False\n";
            break;
    }

    /* Linea 5: numero de pasos */
    accion = accion + itoStr(pasos) + "\n";

    /* Para cada paso */
    for (int i = 0; i < pasos; ++i) {
        /* Tipo de paso */
        switch (tipo[i]) {
            case MOV_ADELANTE:
                accion = accion + "Adelante\n";
                break;
            case MOV_ATRAS:
                accion = accion + "Atras\n";
                break;
            case MOV_IZQUIERDA:
                accion = accion + "Izquierda\n";
                break;
            case MOV_DERECHA:
                accion = accion + "Derecha\n";
                break;
            case MOV_LEVANTARSE:
                accion = accion + "Levantarse\n";
                break;
            case MOV_TIERRA:
                accion = accion + "Cuerpo a Tierra\n";
                break;
        }
        /* Numero de veces o lado */
        accion = accion + itoStr(veces[i]) + "\n";
    }

    /* Cerrar el archivo */
    //cout <<accion;
    //cin.get();
    out << accion;

    out.close();
}
コード例 #6
0
ファイル: fase_ataque_armas.cpp プロジェクト: asce/adoci
void ataque_armas_t::salida(string numJ) {
    /* Crear el archivo de salida */
    char cad2[500];
    string cad = "accionJ" + numJ + ".sbt";
    string accion;
    string hexaux;
    ofstream out(cad.c_str());
    /* Linea 1: Coger garrote */
    switch (coger_garrote) {
        case true:
            sprintf(cad2,"%s : Vamos a coger un garrote para pelear cuerpo a cuerpo\n\n ",ctime(&tiempo));
            flog +=cad2;
            accion = accion + "True\n";
            break;
        case false:
            sprintf(cad2,"%s : No vamos a coger un garrote para pelear cuerpo a cuerpo\n\n ",ctime(&tiempo));
            flog +=cad2;
            accion = accion + "False\n";
            break;
    }

    /* Si se coge un garrote, terminar aqui */

    if (coger_garrote == true) {
        out << accion;
            cout<< accion <<endl;
    //cin.get();
        out.close();
        return;
    }

    hexaux = objetivo.stringPos(); 
    hexaux += "\n\n";
    /* Linea 2: Hexagono objetivo primario */
    sprintf(cad2,"%s : El hexagono objetivo primario es %02i%02i\n",ctime(&tiempo),objetivo.columna,objetivo.fila);
    flog +=cad2;

    flog += hexaux;
    accion = accion + objetivo.stringPos() + "\n";

    /* Linea 3: Numero de armas que se van a disparar */
    sprintf(cad2,"%s : Vamos a disparar %i armas\n\n ",ctime(&tiempo),num_armas);
    flog +=cad2;
    accion = accion + itoStr(num_armas) + "\n";
    

    /* Para cada arma a disparar */
    for (int i = 0; i < num_armas; ++i) {
        /* Localizacion del arma */

        switch (armas_mech[i].localizacion) {
            case 0:
                sprintf(cad2,"%s : El arma numero %i a disparar se encuentra en el brazo izquierdo \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "BI\n";
                break;
            case 1:
            case 8:
                sprintf(cad2,"%s : El arma numero %i a disparar se encuentra en el torso izquierdo \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "TI\n";
                break;
            case 2:
                sprintf(cad2,"%s : El arma numero %i a disparar se encuentra en la pierna izquierda \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "PI\n";
                break;
            case 3:
                sprintf(cad2,"%s : El arma numero %i a disparar se encuentra en la pierna derecha \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "PD\n";
                break;
            case 4:
            case 9:
                sprintf(cad2,"%s : El arma numero %i a disparar se encuentra en el torso derecho \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "TD\n";
                break;
            case 5:
                sprintf(cad2,"%s : El arma numero %i a disparar se encuentra en el brazo derecho \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "BD\n";
                break;
            case 6:
            case 10:
                sprintf(cad2,"%s : El arma numero %i a disparar se encuentra en el torso central \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "TC\n";
                break;
            case 7:
                sprintf(cad2,"%s : El arma numero %i a disparar se encuentra en la cabeza \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "CAB\n";
                break;
        }

        /* Slot del arma dentro de la localizacion */
        sprintf(cad2,"%s : El arma numero %i a disparar esta en el slot %i \n\n ",ctime(&tiempo),i,armas_mech[i].slot);
        flog +=cad2;
        accion = accion + itoStr(armas_mech[i].slot) + "\n";

        /* Doble cadencia */
        switch (armas_mech[i].doble_cadencia) {
            case true:
                sprintf(cad2,"%s : El arma numero %i va a disparar con doble cadencia \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "True\n";
                break;
            case false:
                sprintf(cad2,"%s : El arma numero %i va a disparar sin doble cadencia \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "False\n";
                break;
        }

        /* Localizacion de la municion */

        switch (armas_mech[i].loc_municion) {
            case 0:
                sprintf(cad2,"%s : El arma numero %i a disparar tiene la municion en el brazo izquierdo \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "BI\n";
                break;
            case 1:
            case 8:
                sprintf(cad2,"%s : El arma numero %i a disparar tiene la municion en el torso izquierdo \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "TI\n";
                break;
            case 2:
                sprintf(cad2,"%s : El arma numero %i a disparar tiene la municion en la pierna izquierda \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "PI\n";
                break;
            case 3:
                sprintf(cad2,"%s : El arma numero %i a disparar tiene la municion en la pierna derecha \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "PD\n";
                break;
            case 4:
            case 9:
                sprintf(cad2,"%s : El arma numero %i a disparar tiene la municion en el torso derecho \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "TD\n";
                break;
            case 5:
                sprintf(cad2,"%s : El arma numero %i a disparar tiene la municion en el brazo derecho \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "BD\n";
                break;
            case 6:
            case 10:
                sprintf(cad2,"%s : El arma numero %i a disparar tiene la municion en el torso central \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "TC\n";
                break;
            case 7:
                sprintf(cad2,"%s : El arma numero %i a disparar tiene la municion en la cabeza \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "CAB\n";
                break;
            default:
                sprintf(cad2,"%s : El arma numero %i a disparar no tiene municion\n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "-1\n";
        }

        /* Slot de la municion dentro de la localizacion */
        sprintf(cad2,"%s : La municion del arma %i a disparar esta en el slot %i \n\n ",ctime(&tiempo),i,armas_mech[i].slot_municion);
        flog +=cad2;
        accion = accion + itoStr(armas_mech[i].slot_municion) + "\n";

        /* Hexagono objetivo del arma */
        sprintf(cad2,"%s : El hexagono objetivo del arma %i a disparar es %i%i \n\n ",ctime(&tiempo),i,armas_mech[i].objetivo.columna,armas_mech[i].objetivo.fila);
        flog +=cad2;
        accion = accion + armas_mech[i].objetivo.stringPos() + "\n";

        /* Tipo de objetivo */
        switch (armas_mech[i].tipo_objetivo) {
            case MECH:
                sprintf(cad2,"%s : El tipo de objetivo para el arma %i a disparar es un mech \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "Mech\n";
                break;
            case HEXAGONO:
                sprintf(cad2,"%s : El tipo de objetivo para el arma %i a disparar es un hexagono \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "Hexagono\n";

                break;
            case NINGUNO:
                sprintf(cad2,"%s : El tipo de objetivo para el arma %i a disparar es ninguno \n\n ",ctime(&tiempo),i);
                flog +=cad2;
                accion = accion + "Ninguno\n";
                break;
        }
    }
    /* Cerrar el archivo */
    out << accion;
    cout<< accion <<endl;
    //cin.get();
    out.close();
}
コード例 #7
0
ファイル: pack.c プロジェクト: weihualiu/sdbc
int get_one_str(char *buf,void *data,T_PkgType *typ,char CURDLM)
{
	register char *cp1,*cp2;
	int cnt,J,len;
	char datebuf[31];
	char *sp;
//short iTiny;
	T_PkgType Char_Type[2];

	cp1=buf;
	*cp1=0;
	cnt=0;
	cp2 = (char *)data+typ->offset;
	sp=cp2;
	if(isnull(cp2,typ->type)) return cnt;
	switch(typ->type) {
		case CH_BYTE:
			cnt=b2h(cp1,cp2,typ->len);
			break;
		case CH_CLOB:
			Char_Type[0].type=CH_CHAR;
			Char_Type[0].len=-1;
			Char_Type[0].offset=0;
			Char_Type[1].type=-1;
			Char_Type[1].len=0;
			J=get_one_str(buf,*(char **)cp2,Char_Type,CURDLM);
			cnt += J;
			break;
		case CH_DATE:
		case CH_CNUM:
		case CH_CHAR:
			len=(typ->len>0)?typ->len-1:strlen(cp2);
			for(J=0;J<len&&*cp2;J++,cnt++) {
				if(!CURDLM) goto norm;
				switch(*cp2) {
					case ESC_CHAR:
						if(cp2>sp && GBK_flag && firstcc((unsigned char *)sp,(unsigned char *)cp2-1)) goto norm;
						*cp1++=*cp2;
						*cp1++=*cp2++;
						cnt++;
						break;
					case '\n':
						if(cp2>sp && firstcc((unsigned char *)sp,(unsigned char *)cp2-1)) cp1[-1]&=0x7f;
						*cp1++=ESC_CHAR;
						*cp1++='n';
						cp2++;
						cnt++;
						break;
					default:
						if(*cp2==CURDLM) {
							if(cp2>sp && GBK_flag && firstcc((unsigned char *)sp,(unsigned char *)cp2-1))
								goto norm;
							*cp1++=ESC_CHAR;
							*cp1++='G';
							cp2++;
							cnt++;
							break;
						}
					norm:
						*cp1++=*cp2++;
						break;
				}
			}
			*cp1=0;
			if(cp2>sp) {
				if(firstcc((unsigned char *)sp,(unsigned char *)cp2-1)) cp1[-1] &= 0x7f;
			}
			break;
		case CH_FLOAT:
			if(!typ->format)
				cnt=sprintf(cp1,"%g", (double)*(float *)cp2);
			else
				cnt=sprintf(cp1,typ->format,(double)*(float *)cp2);
			break;
		case CH_DOUBLE:
			if(!typ->format)
				cnt=sprintf(cp1,"%g", *(double *)cp2);
			else
				cnt=sprintf(cp1,typ->format,*(double *)cp2);
			break;
		case CH_LDOUBLE:
			if(!typ->format)
				cnt=sprintf(cp1,"%Lg", *(long double *)cp2);
			else
				cnt=sprintf(cp1,typ->format,*(long double *)cp2);
			break;
		case CH_TINY:
			if(typ->format) cnt=sprintf(cp1,typ->format,255&*cp2);
			else cnt=itoStr((int)(*cp2),cp1)-cp1;
			break;
		case CH_SHORT:
			if(typ->format) cnt=sprintf(cp1,typ->format,0XFFFF&*(short *)cp2);
			else cnt=itoStr((int)(*(short *)cp2),cp1)-cp1;
			break;
		case CH_INT:
			if(typ->format) cnt=sprintf(cp1,typ->format,*(int *)cp2);
			else cnt=itoStr(*(int *)cp2,cp1)-cp1;
			break;
		case CH_LONG:
			if(typ->format) cnt=sprintf(cp1,typ->format,*(long *)cp2);
			else cnt=lltoStr((INT64)(*(long *)cp2),cp1)-cp1;
			break;
		case CH_INT64:
			if(typ->format) cnt=sprintf(cp1,typ->format,*(INT64 *)cp2);
			else cnt=lltoStr(*(INT64 *)cp2,cp1)-cp1;
			break;
		case CH_CJUL:
		case CH_JUL:
			if(typ->format) {
				rjultostrfmt(datebuf,*(int *)cp2,
							 typ->format);
			} else {
				rjultostrfmt(datebuf,*(int *)cp2,
							 "YYYYMMDD");
			}
			cnt=sprintf(cp1,"%s",datebuf);
			break;
		case CH_MINUTS:
		case CH_CMINUTS:
			if(typ->format) {
				rminstrfmt(datebuf,*(INT4 *)cp2,typ->format);
			} else rminstr(datebuf,*(INT4 *)cp2);
			cnt=sprintf(cp1,"%s",datebuf);
			break;
		case CH_TIME:
		case CH_CTIME:
			if(typ->format) {
				rsecstrfmt(datebuf,*(INT64 *)cp2,typ->format);
			} else rsecstrfmt(datebuf,*(INT64 *)cp2,"YYYYMMDDHH24MISS");
			cnt=sprintf(cp1,"%s",datebuf);
			break;
		case CH_USEC:
			if(typ->format) {
				rusecstrfmt(datebuf,*(INT64 *)cp2,typ->format);
			} else rusecstrfmt(datebuf,*(INT64 *)cp2,"YYYYMMDDHH24MISS.FF6");
			cnt=sprintf(cp1,"%s",datebuf);
			break;
		default:
			break;
	}
	return cnt;
}