Example #1
0
bool LoadLevel::Run(const std::vector<std::string>& Args)
{
	static const size_t InfiniteGameTimeOffset = 0x2391C51;

	if( Args.size() >= 2 )
	{
		if( std::find(MapList.begin(), MapList.end(), Args[1]) != MapList.end() )
		{
			std::cout << "Loading map: " + Args[1] << std::endl;
			std::string MapName = "maps\\" + Args[1];

			// Game Type
			Blam::GameType gameType = Blam::GameType::None; // No gametype

			if( Args.size() >= 3 )
			{
				//Look up gametype string.
				size_t i;
				for( i = 0; i < Blam::GameTypeCount; i++ )
				{
					// Todo: case insensiive
					if( !Blam::GameTypeNames[i].compare(Args[2]) )
					{
						gameType = Blam::GameType(i);
						break;
					}
				}

				if( i == Blam::GameTypeCount )
				{
					gameType = (Blam::GameType)std::atoi(Args[2].c_str());
				}
				if( gameType > Blam::GameTypeCount ) // only valid gametypes are 1 to 10
					gameType = Blam::GameType::Slayer;
			}
			std::cout << "Gametype: " << Blam::GameTypeNames[gameType] << std::endl;

			Pointer(0x2391B2C).Write<uint32_t>(gameType);

			// Infinite play time
			Pointer(InfiniteGameTimeOffset).Write<uint8_t>(0);

			// Game Mode

			Pointer(0x2391800).Write<uint32_t>(0x2);

			// Map Name
			//memcpy((char*)0x2391824, MapName.c_str(), MapName.length() + 1);
			Pointer(0x2391824).Write(MapName.c_str(), MapName.length() + 1);

			// Map Reset
			Pointer(0x23917F0).Write<uint8_t>(0x1);
			//*((uint8_t*)(0x23917F0)) = 0x1;

			return true;
		}
	}

	return false;
}
Example #2
0
	PatchModuleNetwork::PatchModuleNetwork() : ModuleBase("Patches.Network")
	{
		AddModulePatches({},
		{
			// Fix network debug strings having (null) instead of an IP address
			Hook("IPStringFromInAddr", 0x43F6F0, Network_GetIPStringFromInAddr, HookType::Jmp),

			// Fix for XnAddrToInAddr to try checking syslink-menu data for XnAddr->InAddr mapping before consulting XNet
			Hook("XnAddrToInAddr", 0x430B6C, Network_XnAddrToInAddrHook, HookType::Call),
			Hook("InAddrToXnAddr", 0x430F51, Network_InAddrToXnAddrHook, HookType::Call),

			// Player-properties packet hooks
			Hook("PlayerProperties1", 0x45DD20, PeerRequestPlayerDesiredPropertiesUpdateHook, HookType::Jmp),
			Hook("PlayerProperties2", 0x4DAF4F, ApplyPlayerPropertiesExtended, HookType::Call),
			Hook("PlayerProperties3", 0x4DFF7E, RegisterPlayerPropertiesPacketHook, HookType::Call),
			Hook("PlayerProperties4", 0x4DFD53, SerializePlayerPropertiesHook, HookType::Call),
			Hook("PlayerProperties5", 0x4DE178, DeserializePlayerPropertiesHook, HookType::Call),
		});

		// Patch version subs to return version of this DLL, to make people with older DLLs incompatible
		// (we don't do this in a patchset so that other plugins can patch the version if they want, with no conflict errors generated by patchmanager)
		uint32_t verNum = Utils::Version::GetVersionInt();
		Pointer(0x501421).Write<uint32_t>(verNum);
		Pointer(0x50143A).Write<uint32_t>(verNum);
	}
