Exemple #1
0
int main(void)
{
    opentest(OUTFILE);
	fs= func( (fd/a) ,  func(2,0x0082c90f) );
	fprintf(outfile,"fs:%ld\n",fs);
	fs=_func( (fd/a) , _func(2,0x0082c90f) );
	fprintf(outfile,"fs:%ld\n",fs);
    closetest(THISFILE);
}
Exemple #2
0
void CallbackTimer::callbackAndDeleteLater()
{
    if (_func) _func();

    // The timer will be gone.
    this->deleteLater();
}
Exemple #3
0
 void flush() const
 {
     if (_enabled)
     {
         _func(_stream.str());
     }
 }
  void ProcessUnitList::pushUnit(boost::shared_ptr<org::esb::hive::job::ProcessUnit> unit)
  {
    //_unit_list.insert(unit);
    std::string uuid=org::esb::util::PUUID();
    _unit_map[unit->_sequence]=uuid;


    org::esb::io::File file(_user_data_path+"/"+uuid);
    org::esb::io::FileOutputStream fos(&file);
    org::esb::io::ObjectOutputStream ous(&fos);
    ous.writeObject(unit);
    ous.close();


    while(_unit_map.size()&&(*_unit_map.begin()).first==lastSequence){
      std::cerr<<"lastSequence found:"<<lastSequence<<std::endl;
      std::string nuuid=(*_unit_map.begin()).second;
      org::esb::io::File infile(_user_data_path+"/"+nuuid);
      org::esb::io::FileInputStream infos(&infile);
      org::esb::io::ObjectInputStream inous(&infos);
      inous.readObject(unit);
      inous.close();
      infos.close();
      infile.deleteFile();
      if(_func)
        _func(unit);
      /*foreach(boost::shared_ptr<Packet>  p,(*_unit_list.begin())->_output_packets){
        Task::pushBuffer(Ptr<Packet>(p));
      }*/
      _unit_map.erase(_unit_map.begin());
      lastSequence++;
    }
  }
void DebuggerUpdateThread::updateDebuggers()
{
   if ( _func )
      _func();

   emit updateComplete();
}
Exemple #6
0
void cvar_delegate::run( const cvar_arguments& args ) const
{
	if ( _func )
	{
		_func( _user, this, args );
	}
}
Exemple #7
0
 PyPtr _call(Registry const & registry, OverloadResolutionData & data, IntSeq<S...>) const {
     ArgsFromPython<Args...> & converted_args
         = static_cast<ArgsFromPython<Args...> &>(*data.converted_args);
     return ReturnToPython<Result>::apply(
         registry,
         _func(std::get<S>(converted_args.elements)->convert()...)
     );
 }
Exemple #8
0
    bool Function::processEvent(cafe::Event& event)
    {
        if(_func) {
            return _func(event);
        } else {
            err() << "cafe::Function: FATAL: function not found: " << name() << std::endl;
	    abort();
        }
    }
Exemple #9
0
void	
SimdCCallInst::execute (SimdBoolMask &mask, SimdXContext &xcontext) const
{
    {
	StackFrame stackFrame (xcontext);
	_func (mask, xcontext);
    }
    if( _numParameters > 0)
	xcontext.stack().pop ( _numParameters);
}
Exemple #10
0
void Callback::update(const float delta) {
  if (_ended)
    return;

  _func();

  _currentTime += delta;
  if (_currentTime > _delay)
    _ended = true;
}
Exemple #11
0
    R operator()(Args... args) {
        auto instance = active_instance();
        if (instance) {
            while (!instance->_callbacks.empty()) {
                if (instance->_callbacks.top()._conditional(args...)) {
                    return instance->_callbacks.top()._callback(args...);
                }
                instance->_callbacks.pop();
            }
        }

        return _func(args...);
    }
Exemple #12
0
void	TaskThread::mainloop(void)
{
  if (_init)
    (_init)(_arg);
  while (_running)
    {
      _finish = false;
      _mutex->lock();
      _cond->signal();
      _cond->wait();
      if (_running)
	_func(_arg);
      _mutex->unlock();
    }
}
Exemple #13
0
 Nature::EdgeNature CurveNatureF1D::operator()(Interface1D& inter) {
   ViewEdge* ve = dynamic_cast<ViewEdge*>(&inter);
   if (ve)
     return ve->getNature();
   else{
     // we return a nature that contains every 
     // natures of the viewedges spanned by the chain.
     Nature::EdgeNature nat = Nature::NO_FEATURE;
     Interface0DIterator it = inter.verticesBegin();
     while(!it.isEnd()){
       nat |= _func(it);
       ++it;
     }
     return nat;
   }
 }
