コード例 #1
0
Graph* World_GetGraph(World *inWorld, int32 inID)
{
	if (inID == -1) inID = inWorld->hw->mRecentID;
	Node *node = World_GetNode(inWorld, inID);
	if (!node) return 0;
	return node->mIsGroup ? 0 : (Graph*)node;
}
コード例 #2
0
ファイル: SC_MiscCmds.cpp プロジェクト: 2mc/supercollider
Node* Msg_GetNode(World *inWorld, sc_msg_iter& msg)
{
	Node *node;
	if (msg.nextTag('i') == 's')
	{
		const char* loc = msg.gets();
		int32 nodeID = msg.geti();
		gMissingNodeID = nodeID;
		node = World_GetNode(inWorld, nodeID);
		while (*loc)
		{
			if (!node) return 0;
			switch (*loc)
			{
				case 'h' :
					if (!node->mIsGroup) return 0;
					node = ((Group*)node)->mHead;
					break;
				case 't' :
					if (!node->mIsGroup) return 0;
					node = ((Group*)node)->mTail;
					break;
				case 'u' :
					node = &node->mParent->mNode;
					break;
				case 'p' :
					node = node->mPrev;
					break;
				case 'n' :
					node = node->mNext;
					break;
			}
			loc++;
		}
	}
	else
	{
		int32 nodeID = msg.geti();
		gMissingNodeID = nodeID;
		node = World_GetNode(inWorld, nodeID);
	}
	return node;
}
コード例 #3
0
ファイル: SC_Node.cpp プロジェクト: HuaxingXu/supercollider
// create a new node
int Node_New(World *inWorld, NodeDef *def, int32 inID, Node** outNode)
{
	if (inID < 0) {
		if (inID == -1) { // -1 means generate an id for the event
			HiddenWorld* hw = inWorld->hw;
			inID = hw->mHiddenID = (hw->mHiddenID - 8) | 0x80000000;
		} else {
			return kSCErr_ReservedNodeID;
		}
	}

	if (World_GetNode(inWorld, inID)) {
		return kSCErr_DuplicateNodeID;
	}

	Node* node = (Node*)World_Alloc(inWorld, def->mAllocSize);

	node->mWorld = inWorld;
	node->mDef = def;
	node->mParent = 0;
	node->mPrev = 0;
	node->mNext = 0;
	node->mIsGroup = false;

	node->mID = inID;
	node->mHash = Hash(inID);
	if (!World_AddNode(inWorld, node)) {
		World_Free(inWorld, node);
		return kSCErr_TooManyNodes;
	}

	inWorld->hw->mRecentID = inID;

	*outNode = node;

	return kSCErr_None;
}
コード例 #4
0
Group* World_GetGroup(World *inWorld, int32 inID)
{
	Node *node = World_GetNode(inWorld, inID);
	if (!node) return 0;
	return node->mIsGroup ? (Group*)node : 0;
}