Example #3
0
File: webcam.cpp Project: Amxx/MDMA
WebCam::WebCam(void* pVoid)
{
	int* pInt = static_cast<int*>(pVoid);
	camera.open( (pInt) ? *pInt : 0 );
	if(!camera.isOpened()) throw MDMA::DEVICE_NOT_DETECTED;
	pts.insert(0, Pointer());
	pts.insert(1, Pointer());
}
void* InspMember::Data(void *object) const
{
	if(type->IsPointer())
	{
		return *(void **) Pointer(object);
	}
	else
	{
		return Pointer(object);
	}
}
Example #5
0
std::vector<UIHandlePtr> Track::HitTest
(const TrackPanelMouseState &st,
 const AudacityProject *pProject)
{
   UIHandlePtr result;
   std::vector<UIHandlePtr> results;
   const ToolsToolBar * pTtb = pProject->GetToolsToolBar();
   const bool isMultiTool = pTtb->IsDown(multiTool);
   const auto currentTool = pTtb->GetCurrentTool();

   if ( !isMultiTool && currentTool == zoomTool ) {
      // Zoom tool is a non-selecting tool that takes precedence in all tracks
      // over all other tools, no matter what detail you point at.
      result = ZoomHandle::HitAnywhere(
         pProject->GetBackgroundCell()->mZoomHandle);
      results.push_back(result);
      return results;
   }

   // In other tools, let subclasses determine detailed hits.
   results =
      DetailedHitTest( st, pProject, currentTool, isMultiTool );

   // There are still some general cases.

   // Sliding applies in more than one track type.
   if ( !isMultiTool && currentTool == slideTool ) {
      result = TimeShiftHandle::HitAnywhere(
         mTimeShiftHandle, Pointer(this), false);
      if (result)
         results.push_back(result);
   }

   // Let the multi-tool right-click handler apply only in default of all
   // other detailed hits.
   if ( isMultiTool ) {
      result = ZoomHandle::HitTest(
         pProject->GetBackgroundCell()->mZoomHandle, st.state);
      if (result)
         results.push_back(result);
   }

   // Finally, default of all is adjustment of the selection box.
   if ( isMultiTool || currentTool == selectTool ) {
      result = SelectHandle::HitTest(
         mSelectHandle, st, pProject, Pointer(this));
      if (result)
         results.push_back(result);
   }

   return results;
}
Example #6
0
Pointer
Scope::
get_pointer(const std::string&  name) const
{
    for(auto&  ln: link_table)
    {
        if(ln.name == name)
        {
          return Pointer(ln.index);
        }
    }


  return parent? parent->get_pointer(name):Pointer();
}
Example #7
0
Node* Parser::Pointer() {
	if(oper == OPER_MULTIPLY) {
		Next();
		return Pointer();
	}
	return NULL;
}
Example #8
0
bool LLVMReachingDefsAnalysis::handleIntrinsicCall(LLVMNode *callNode,
                                                   CallInst *CI,
                                                   DefMap *df)
{
    bool changed = false;
    IntrinsicInst *I = cast<IntrinsicInst>(CI);
    Value *dest;

    switch (I->getIntrinsicID())
    {
        case Intrinsic::memmove:
        case Intrinsic::memcpy:
        case Intrinsic::memset:
            dest = I->getOperand(0);
            break;
        default:
            return handleUndefinedCall(callNode, CI, df);
    }

    LLVMNode *destNode = getOperand(callNode, dest, 1);
    assert(destNode && "No operand for intrinsic call");

    for (const Pointer& ptr : destNode->getPointsTo()) {
        // we could compute all the concrete offsets, but
        // these functions usually set the whole memory,
        // so if we use UNKNOWN_OFFSET, the effect is the same
        changed |= df->add(Pointer(ptr.obj, UNKNOWN_OFFSET), callNode);
    }

    return changed;
}
Example #9
0
proxy_t::Pointer proxy_t::createProxy(McrouterInstance& router,
                                      folly::EventBase& eventBase) {
  /* This hack is needed to make sure proxy_t stays alive
     until at least event base managed to run the callback below */
  auto proxy = std::shared_ptr<proxy_t>(new proxy_t(router));
  proxy->self_ = proxy;

  eventBase.runInEventBaseThread(
    [proxy, &eventBase] () {
      proxy->eventBase_ = &eventBase;
      proxy->messageQueue_->attachEventBase(eventBase);

      dynamic_cast<folly::fibers::EventBaseLoopController&>(
        proxy->fiberManager.loopController()).attachEventBase(eventBase);

      std::chrono::milliseconds connectionResetInterval{
        proxy->router_.opts().reset_inactive_connection_interval
      };

      if (connectionResetInterval.count() > 0) {
        proxy->destinationMap->setResetTimer(connectionResetInterval);
      }

      if (proxy->router_.opts().cpu_cycles) {
        cycles::attachEventBase(eventBase);
        proxy->fiberManager.setObserver(&proxy->cyclesObserver);
      }
    });

  return Pointer(proxy.get());
}
Example #10
0
bool LLVMReachingDefsAnalysis::handleUndefinedCall(LLVMNode *callNode,
                                                   CallInst *CI,
                                                   DefMap *df)
{
    bool changed = false;
    for (unsigned n = 1, e = callNode->getOperandsNum(); n < e; ++n) {
        Value *llvmOp = CI->getOperand(n - 1);
        if (!llvmOp->getType()->isPointerTy())
            continue;

        if (isa<Constant>(llvmOp->stripInBoundsOffsets()))
            continue;

        LLVMNode *op = getOperand(callNode, llvmOp, n);
        assert(op && "unhandled pointer operand in undef call");

        // with undefined call we must assume that any
        // memory that was passed via pointer was modified
        // and on unknown offset
        // XXX we should handle external globals too
        for (const Pointer& ptr : op->getPointsTo())
            changed |= df->add(Pointer(ptr.obj, UNKNOWN_OFFSET), callNode);
    }

    return changed;
}
Example #11
0
std::shared_ptr<TrackPanelCell> Track::GetResizer()
{
   if (!mpResizer)
      // create on demand
      mpResizer = std::make_shared<TrackPanelResizerCell>( Pointer( this ) );
   return mpResizer;
}
	/** Equivalent to
	 *  @code
	 *  Pointer(valuer_per_vertex, data_type, false, 0, NULL)
	 *  @endcode
	 *  if @p data_type is DataType::Float or to
	 *  @code
	 *  LPointer(valuer_per_vertex, data_type, 0, NULL)
	 *  @endcode
	 *  if @p data_type is DataType::Double or to
	 *  @code
	 *  IPointer(valuer_per_vertex, data_type, 0, NULL)
	 *  @endcode
	 *  otherwise.
	 *
	 *  @note Consider using the templated version of Setup(), because
	 *  it is more portable. For example instead of:
	 *  @code
	 *  attr.Setup(3, DataType::Float);
	 *  @endcode
	 *  use
	 *  @code
	 *  attr.Setup<Vec3f>();
	 *  @endcode
	 *  or
	 *  @code
	 *  attr.Setup<GLfloat>(3);
	 *  @endcode
	 *
	 *  @see Pointer
	 *  @see IPointer
	 *  @see LPointer
	 *
	 *  @glsymbols
	 *  @glfunref{VertexAttribPointer}
	 */
	const VertexAttribArray& Setup(
		GLint values_per_vertex,
		DataType data_type
	) const
	{
		if(data_type == DataType::Float)
		{
			Pointer(
				values_per_vertex,
				data_type,
				false,
				0,
				nullptr
			);
		}
		else if(data_type == DataType::Double)
		{
			LPointer(
				values_per_vertex,
				data_type,
				0,
				nullptr
			);
		}
		else
		{
			IPointer(
				values_per_vertex,
				data_type,
				0,
				nullptr
			);
		}
		return *this;
	}