Exemple #14
0
void CallEvent(BaseComponent *object, Events event)
{
    if (EventFactory::connections.count(object) > 0) {
        if (EventFactory::connections[object].count(event) > 0) {
            auto& connectionList = EventFactory::connections[object][event];

            for (auto& connection : connectionList) {
                auto slot = connection.getSlot();
                if (slot && slot->useable())
                {
                    slot->_func();
                }
            }
        }
    }
}
Exemple #15
0
void NativeFunctionInfo::call(JSContext* cx, JS::CallArgs args) {
    auto holder = getHolder(args);

    if (!holder) {
        // Calling the prototype
        args.rval().setUndefined();
        return;
    }

    JS::RootedObject robj(cx, JS_NewArrayObject(cx, args));
    if (!robj) {
        uasserted(ErrorCodes::JSInterpreterFailure, "Failed to JS_NewArrayObject");
    }

    BSONObj out = holder->_func(ObjectWrapper(cx, robj).toBSON(), holder->_ctx);

    ValueReader(cx, args.rval()).fromBSONElement(out.firstElement(), out, false);
}
Exemple #16
0
bool DXFSolid::inside( const Vec3D &x ) const
{
    if( !_entities )
	return( false );

    // Transform 3D -> 3D
    // T is direct transformation
    Vec3D y = _T.transform_point( x );

    // Transform 3D -> 2D
    Vec3D z = _func( y );

    if( isnan(z[0]) || isnan(z[1]) )
	return( true );
    else if( isinf(z[0]) || isinf(z[1]) )
	return( false );

    return( _entities->inside_loop( _selection, z[0], z[1] ) );
}
Exemple #17
0
// ADD-BY-LEETEN 02/02/2012-BEGIN
void
Solution::Scan
(
 void (*_func)(int iLocalT, int iNode, VECTOR3* pv3)
)
{
	int iFor, jFor;
	float u, v, w;

	for(int iFor = 0; iFor < m_nTimeSteps; iFor++)
	  {
	    for(int jFor = 0; jFor < m_nNodeNum; jFor++)
	      {
		_func
		  (
		      iFor,
		      jFor,
		      &m_pDataArray[iFor][jFor]
		  );
	      }
	  }
}
Exemple #18
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Processor::flush() {
	size_t n = _samplePool.size();
	double *data = _samplePool.samples;
	bool clipped = false;

	// Skip empty sample pool
	if ( n == 0 ) return;

	// -------------------------------------------------------------------
	// Saturation check
	// -------------------------------------------------------------------
	if ( _config.saturationThreshold >= 0 ) {
		double maxCounts = (_config.saturationThreshold * 0.01) * (2 << 23);
		for ( size_t i = 0; i < n; ++i ) {
			if ( fabs(data[i]) > maxCounts ) clipped = true;
		}
	}

	// -------------------------------------------------------------------
	// Sensitivity correction
	// -------------------------------------------------------------------
	double scorr = 1.0 / _streamConfig[_usedComponent].gain;
	for ( size_t i = 0; i < n; ++i ) data[i] *= scorr;

	// -------------------------------------------------------------------
	// Baseline correction and filtering
	// -------------------------------------------------------------------
	double amp0 = getValue(n, data, NULL, _baselineCorrection0, _filter0.get());

	// -------------------------------------------------------------------
	// Conversion to ACC, VEL, DISP
	// -------------------------------------------------------------------
	SignalUnit unit;
	if ( !unit.fromString(_streamConfig[_usedComponent].gainUnit.c_str()) ) {
		SEISCOMP_ERROR("%s: internal error: invalid gain unit '%s'",
		               Private::toStreamID(_waveformID).c_str(),
		               _streamConfig[_usedComponent].gainUnit.c_str());
		return;
	}

	double vel, acc, disp;
	std::vector<double> tmp;
	double *vel_data;

	switch ( unit ) {
		case MeterPerSecond:
			vel = amp0;
			tmp.assign(data, data+n);
			vel_data = &tmp[0];
			acc = getAcceleration(n, data);
			break;
		case MeterPerSecondSquared:
			acc = amp0;
			vel = getVelocity(n, data);
			vel_data = data;
			break;
		default:
			SEISCOMP_ERROR("%s: internal error: unsupported gain unit '%s'",
			               Private::toStreamID(_waveformID).c_str(),
			               _streamConfig[_usedComponent].gainUnit.c_str());
			return;
	}

	disp = getDisplacement(n, vel_data);

	// Publish result
	if ( _func )
		_func(this, acc, vel, disp, _currentStartTime, clipped);

	_samplePool.clear();
}
Exemple #19
0
void ZSocketSource::socketWritten(int fd) {
    if(_func)
        _func(_data, fd, purpleInputCondition());
}
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void AmplitudeProcessor::emitAmplitude(const Result &res) {
	if ( isEnabled() && _func )
		_func(this, res);
}
Exemple #21
0
void Thread::run()
{
	if (_func != NULL) {
		_func(_param);
	}
}
Exemple #22
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Picker::emitPick(const Result &result) {
	if ( isEnabled() && _func )
		_func(this, result);
}
Exemple #23
0
 void flush() const
 {
     _func(_stream.str());
 }
