Esempio n. 1
0
File: K213.c Progetto: gaorlov/DAAS
static void k213_GetErrorStatus (gpibioPtr dev)
{
    int error, s;
    char e_msg[256], *s_msg, rsp[256];

    gpibio_Out (dev, "E?");
    gpibio_In (dev, rsp);

    Scan (rsp, "%s>E%i", &error);
    switch (error) {
        case 1: MessagePopup ("Keithley 213 Message", "ERROR: Unrecognized command"); break;
        case 2: MessagePopup ("Keithley 213 Message", "ERROR: Invalid command parameter"); break;
        case 3: MessagePopup ("Keithley 213 Message", "ERROR: Command conflict"); break;
        case 4: MessagePopup ("Keithley 213 Message", "ERROR: Calibration switch not closed"); break;
        case 5:
            gpibio_Out (dev, "S?");
            gpibio_In (dev, rsp);
            Scan (rsp, "%s>S%i", &s);
            Fmt (e_msg, "ERROR: Non-volatile RAM error, system defaults or calibration may be lost.");
            if (s) s_msg = "User programmed defaults are still valid";
                else s_msg = "Factory defaults are in use, user programmed defaults were lost";
            Fmt (e_msg, "%s[a]<\n%s", s_msg);
            MessagePopup ("Keithley 213 Message", e_msg);
            break;
    }
}
Esempio n. 2
0
static void ProcType(void)
{
    symbol      *type;
    symbol      *curr;
    unsigned    next_value;

    next_value = 0;
    type = NewSym( CLASS_TYPE );
    Scan();
    WantColon();
    do {
        curr = NewSym( CLASS_ENUMS );
        curr->v.enums.type = type;
        Scan();
        if( CurrToken == T_EQUALS ) {
            Scan();
            curr->v.enums.value = GetNum();
            Scan();
        } else {
            curr->v.enums.value = next_value;
        }
        if( curr->v.enums.value >= next_value ) {
            next_value = curr->v.enums.value + 1;
        }
    } while( CurrToken != T_SEMI );
    Scan();
}
Esempio n. 3
0
bool ScanQuote( char **start, unsigned *len )
{
    int   cnt;

    if( CurrToken != T_LEFT_BRACE ) {
        *start = NULL;
        *len   = 0;
        return( FALSE );
    }
    *start = ScanPtr;
    cnt = 1;
    while( cnt > 0 ) {
        Scan();
        if( CurrToken == T_LEFT_BRACE ) {
            cnt += 1;
        } else if( CurrToken == T_RIGHT_BRACE ) {
            cnt -= 1;
        } else if( CurrToken == T_LINE_SEPARATOR ) {
            Recog( T_RIGHT_BRACE ); /* cause error */
        }
    }
    *len = TokenStart - *start;
    Scan();
    return( TRUE );
}
Esempio n. 4
0
int  DataFileSaveAsCallback(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
    char path[300], path1[300], path2[300], name[300];
    int i, filestatus;  char *date, mon[10], day[10], yr[10];
	
    if (event == EVENT_COMMIT) {
        Fmt (name, "%s<%s.%i", dataFile.name, dataFile.ext);
        filestatus = FileSelectPopup (dataFile.dir, name, "",
                                      "Save As [file extension must be a #!]:",
                                      VAL_OK_BUTTON, 0, 0, 1, 1, path);
        switch (filestatus) {
            case VAL_EXISTING_FILE_SELECTED:
                MessagePopup ("Save As Message", "Cannot select duplicate file paths");
                break;
            case VAL_NEW_FILE_SELECTED:
                Fmt (path1, path);
                while (Scan(path1, "%s>%s[xdt92]%s", path2) == 2)
                    Fmt (path1, path2);
                Scan (path2, "%s>%s[t46]", dataFile.name);
                i = Scan (path2, "%s>%s[xdt46]%i[b2]", &dataFile.ext);
                if (i != 2)
                    MessagePopup ("File name error",
                              "File extension must be a number..."
                              "extension ignored");
                Fmt (path1, path);
                i = FindPattern (path1, 0, StringLength (path1), path2, 0, 0);
                CopyString (dataFile.dir, 0, path1, 0, i-1);  
                acquire_UpdateDataFileInfo();
                break;
        }
    }
    return 0;
}
Esempio n. 5
0
OVL_EXTERN brkp *ImageBreak( memory_expr def_seg )
{
    const char  *start;
    size_t      len;
    bool        clear = false;
    int         cmd;

    def_seg=def_seg;
    while( CurrToken == T_DIV ) {
        Scan();
        cmd = ScanCmd( PointNameTab );
        if( cmd < 0 )
            break;
        switch( cmd ) {
        case B_CLEAR:
            clear = true;
            break;
        default:
            Error( ERR_LOC, LIT_ENG( ERR_BAD_OPTION ), GetCmdName( CMD_BREAK ) );
            break;
        }
    }
    if( !ScanItem( true, &start, &len ) ) {
        BadPoint( def_seg );
    }
    BreakOnImageLoad( start, len, clear );
    Scan();
    ReqEOC();
    return( NULL );
}
Esempio n. 6
0
static void ProcTokens( class typ, unsigned *next )
{
    symbol      *sym;
    unsigned    value;

    WantColon();
    do {
        if( CurrToken != T_NAME )
            Error( "expecting name" );
        sym = NewSym( typ );
        Scan();
        switch( typ ) {
        case CLASS_INPUT:
        case CLASS_OUTPUT:
        case CLASS_INOUT:
            if( CurrToken == T_LITERAL ) {
                NewAlias( sym );
                Scan();
            }
        }
        if( CurrToken == T_EQUALS ) {
            Scan();
            value = GetNum();
            Scan();
        } else {
            value = *next;
        }
        sym->v.token = value;
        if( value >= *next ) {
            *next = value + 1;
        }
    } while( CurrToken != T_SEMI );
    Scan();
}
Esempio n. 7
0
OVL_EXTERN brkp *ImageBreak( memory_expr def_seg )
{
    char        *start;
    size_t      len;
    bool        clear = FALSE;

    def_seg=def_seg;
    while( CurrToken == T_DIV ) {
        Scan();
        switch( ScanCmd( PointNameTab ) ) {
        case 0:
            goto done;
        case B_CLEAR:
            clear = TRUE;
            break;
        default:
            Error( ERR_LOC, LIT( ERR_BAD_OPTION ), GetCmdName( CMD_BREAK ) );
            break;
        }
    }
done:;
    if( !ScanItem( TRUE, &start, &len ) ) {
        BadPoint( def_seg );
    }
    BreakOnImageLoad( start, len, clear );
    Scan();
    ReqEOC();
    return( NULL );
}
Esempio n. 8
0
static void k2400_GetMeasurementParameters (gpibioPtr dev)
{
    char msg[256];
    int srctype;
    k2400Ptr smu = dev->device;
	/*Check Source mode*/
    k2400_Out(dev, ":SOURce:FUNCtion:MODE?", .008);
    k2400_In(dev, msg);
	if(msg[0] == 'V')
		smu->src.current = 0;
	else
		smu->src.current = 1;
	
	/*Check for remote/local sense*/
	k2400_Out(dev, ":SYStem:RSENse?", .008);
	k2400_In(dev, msg);
	Scan(msg, "%i", &smu->sense);
	
	/*Check Filter steps*/
	k2400_Out(dev, ":SENSe:AVERage:COUNt?", .008);
	k2400_In(dev, msg);
	Scan(msg, "%i", &smu->meas.filter);
	
	/*Check Integration time*/
	k2400_Out(dev, ":SENSe:CURRent:NPLCycles?", .008);
	k2400_In(dev, msg);
	Scan(msg, "%f", &smu->meas.inttime);
	
	/*Check Delay time*/
	k2400_Out(dev, ":SOURce:DELay:AUTO?", .008);
	k2400_In(dev, msg);
	Scan(msg, "%i", &smu->src.delay);
										  
    //Scan (msg, "%s[i3]>L,%i", &smu->meas.range);
}
Esempio n. 9
0
//------------------------------------------------------------------------
void CWeaponSystem::Scan(const char *folderName)
{
	string folder = folderName;
	string search = folder;
	search += "/*.*";

	ICryPak *pPak = m_pSystem->GetIPak();

	_finddata_t fd;
	intptr_t handle = pPak->FindFirst(search.c_str(), &fd);

	if (!m_recursing)
		CryLog("Loading ammo XML definitions from '%s'!", folderName);

	if (handle > -1)
	{
		do
		{
			if (!strcmp(fd.name, ".") || !strcmp(fd.name, ".."))
				continue;

			if (fd.attrib & _A_SUBDIR)
			{
				string subName = folder+"/"+fd.name;
				if (m_recursing)
					Scan(subName.c_str());
				else
				{
					m_recursing=true;
					Scan(subName.c_str());
					m_recursing=false;
				}
				continue;
			}

			if (stricmp(PathUtil::GetExt(fd.name), "xml"))
				continue;

			string xmlFile = folder + string("/") + string(fd.name);
			XmlNodeRef rootNode = m_pSystem->LoadXmlFile(xmlFile.c_str());

			if (!rootNode)
			{
				GameWarning("Invalid XML file '%s'! Skipping...", xmlFile.c_str());
				continue;
			}

			if (!ScanXML(rootNode, xmlFile.c_str()))
				continue;

		} while (pPak->FindNext(handle, &fd) >= 0);
	}

	if (!m_recursing)
		CryLog("Finished loading ammo XML definitions from '%s'!", folderName);

	if (!m_reloading && !m_recursing)
		m_folders.push_back(folderName);
}
Esempio n. 10
0
void DistMap::Translate
( vector<Int>& localInds, const vector<int>& origOwners ) const
{
    DEBUG_CSE
    const Int numLocalInds = localInds.size();

    // Count how many indices we need each process to map
    // Avoid unncessary branching within the loop by avoiding RowToProcess
    vector<int> requestSizes( commSize_, 0 );
    for( Int s=0; s<numLocalInds; ++s )
    {
        const Int i = localInds[s];
        if( i < numSources_ )
            ++requestSizes[origOwners[s]];
    }

    // Send our requests and find out what we need to fulfill
    vector<int> fulfillSizes( commSize_ );
    mpi::AllToAll( requestSizes.data(), 1, fulfillSizes.data(), 1, comm_ );

    // Prepare for the AllToAll to exchange request sizes
    vector<int> requestOffs, fulfillOffs;
    const int numRequests = Scan( requestSizes, requestOffs );
    const int numFulfills = Scan( fulfillSizes, fulfillOffs );

    // Pack the requested information 
    vector<int> requests( numRequests );
    auto offs = requestOffs;
    for( Int s=0; s<numLocalInds; ++s )
    {
        const Int i = localInds[s];
        if( i < numSources_ )
            requests[offs[origOwners[s]]++] = i;
    }

    // Perform the first index exchange
    vector<int> fulfills( numFulfills );
    mpi::AllToAll
    ( requests.data(), requestSizes.data(), requestOffs.data(),
      fulfills.data(), fulfillSizes.data(), fulfillOffs.data(), comm_ );

    // Map all of the indices in 'fulfills'
    for( int s=0; s<numFulfills; ++s )
    {
        const Int i = fulfills[s];
        const Int iLocal = i - blocksize_*commRank_;
        DEBUG_ONLY(
          if( iLocal < 0 || iLocal >= (Int)map_.size() )
              LogicError
              ("invalid request: i=",i,", iLocal=",iLocal,
               ", commRank=",commRank_,", blocksize=",blocksize_);
        )
        fulfills[s] = map_[iLocal];
    }
Esempio n. 11
0
bool Pop3::GetListItems(ValueMap& list, dword type1, dword type2)
{
	StringStream s(data);
	while(!s.IsEof()) {
		String line = s.GetLine();
		Vector<String> s = Split(line, ' ');
		if(s.GetCount() < 2)
			return false;
		list.Add(Scan(type1, s[0]), Scan(type2, s[1]));
	}
	return true;	
}
Esempio n. 12
0
void ProcLog( void )
{
    if( ScanEOC() ) {
        LogEnd();
    } else if( CurrToken == T_GT ) {
        Scan();
        LogAppend();
    } else if( CurrToken == T_DIV ) {
        Scan();
        (*LogJmpTab[ ScanCmd( LogNameTab ) ])();
    } else {
        LogStart();
    }
}
Esempio n. 13
0
void TopDecls() {
  EmitLn("section .data");
  Scan();
  while(Token != 'b') {
    switch(Token) {
      case 'v': Decl(); break;
      default:
        sprintf(tmp,"Unrecognized Keyword '%s'", Value);
        Abort(tmp);
    }
    Scan();
    NewLine();
  }
}
Esempio n. 14
0
    void Scan() override
    {
        _scenarios.clear();

        // Scan RCT2 directory
        std::string rct2dir = _env->GetDirectoryPath(DIRBASE::RCT2, DIRID::SCENARIO);
        std::string openrct2dir = _env->GetDirectoryPath(DIRBASE::USER, DIRID::SCENARIO);
        Scan(rct2dir);
        Scan(openrct2dir);

        Sort();
        LoadScores();
        LoadLegacyScores();
        AttachHighscores();
    }
// Play the 'sequence' numbered FLASH or EEPROM sequence.
void PlaySequence (unsigned int sequence) {
	BOOL ok;
	
	if (Seq_Find(sequence) != FIND_OK) {
		Error(); Scan(); return;
	}	 	
	do {
		PWM_Ramp (Seq_GetPWM(0), Seq_GetPWM(1), Seq_GetPWM(2), Seq_GetPWM(3), Seq_GetFade(), Seq_GetHold());
		if (Scan()) {
			PWM_Set(0, 0, 0, 0);
			return;         		// handle push buttons
		}	
		ok = Seq_Next(NOREPEAT);
	} while ((Seq_GetActive() == sequence) && ok);
}	
Esempio n. 16
0
void get_graph(int N,int M){
    ne = 2;
    memset(head, 0, sizeof(head));
	int i,j,u,v,w,px,py;
     nn1=(N+1)*(M+1);
    scr1=1;sink1=nn1;vn1=nn1+(N*M);
    //½¨Í¼
    for(i=1;i<=N+1;i++)
    {
        for(j=1;j<=M;j++)
        {
            w=Scan();
            u=(i-1)*(M+1)+j;
            v=u+1;
            Insert(u,v,w);
            //Insert(v,u,w);
        }
    }
    for(i=1;i<=N;i++)
    {
        for(j=1;j<=M+1;j++)
        {
            //scanf("%d",&w);
            w=Scan();
            u=(i-1)*(M+1)+j;
            v=u+M+1;
            Insert(u,v,w);
            //Insert(v,u,w);
        }
    }
    for(i=1;i<=2*N;i++)
    {
        for(j=1;j<=2*M;j++)
        {
            //scanf("%d",&w);
            w=Scan();
            px=(i+1)>>1;
            py=(j+1)>>1;
            v=(px-1)*M+py+nn1;
            u=(px-1)*(M+1)+py;
            if((i%2)&&(j%2==0)) u++;
            else if((i%2==0)&&(j%2)) u+=(M+1);
            else if((i%2==0)&&(j%2==0)) u+=(M+2);
            Insert(u,v,w);
            //Insert(v,u,w);
        }
    }
}
Esempio n. 17
0
int main()
{
	int testCaseNo;

	Print("1 : CreateCondition System Call \n");
	Print("2: Wait Signal BroadCast System Call \n");
	Print("Enter your choice \n");
	testCaseNo = Scan();

	Print("\n\n");

	switch(testCaseNo)
	{
		case 1:
		{
			testCase1();
		}
		break;
		case 2:
		{
			testCase2();
		}
		break;
		default:
		{
			Print("Invalid Test Case No\n");
		}
		break;
	}
	/**
	 * Exit(0);
	 */

}
Esempio n. 18
0
//------------------------------------------------------------------------
void CWeaponSystem::Reload()
{
	m_reloading = true;

	// cleanup current projectiles
	for (TProjectileMap::iterator pit = m_projectiles.begin(); pit != m_projectiles.end();)
	{
		//Bugfix: RemoveEntity removes projectile from map, thus invalidating iterator
		TProjectileMap::iterator next = pit;        
		next++;
		gEnv->pEntitySystem->RemoveEntity(pit->first, true);
		pit = next;
	}
	m_projectiles.clear();

	for (TAmmoTypeParams::iterator it = m_ammoparams.begin(); it != m_ammoparams.end(); ++it)
	{
		SAmmoTypeDesc &desc=it->second;
		delete desc.params;
		if (!desc.configurations.empty())
		{
			for (std::map<string, const SAmmoParams *>::iterator ait=desc.configurations.begin(); ait!=desc.configurations.end(); ait++)
				delete ait->second;
		}
	}

	m_ammoparams.clear();

	m_tracerManager.Reset();

	for (TFolderList::iterator it=m_folders.begin(); it!=m_folders.end(); ++it)
		Scan(it->c_str());

	m_reloading = false;
}
Esempio n. 19
0
void Match(sInt tok)
{
  if(Token!=tok)
    Error("Match Error");
  Out(Value);
  Scan();
}
Esempio n. 20
0
  std::ostream &
  operator<<(std::ostream &ostr, const RangeBunchEventIDL &rhs) 
  {
    
    std::vector<Scan> scan;
    for (unsigned int i = 0; i < rhs.sensor.length(); ++i)
      scan.push_back(Scan(rhs.sensor[i].group, 
			  rhs.sensor[i].index, 
			  rhs.sensor[i].range));
    std::sort(scan.begin(), scan.end(), Less());

    ostr << rhs.time << endl;
    int group = -1;
    int index = 0;
    std::vector<Scan>::const_iterator i, j = scan.end();
    for (i = scan.begin(); i != j; ++i) {
      if (i->group > group) {
	if (group != -1)
	  ostr << endl;
	ostr << i->group << ": ";
	group = i->group;
	index = 0;
      }
      for (; index < i->index; ++index)
	ostr << "      ";
      
      ostr.width(6);
      ostr.fill(' ');
      ostr << i->range;
      index = i->index;
    }
    return ostr;
  }
Esempio n. 21
0
void SourceSet( void )
{
    char_ring **owner;
    char      *start;
    unsigned   len;

    if( CurrToken == T_DIV ) {
        Scan();
        if( ScanCmd( AddTab ) == 0 ) {
            Error( ERR_LOC, LIT( ERR_BAD_SUBCOMMAND ), GetCmdName( CMD_SET ) );
        }
        owner = RingEnd( &SrcSpec );
    } else {
        owner = &SrcSpec;
        FiniSource();
    }
    while( ScanItem( TRUE, &start, &len ) ) {
        while( len > 0 && *start == ' ' ) {
            ++start;
            --len;
        }
        InsertRing( owner, start, len );
    }
    DbgUpdate( UP_NEW_SRC );
}
Esempio n. 22
0
static bool UserType( type_handle *th )
{
    unsigned            i;
    unsigned            len;
    sym_info            info;


    //NYI:begin temp
    if( ExprSP->flags & SF_NAME ) {
        static const char       * const TagIds[] = { "struct", "class", "union", "enum", NULL };

        ExprSP->v.li.type = ST_TYPE;
        for( i = 0; TagIds[i] != NULL; ++i ) {
            len = strlen( TagIds[i] );
            if( len == ExprSP->v.li.name.len
                && memcmp( ExprSP->v.li.name.start, TagIds[i], len ) == 0 ) {
                ExprSP->v.li.type = ST_STRUCT_TAG + i;
                ExprSP->v.li.name.start = NamePos();
                ExprSP->v.li.name.len = NameLen();
                Scan();
            }
        }
    }
    //NYI: end temp
    NameResolve( ExprSP, TRUE );
    if( !(ExprSP->flags & SF_SYM) ) return( FALSE );
    if( ExprSP->th == NULL ) return( FALSE );
    SymInfo( ExprSP->v.sh, ExprSP->lc, &info );
    if( info.kind != SK_TYPE ) return( FALSE );
    HDLAssign( type, th, ExprSP->th );
    return( TRUE );
}
Esempio n. 23
0
File: Sr844.c Progetto: gaorlov/DAAS
void sr844_GetXYRTP(gpibioPtr dev)
{
	double hi, lo;
	int i = 0, sens, senso;
	char str[256];
	sr844Ptr lia;
	sr844_channels chan;
	lia = dev->device;
	sr844_GetCharVal (dev, "SNAP?1,2,3,5", str);
	Scan (str, "%s>%f,%f,%f,%f",
		&lia->channels[X]->reading,
		&lia->channels[Y]->reading,
		&lia->channels[R]->reading,
		&lia->channels[T]->reading);
	sr844_CheckClear(dev);
	lia->channels[P]->reading = sr844_GetDoubleVal (dev, "PHAS?");
	for (chan = X; chan <= P; chan++) lia->channels[chan]->newreading = TRUE;
	if(lia->autosens)
	{
		senso = lia->sens;
        hi = sr844_Conv2Sensitivity (lia->sens);
        lo = sr844_Conv2Sensitivity (lia->sens-1);
		if (lia->channels[R]->reading > hi) lia->sens++;
        else if (lia->channels[R]->reading < lo) lia->sens--;
		if(lia->sens < 0) lia->sens = 0;
		if(lia->sens >14) lia->sens = 14;
		Fmt (str, "SENS%i", lia->sens);
        if(senso != lia->sens)
			gpibio_Out (dev, str);
	}
}
Esempio n. 24
0
/// Lädt eine Karte
bool GameWorld::LoadMap(const std::string& filename)
{
	// Map laden
	libsiedler2::ArchivInfo ai;

	// Karteninformationen laden
	if(libsiedler2::loader::LoadMAP(filename.c_str(), &ai) != 0)
		return false;

	glArchivItem_Map *map = static_cast<glArchivItem_Map*>(ai.get(0));

	std::string lua_file = filename.substr(0, filename.length() - 3);
	lua_file.append("lua");

	if (luaL_dofile(lua, lua_file.c_str()))
	{
		fprintf(stderr, "LUA ERROR: '%s'!\n", lua_tostring(lua, -1));
		lua_pop(lua, 1);
	}

	Scan(map);

	CreateTradeGraphs();

	tr.GenerateOpenGL(this);

	if(GetPlayer(GameClient::inst().GetPlayerID())->hqx != 0xFFFF)
		this->MoveToMapObject(GetPlayer(GameClient::inst().GetPlayerID())->hqx,
			GetPlayer(GameClient::inst().GetPlayerID())->hqy);

	EventStart();

	return true;
}
Esempio n. 25
0
MultiSwitch::MultiSwitch(int Pin0, int Pin1, int Pin2, int Pin3, int Pin4, int Pin5, int Pin6, int Pin7)
{
  _aPinPort[0] = Pin0;
  _aPinPort[1] = Pin1;
  _aPinPort[2] = Pin2;
  _aPinPort[3] = Pin3;
  _aPinPort[4] = Pin4;
  _aPinPort[5] = Pin5;
  _aPinPort[6] = Pin6;
  _aPinPort[7] = Pin7;

  _nPins = 0;

  for (byte i = 0; i < 8; i++)
  {
    if (_aPinPort[i] >= 0)
    {
      pinMode(_aPinPort[i], INPUT_PULLUP);
      _nPins = i + 1;
    }
  }

  _nDebounceCounter = 999;
  _valueScan = 255;
  Scan();
  _value = _valueScan;
  _bChanged = false;
}
Esempio n. 26
0
void TLSLogForwarderRunner::check() {
  // Instead of using the 'help' database API, prefer to interact with the
  // DBHandle directly for additional performance.
  auto handle = DBHandle::getInstance();

  // Get a list of all the buffered log items, with a max of 1024 lines.
  std::vector<std::string> indexes;
  auto status = handle->Scan(kLogs, indexes, kTLSMaxLogLines);

  // For each index, accumulate the log line into the result or status set.
  std::vector<std::string> results, statuses;
  iterate(indexes,
          ([&handle, &results, &statuses](std::string& index) {
            std::string value;
            auto& target = ((index.at(0) == 'r') ? results : statuses);
            if (handle->Get(kLogs, index, value)) {
              // Enforce a max log line size for TLS logging.
              if (value.size() > FLAGS_logger_tls_max) {
                LOG(WARNING) << "Line exceeds TLS logger max: " << value.size();
              } else {
                target.push_back(std::move(value));
              }
            }
          }));

  // If any results/statuses were found in the flushed buffer, send.
  if (results.size() > 0) {
    status = send(results, "result");
    if (!status.ok()) {
      VLOG(1) << "Could not send results to logger URI: " << uri_ << " ("
              << status.getMessage() << ")";
    } else {
      // Clear the results logs once they were sent.
      iterate(indexes,
              ([&results](std::string& index) {
                if (index.at(0) != 'r') {
                  return;
                }
                deleteDatabaseValue(kLogs, index);
              }));
    }
  }

  if (statuses.size() > 0) {
    status = send(statuses, "status");
    if (!status.ok()) {
      VLOG(1) << "Could not send status logs to logger URI: " << uri_ << " ("
              << status.getMessage() << ")";
    } else {
      // Clear the status logs once they were sent.
      iterate(indexes,
              ([&results](std::string& index) {
                if (index.at(0) != 's') {
                  return;
                }
                deleteDatabaseValue(kLogs, index);
              }));
    }
  }
}
Esempio n. 27
0
INT CImplVulfix::ExpressScanSystem()
{
	// Not use IUpdate 
	HRESULT hr = Scan( VULSCAN_EXPRESS_SCAN );
	if(FAILED(hr))
		return 0;
	
	// check date 
	T_Date date;
	GetLatestPackgeDate(date.nYear, date.nMonth, date.nDay);

	// 上次扫描为安全的库版本号 
	CString strLastSafePkgDate;
	ReadVulConfig(_T("VulScan"), _T("LastSafePkgDate"), strLastSafePkgDate);
	T_Date dateSafe;

	SHOWMSG(_T("PkgDate %04d-%02d-%02d \r\nLastScan.PkgDate %s"), date.nYear, date.nMonth, date.nDay, strLastSafePkgDate);
	if(!strLastSafePkgDate.IsEmpty() && ParseDateString(strLastSafePkgDate, dateSafe.nYear, dateSafe.nMonth, dateSafe.nDay) )
	{
		if(date.Compare(dateSafe.nYear, dateSafe.nMonth, dateSafe.nDay)<=0)
			return -1;
	}
	
	FILETIME ft;
	SYSTEMTIME systime={0};
	if( GetLatestInstalledKBDate(ft) && FileTimeToSystemTime(&ft, &systime) )
	{
		SHOWMSG(_T("ExpressScanSystem.DateCompare %d-%d-%d - %d-%d-%d"), date.nYear, date.nMonth, date.nDay, systime.wYear, systime.wMonth, systime.wDay);
		return date.Compare(systime.wYear, systime.wMonth, systime.wDay);
	}
	return 0;
}
Esempio n. 28
0
void CopyFromRoot( const DistGraph& distGraph, Graph& graph )
{
    EL_DEBUG_CSE
    const Grid& grid = distGraph.Grid();
    const int commSize = grid.Size();
    const int commRank = grid.Rank();

    const int numLocalEdges = distGraph.NumLocalEdges();
    vector<int> edgeSizes(commSize);
    mpi::AllGather( &numLocalEdges, 1, edgeSizes.data(), 1, grid.Comm() );
    vector<int> edgeOffsets;
    const int numEdges = Scan( edgeSizes, edgeOffsets );

    graph.Resize( distGraph.NumSources(), distGraph.NumTargets() );
    graph.Reserve( numEdges );
    graph.sources_.resize( numEdges );
    graph.targets_.resize( numEdges );
    mpi::Gather
    ( distGraph.LockedSourceBuffer(), numLocalEdges,
      graph.SourceBuffer(), edgeSizes.data(), edgeOffsets.data(),
      commRank, grid.Comm() );
    mpi::Gather
    ( distGraph.LockedTargetBuffer(), numLocalEdges,
      graph.TargetBuffer(), edgeSizes.data(), edgeOffsets.data(),
      commRank, grid.Comm() );
    graph.ProcessQueues();
}
Esempio n. 29
0
static bool ScanRightBrace( void )
/********************************/
{
    if( CurrToken != T_RIGHT_BRACE ) return( FALSE );
    Scan();
    return( TRUE );
}
Esempio n. 30
0
void VfkStream::Open(const VectorMap<int, String>& fns)
{
	Close();
	charset = CHARSET_ISO8859_2;
	file_groups <<= fns;
	streams.SetCount(file_groups.GetCount());
	for(int i = 0; i < streams.GetCount(); i++)
		if(!streams[i].Open(file_groups[i]))
			throw Exc(NFormat("cannot open file '%s'", file_groups[i]));
	indexfilename = GetTempFileName("vfk");
	if(!indexfile.Open(indexfilename, FileStream::CREATE))
		throw Exc(NFormat("cannot create indexfile '%s'", indexfilename));
	String hdrname = "X_HEADER";
	Table& hdr = tables.Add(hdrname);
	hdr.name = hdr.rawname = hdrname;
	hdr.header = true;
	hdr.row_count = 0;
	ASSERT(hdr.columns.GetCount() == HDR_ID);
	hdr.AddColumn(Column("ID", STRING_V, 30));
	ASSERT(hdr.columns.GetCount() == HDR_ORD);
	hdr.AddColumn(Column("ORD", INT_V));
	ASSERT(hdr.columns.GetCount() == HDR_STR);
	hdr.AddColumn(Column("STR", STRING_V, 1000));
	ASSERT(hdr.columns.GetCount() == HDR_NUM);
	hdr.AddColumn(Column("NUM", DOUBLE_V));
	ASSERT(hdr.columns.GetCount() == HDR_DTM);
	hdr.AddColumn(Column("DTM", TIME_V));
	ASSERT(hdr.columns.GetCount() == HDR_COUNT);
	Scan();
}