Example #13
0
		bool StartInfoServer()
		{
			if (infoSocketOpen)
				return true;

			Server::Voting::StartNewVote();
			HWND hwnd = Pointer::Base(0x159C014).Read<HWND>();
			if (hwnd == 0)
				return false;

			infoSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
			SOCKADDR_IN bindAddr;
			bindAddr.sin_family = AF_INET;
			bindAddr.sin_addr.s_addr = htonl(INADDR_ANY);

			unsigned long port = Modules::ModuleServer::Instance().VarServerPort->ValueInt;
			if (port == Pointer(0x1860454).Read<uint32_t>()) // make sure port isn't the same as game port
				port++;
			bindAddr.sin_port = htons((u_short)port);

			// open our listener socket
			while (bind(infoSocket, (PSOCKADDR)&bindAddr, sizeof(bindAddr)) != 0)
			{
				port++;
				if (port == Pointer(0x1860454).Read<uint32_t>()) // make sure port isn't the same as game port
					port++;
				bindAddr.sin_port = htons((u_short)port);
				if (port > (Modules::ModuleServer::Instance().VarServerPort->ValueInt + 10))
					return false; // tried 10 ports, lets give up
			}
			Modules::CommandMap::Instance().SetVariable(Modules::ModuleServer::Instance().VarServerPort, std::to_string(port), std::string());

			//Setup UPnP
			if (Modules::ModuleUPnP::Instance().VarUPnPEnabled->ValueInt)
			{
				Modules::ModuleUPnP::Instance().UPnPForwardPort(true, port, port, "ElDewrito InfoServer");
				Modules::ModuleUPnP::Instance().UPnPForwardPort(false, Pointer(0x1860454).Read<uint32_t>(), Pointer(0x1860454).Read<uint32_t>(), "ElDewrito Game");
				Modules::ModuleUPnP::Instance().UPnPForwardPort(false, 9987, 9987, "ElDewrito VoIP");
			}

			WSAAsyncSelect(infoSocket, hwnd, WM_INFOSERVER, FD_ACCEPT | FD_CLOSE);
			listen(infoSocket, 5);
			infoSocketOpen = true;

			return true;
		}
