Server::Server(Settings& settings) : _settings(settings), _admMessageQueue(new Tools::SimpleMessageQueue(1)) { Tools::debug << "Server::Server()\n"; this->_rcon = new Rcon::Rcon(*this); this->_resourceManager = new Database::ResourceManager(*this); this->_clientManager = new ClientManagement::ClientManager(*this, *this->_admMessageQueue); this->_game = new Game::Game(*this, *this->_admMessageQueue); Network::Network::NewConnectionHandler nch(std::bind(&ClientManagement::ClientManager::HandleNewClient, this->_clientManager, std::placeholders::_1, std::placeholders::_2)); Network::Network::PacketHandler ph(std::bind(&ClientManagement::ClientManager::HandlePacket, this->_clientManager, std::placeholders::_1, std::placeholders::_2)); Network::Network::ErrorHandler eh(std::bind(&ClientManagement::ClientManager::HandleClientError, this->_clientManager, std::placeholders::_1)); this->_network = new Network::Network(*this, nch, ph, eh); }
/*}}}*/ static void process_selbri_args(TreeNode *s, TermVector *pre, TermVector *post, LinkConv *lc)/*{{{*/ { /* Drill down into a selbri etc */ TreeNode *cs, *s1, *s2, *s3; /* The selbri chain */ TermVector empty_tv; tv_init(&empty_tv); type_check(s, SELBRI); cs = s; do { s1 = find_nth_child(cs, 1, SELBRI_1); /* Try to get selbri_2, or go round again if there's a NA */ s2 = find_nth_child(s1, 1, SELBRI_2); if (!s2) { cs = find_nth_child(s1, 1, SELBRI); assert(cs); } } while (!s2); /* OK, have selbri_2, the fun starts here if there's a CO. */ s3 = child_ref(s2, 0); if (nch(s2) > 1) { /* There is a CO following. Only the head terms apply to this first selbri_3, its other arguments are either linked sumti or are unspecified. */ process_selbri_3_args(s3, pre, &empty_tv, lc); while (nch(s2) > 1) { s2 = find_nth_child(s2, 1, SELBRI_2); } s3 = child_ref(s2, 0); process_selbri_3_args(s3, &empty_tv, post, lc); } else { /* All arguments apply to the selbri_3 */ process_selbri_3_args(s3, pre, post, lc); } }/*}}}*/
/*}}}*/ static void process_selbri_6_args(TreeNode *s6, TermVector *pre, TermVector *post, LinkConv *lc)/*{{{*/ { /* Drill down into a selbri_6 etc */ TreeNode *tu, *tu1, *cs6, *cs; /* For the cases with BO, I think it's only the very final term that's relevant. For the guhek cases, I think these are like connectives, in selbri_4/5, it's like gek_sentence?? */ type_check(s6, SELBRI_6); if (nch(s6) == 1) { tu = child_ref(s6, 0); /* Always first child */ if (nch(tu) > 1) { fprintf(stderr, "tanru_unit at line %d column %d contains CEI, can't handle this yet\n", tu->start_line, tu->start_column); } else { tu1 = child_ref(tu, 0); process_tanru_unit_1_args(tu1, pre, post, lc); } } else { tu = find_nth_child(s6, 1, TANRU_UNIT); if (tu) { /* BO form */ cs6 = find_nth_child(s6, 1, SELBRI_6); process_selbri_6_args(cs6, pre, post, lc); } else { cs = find_nth_child(s6, 1, SELBRI); cs6 = find_nth_child(s6, 1, SELBRI_6); process_selbri_args(cs, pre, post, lc); process_selbri_6_args(cs6, pre, post, lc); } } }
/*}}}*/ static void process_selbri_3_args(TreeNode *s3, TermVector *pre, TermVector *post, LinkConv *lc)/*{{{*/ { /* Drill down into a selbri_3 to try to recover a single tanru_unit_2 which is the tertau. Apply the supplied args to that - i.e. work out the place structure, then go and mark all the referenced terms accordingly. */ TreeNode *s4, *s5, *ks3, *cs3; /* The selbri chain */ type_check(s3, SELBRI_3); /* The tertau is always the last entry in the sequence of selbri_4's. Fortunately, this is immediately available via left recursion */ s4 = find_nth_child(s3, 1, SELBRI_4); /* If the selbri_4 is non-trivial (i.e. has connectives in), we have to descend each branch, more or less as though there was a gihek at the sentence level. Fortunately from this function onwards, the same termvectors apply to every child, so at least we're over that. */ if (nch(s4) > 1) { do { s5 = find_nth_child(s4, 1, SELBRI_5); if (s5) { process_selbri_5_args(s5, pre, post, lc); } else { ks3 = find_nth_child(s4, 1, KE_SELBRI_3); assert(ks3); cs3 = find_nth_child(ks3, 1, SELBRI_3); assert(cs3); process_selbri_3_args(cs3, pre, post, lc); } s4 = find_nth_child(s4, 1, SELBRI_4); } while (s4); } else { s5 = find_nth_child(s4, 1, SELBRI_5); process_selbri_5_args(s5, pre, post, lc); } }
/* - p_bracket - parse a bracketed character list * * Note a significant property of this code: if the allocset() did SETERROR, * no set operations are done. */ static void p_bracket(struct parse *p) { cset *cs; int invert = 0; /* Dept of Truly Sickening Special-Case Kludges */ if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) { EMIT(OBOW, 0); NEXTn(6); return; } if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) { EMIT(OEOW, 0); NEXTn(6); return; } if ((cs = allocset(p)) == NULL) { /* allocset did set error status in p */ return; } if (EAT('^')) invert++; /* make note to invert set at end */ if (EAT(']')) CHadd(cs, ']'); else if (EAT('-')) CHadd(cs, '-'); while (MORE() && PEEK() != ']' && !SEETWO('-', ']')) p_b_term(p, cs); if (EAT('-')) CHadd(cs, '-'); MUSTEAT(']', REG_EBRACK); if (p->error != 0) { /* don't mess things up further */ freeset(p, cs); return; } if (p->g->cflags®_ICASE) { int i; int ci; for (i = p->g->csetsize - 1; i >= 0; i--) if (CHIN(cs, i) && isalpha(i)) { ci = othercase(i); if (ci != i) CHadd(cs, ci); } if (cs->multis != NULL) mccase(p, cs); } if (invert) { int i; for (i = p->g->csetsize - 1; i >= 0; i--) if (CHIN(cs, i)) CHsub(cs, i); else CHadd(cs, i); if (p->g->cflags®_NEWLINE) CHsub(cs, '\n'); if (cs->multis != NULL) mcinvert(p, cs); } assert(cs->multis == NULL); /* xxx */ if (nch(p, cs) == 1) { /* optimize singleton sets */ ordinary(p, firstch(p, cs)); freeset(p, cs); } else EMIT(OANYOF, freezeset(p, cs)); }
uint MLB::beta_size(bool include_zeros)const{ uint nch(nch_); if(!include_zeros) --nch; return nch*psub_ + pch_; }