Exemple #24
0
 virtual void on_complete( const void* v, const fc::exception_ptr& e ) {
   _func( *static_cast<const T*>(v), e);
 }
Exemple #25
0
 virtual void on_complete( const void* v, const fc::exception_ptr& e ) {
   _func(e);
 }
void ShellCommand::exec(const StringList& args)
{
    _func(args);
}
void debug_console(void (*_func)(void))
{
	int done = 0;

	while( key_inkey() ) {
		os_poll();
	}

	if ( !debug_inited ) {
		dc_init();
	}

	dc_draw(TRUE);

	while (!done) {
		// poll the os
		os_poll();

		int k = key_inkey();
		switch( k ) {

		case KEY_SHIFTED+KEY_ENTER:
		case KEY_ESC:
			done = TRUE;
			break;

		case KEY_BACKSP:
			if (!dc_command_buf.empty()) {
				dc_command_buf.erase(dc_command_buf.size() - 1);
			}
			break;

		case KEY_F3:
		case KEY_UP:
			if (last_oldcommand < (dc_history.end() - 1)) {
				++last_oldcommand;
			}

			dc_command_buf = *last_oldcommand;
			break;

		case KEY_DOWN:
			if (last_oldcommand > dc_history.begin()) {
				--last_oldcommand;
			}

			dc_command_buf = *last_oldcommand;
			break;

		case KEY_PAGEUP:
			if (dc_scroll_y > 1) {
				dc_scroll_y--;
			}
			break;

		case KEY_PAGEDOWN:
			if (dc_scroll_y < (DBROWS - DROWS)) {
				dc_scroll_y++;
			} else {
				dc_scroll_y = (DBROWS - DROWS);
			}
			break;

		case KEY_ENTER:
			dc_scroll_y = (DBROWS - DROWS);			// Set the scroll to look at the bottom
			last_oldcommand = dc_history.begin();	// Reset the last oldcommand
			lastline = 0;	// Reset the line counter

			// Clear the command line on the window, but don't print the prompt until the command has processed
			// Stuff a copy of the command line onto the history
			// Search for the command
				// If not found:
				//   abort,
				//   dc_printf("Error: Invalid or Missing command %s", cmd.c_str()), and
				//   dc_printf(dc_prompt) when ready for input
			// Call the function for that command, and strip the cmd token from the command line string
			if (dc_command_buf.empty()) {
				dc_printf("No command given.\n");
				break;
			} // Else, continue to process the cmd_line

			// z64: Thread Note: Maybe lock a mutex here to allow a previous DCF to finish/abort before starting a new one
			// z64: We'll just assume we won't be here unless a command has finished...
			dc_history.push_front(dc_command_buf);	// Push the command onto the history queue
			last_oldcommand = dc_history.begin();	// Reset oldcommand

			while (dc_history.size() > DCMDS) {
				dc_history.pop_back();			// Keep the commands less than or equal to DCMDS
			}

			dc_command_str = dc_command_buf;	// Xfer to the command string for processing
			dc_command_buf.resize(0);			// Nullify the buffer
			dc_printf("%s%s\n", dc_prompt, dc_command_str.c_str());	// Print the command w/ prompt.
			dc_draw(FALSE);					// Redraw the console without the command line.
			dc_do_command(&dc_command_str);	// Try to do the command
			break;

		default:
			// Not any of the control key codes, so it's probably a letter or number.
			ubyte c = (ubyte)key_to_ascii(k);
			if ((c != 255) && (dc_command_buf.size() < MAX_CLI_LEN)) {
				dc_command_buf.push_back(c);
			}
		}

		// Do the passed function
		if ( _func ) {
			_func();
		}

		// All done, and ready for new entry
		dc_draw(TRUE);
	}

	while( key_inkey() ) {
		os_poll();
	}
}
 void operator()(Vertex v, Graph& /*g*/)
 {
     _func(v);
 }
Exemple #29
0
 void operator()() const { _func(_param); }
Exemple #30
0
 int operator()() const
 {
     _func(_param);
     return 0;
 }