Example #14
0
Pointer get_pointer_event(AInputEvent* event, int32_t index)
{
    const Vec2i& point = rainbow::graphics::convert_to_flipped_view(Vec2i(
        AMotionEvent_getX(event, index), AMotionEvent_getY(event, index)));
    return Pointer(AMotionEvent_getPointerId(event, index),
                   point.x,
                   point.y,
                   AMotionEvent_getEventTime(event));
}
        Pointer MemoryPool::get_for_uint64_count(int uint64_count)
        {
            if (uint64_count < 0)
            {
                throw std::invalid_argument("uint64_count");
            }
            if (uint64_count == 0)
            {
                return Pointer();
            }
            int start = 0;
            int end = static_cast<int>(pools_.size());
            while (start < end)
            {
                int mid = (start + end) / 2;
                MemoryPoolHead *mid_head = pools_[mid];
                int mid_uint64_count = mid_head->uint64_count();
                if (uint64_count < mid_uint64_count)
                {
                    start = mid + 1;
                }
                else if (uint64_count > mid_uint64_count)
                {
                    end = mid;
                }
                else
                {
                    return Pointer(mid_head);
                }
            }
            MemoryPoolHead *new_head = new MemoryPoolHead(uint64_count);

            if (!pools_.empty())
            {
                pools_.insert(pools_.begin() + start, new_head);
            }
            else
            {
                pools_.push_back(new_head);
            }

            return Pointer(new_head);
        }
Example #16
0
/// <summary>
/// Gets the main TLS address (optionally with an offset added)
/// </summary>
/// <param name="offset">The offset to add to the TLS address.</param>
/// <returns>A Pointer to the TLS.</returns>
Pointer Engine::GetMainTls(size_t offset)
{
	static Pointer ThreadLocalStorage;
	if (!ThreadLocalStorage && GetGameThreadID())
	{
		size_t MainThreadID = GetGameThreadID();

		HANDLE MainThreadHandle = OpenThread(THREAD_GET_CONTEXT | THREAD_SUSPEND_RESUME | THREAD_QUERY_INFORMATION, false, MainThreadID);

		// Get thread context
		CONTEXT MainThreadContext;
		MainThreadContext.ContextFlags = CONTEXT_FULL;

		if (MainThreadID != GetCurrentThreadId())
			SuspendThread(MainThreadHandle);

		BOOL success = GetThreadContext(MainThreadHandle, &MainThreadContext);
		if (!success)
		{
			OutputDebugStringA(std::string("Error getting thread context: ").append(std::to_string(GetLastError())).c_str());
			std::exit(1);
		}
		ResumeThread(MainThreadHandle);

		// Get thread selector

		LDT_ENTRY MainThreadLdt;

		success = GetThreadSelectorEntry(MainThreadHandle, MainThreadContext.SegFs, &MainThreadLdt);
		if (!success)
		{
			OutputDebugStringA(std::string("Error getting thread context: ").append(std::to_string(GetLastError())).c_str());
		}
		size_t TlsPtrArrayAddress = (size_t)((size_t)(MainThreadLdt.HighWord.Bits.BaseHi << 24) | (MainThreadLdt.HighWord.Bits.BaseMid << 16) | MainThreadLdt.BaseLow) + 0x2C;
		size_t TlsPtrAddress = Pointer(TlsPtrArrayAddress).Read<uint32_t>();

		// Index has been consistantly 0. Keep a look out.
		ThreadLocalStorage = Pointer(TlsPtrAddress)[0];
	}

	return ThreadLocalStorage(offset);
}
Reference::Reference(const std::string &ref)
	: m_ref(ref)
{
	const std::size_t pound = ref.find('#');
	if (pound != std::string::npos) {
		m_uri = ref.substr(0, pound);
		m_pointer = Pointer(ref.substr(pound + 1));

		m_isValid = (m_uri.empty() || isURI(m_uri)) && m_pointer.isValid();
	}
}
Example #18
0
NODE_IMPLEMENTATION(DynamicCast::node, Pointer)
{
    const Symbol* sym = NODE_THIS.argNode(0)->symbol();

    if (const Class* c0 = dynamic_cast<const Class*>(sym))
    {
	if (ClassInstance* o = NODE_ARG_OBJECT(1, ClassInstance))
	{
	    if (const Class* c1 = dynamic_cast<const Class*>(o->type()))
	    {
                if (ClassInstance* dobj = c1->dynamicCast(o, c0, true))
                {
                    NODE_RETURN(dobj);
                }
		//if (c1->isA(c0)) NODE_RETURN((Pointer)o);
	    }
	}
	else
	{
	    //
	    //	Let nil pass through
	    //

	    NODE_RETURN((Pointer)o);
	}
    }
    else if (const Interface* i = dynamic_cast<const Interface*>(sym))
    {
	if (Object* o = reinterpret_cast<Object*>(NODE_ARG(1, Pointer)))
	{
	    if (const Class* c1 = dynamic_cast<const Class*>(o->type()))
	    {
		if (c1->implementation(i))
		{
		    NODE_RETURN((Pointer)o);
		}
	    }
	}
	else
	{
	    //
	    //	Can't attempt to cast nil to an interface. Let it throw.
	    //

            //  ALLOWING --NEEDS FIXING

            NODE_RETURN(Pointer(0));
	}
    }

    throw BadDynamicCastException(NODE_THREAD);
}
Example #19
0
Pointer Allocator::alloc(size_t size) {
    for (int i = 0; i < this->pointers.size() - 1; i++) {
        char *end_addr = this->pointers[i].addr + this->pointers[i].size;
        if (canAlloc(end_addr, size, this->pointers[i + 1].addr)) {
            SmartPointer *new_pointer = new SmartPointer(this, i + 1);
            for (auto iter = this->pointers.begin() + i + 1; iter != this->pointers.end() - 1; iter++) {
                iter->p->inc();
            } 
            this->pointers.insert(this->pointers.begin() + i + 1, MyPar(end_addr, size, new_pointer));
            return Pointer(new_pointer);
        }
    }
    throw AllocError(AllocErrorType::NoMemory, "Alloc failed. No Memory");
}
Example #20
0
inline Pointer ranked_index_nth(std::size_t n,Pointer end_)
{
  Pointer top=end_->parent();
  if(top==Pointer(0)||n>=top->size)return end_;

  for(;;){
    std::size_t s=ranked_node_size(top->left());
    if(n==s)return top;
    if(n<s)top=top->left();
    else{
      top=top->right();
      n-=s+1;
    }
  }
}
Example #21
0
inline std::size_t ranked_index_rank(Pointer x,Pointer end_)
{
  Pointer top=end_->parent();
  if(top==Pointer(0))return 0;
  if(x==end_)return top->size;

  std::size_t s=ranked_node_size(x->left());
  while(x!=top){
    Pointer z=x->parent();
    if(x==z->right()){
      s+=ranked_node_size(z->left())+1;
    }
    x=z;
  }
  return s;
}
	const VertexAttribArray& Setup(
		GLint values_per_vertex,
		std::integral_constant<
			typename enums::EnumValueType<DataType>::Type,
			OGLPLUS_CONST_ENUM_VALUE(DataType::Float)
		>
	) const
	{
		return Pointer(
			values_per_vertex,
			DataType::Float,
			false,
			0,
			nullptr
		);
	}
Example #23
0
McrouterClient::Pointer McrouterClient::create(
  std::weak_ptr<McrouterInstance> router,
  mcrouter_client_callbacks_t callbacks,
  void* arg,
  size_t maxOutstanding,
  bool maxOutstandingError,
  bool sameThread) {

  auto client = new McrouterClient(std::move(router),
                                   callbacks,
                                   arg,
                                   maxOutstanding,
                                   maxOutstandingError,
                                   sameThread);
  client->self_ = std::shared_ptr<McrouterClient>(client);
  return Pointer(client);
}
Example #24
0
Value
Object::
get_value(Memory&  mem) const
{
    switch(kind)
    {
      case(ObjectKind::auto_variable):
      case(ObjectKind::static_variable):
      case(ObjectKind::reference):
        return Value(Reference(Pointer(value)));
        break;
      case(ObjectKind::enumerator):
        break;
    }


  return Value::undefined;
}
Example #25
0
 ListNode *mergeKLists(vector<ListNode *> &lists) {
     priority_queue<Pointer> que;
     ListNode head(0), *tail;
     tail = &head;
     for (int i = 0; i < lists.size(); ++i) {
         que.push(Pointer(lists[i]));
     }
     while(!que.empty()) {
         Pointer now = que.top();
         que.pop();
         if (now.p) {
             tail->next = now.p;
             tail = tail->next;
             que.push((now.p)->next);
         }
     }
     return head.next;
 }
Example #26
0
// replace all pointers to given target with one
// to that target, but UNKNOWN_OFFSET
bool PSNode::addPointsToUnknownOffset(PSNode *target)
{
    bool changed = false;
    for (auto I = pointsTo.begin(), E = pointsTo.end(); I != E;) {
        auto cur = I++;

        // erase pointers to the same memory but with concrete offset
        if (cur->target == target && !cur->offset.isUnknown()) {
            pointsTo.erase(cur);
            changed = true;
        }
    }

    // DONT use addPointsTo() method, it would recursively call
    // this method again, until stack overflow
    changed |= pointsTo.insert(Pointer(target, UNKNOWN_OFFSET)).second;

    return changed;
}
Example #27
0
Pointer Allocator::alloc(size_t required_bytes)
{

    size_t required_blocks = bytes_to_blocks(required_bytes);
    index_t position = find_position(required_blocks);

    if(position == -1)
    {   
    	throw AllocError(AllocErrorType::NoMemory);
    }


    fill_map(position, required_blocks);

    index_t pointer_id = insert(position, required_blocks);

    return Pointer(this, pointer_id);

}
Example #28
0
void BufferedStreamingGrid::reset	(bool read,int minWindowSize)
{
	this->read=read;
	win=minWindowSize<rows() ? minWindowSize : rows();

	FreePointer( data );
	data = AllocPointer< byte >( rowSize() * win );
	if( !data ) fprintf( stderr , "[ERROR] Failed to allocate memory for BufferedStreamingGrid\n" ) , exit( 0 );
	sg->reset( read , 1 );
	if( read )
	{
		for(int w=0;w<win;w++)
		{
			Pointer( byte ) row = (*sg)[w];
			memcpy( data+w*rowSize() , row , rowSize() );
			sg->advance();
		}
	}
	current=0;
}
Example #29
0
NODE_IMPLEMENTATION(DynamicPartialEvaluate::node, Pointer)
{
    typedef FunctionSpecializer Generator;

    FunctionObject* f = NODE_ARG_OBJECT(1, FunctionObject);
    Generator::ArgumentVector args(f->function()->numArgs() +
                                   f->function()->numFreeVariables());
    Generator::ArgumentMask   mask(args.size());
    Process* p = NODE_THREAD.process();
    Context* c = p->context();

    for (int i=0; i < args.size(); i++)
    {
        mask[i] = NODE_THIS.argNode(i+2)->symbol() != c->noop();

        if (mask[i])
        {
            args[i] = NODE_ANY_TYPE_ARG(i+2);
        }
    }

    try
    {
        Generator evaluator(f->function(), p, &NODE_THREAD);
        evaluator.partiallyEvaluate(args, mask);

        const FunctionType* rt = evaluator.result()->type();
        assert(rt == NODE_THIS.argNode(0)->type());
        FunctionObject* o = new FunctionObject(rt);
        o->setFunction(evaluator.result());
        NODE_RETURN(Pointer(o));
    }
    catch (Exception& e)
    {
        ProgramException exc(NODE_THREAD);
        exc.message() = e.message();
        exc.message() += " during partial evaluation of ";
        exc.message() += f->function()->name().c_str();
        throw exc;
    }
}
Example #30
0
NODE_IMPLEMENTATION(Curry::node, Pointer)
{
    Process*                 p = NODE_THREAD.process();
    Context*                 c = p->context();
    FunctionObject*          o = NODE_ARG_OBJECT(1, FunctionObject);
    bool                     d = NODE_ARG(2, bool);
    const Function*          F = o->function();
    Function::ArgumentVector args(F->numArgs() + F->numFreeVariables());
    vector<bool>             mask(args.size());

    for (int i=0, s=args.size(); i < s; i++)
    {
        mask[i] = NODE_THIS.argNode(i+3)->symbol() != c->noop();

        if (mask[i])
        {
            args[i] = NODE_ANY_TYPE_ARG(i+3);
        }
    }

    NODE_RETURN(Pointer(evaluate(NODE_THREAD, o, args, mask, d)));
}