Exemplo n.º 1
0
static void		get_ants(t_env *data, char *line)
{
	int		i;

	i = 0;
	if (get_next_line(0, &line) == -1)
		ft_error("read");
	if (line[0] == '#')
	{
		if (!ft_strcmp(line, "##start") || !ft_strcmp(line, "##end"))
			parsing_error(data, line);
	}
	else
	{
		while (line[i])
		{
			if (!ft_isdigit(line[i]))
				parsing_error(data, line);
			i++;
		}
		data->ants = ft_atoi(line);
		if (!data->ants)
			parsing_error(data, line);
	}
	ft_putendl(line);
	ft_strdel(&line);
}
/** \brief notify a utmsg packet
 * 
 * @return a tokeep from the bt_swarm_full_t notification (if no notification, return true)
 */
bool bt_utmsg_fstart_cnx_t::parse_pkt(const bt_utmsgtype_t &bt_utmsgtype
							, const pkt_t &pkt)	throw()
{
	// log to debug
	KLOG_DBG("enter bt_utmsgtype=" << bt_utmsgtype << " pkt=" << pkt);
	// sanity check - bt_utmsgtype MUST be the one of the bt_utmsg_vapi_t
	DBG_ASSERT( utmsg_fstart->utmsgtype() == bt_utmsgtype );
	// convert the fstart message body to a dvar_t
	dvar_t	dvar	= bencode_t::to_dvar(pkt.to_datum(datum_t::NOCOPY));

	// if the handshake_dvar failed to parse the bencoded data, return an error
	if( dvar.is_null() || dvar.type() != dvar_type_t::MAP )
		return parsing_error("unable to find fstart payload as dvar_type_t::MAP");

	// if the dvar doesnt include the balance, return an error
	if( !dvar.map().contain("v", dvar_type_t::INTEGER) )
		return parsing_error("unable to find 'v' fstart payload");

	// get the data from the dvar_t
	m_remote_fstart	= dvar.map()["v"].integer().to_size_t();

	// log to debug
	KLOG_ERR("remote_fstart=" << remote_fstart() );

	// return noerror
	return true;
}
Exemplo n.º 3
0
int factorParsing(int nLayer)
{
    parsingPrintLn(nLayer-1, "FACTOR", 0);
    switch(allWords[nAllIndex].eType) {
        case IDENTIFY:
            PARSING_PRINT("IDENTIFY");
            break;
        case INTEGER:
        case FLOATNUM:
            PARSING_PRINT("NUMBER");
            break;
        case LPAREN:
            PARSING_PRINT("LEFT_PAREN");
            expressionParsing(nLayer+1);
            if (allWords[nAllIndex].eType == RPAREN) {
                PARSING_PRINT("RIGHT_PAREN");
            }
            else {
                parsing_error(NEED_RPAREN);
            }
            break;
        default:
            parsing_error(NOT_FACTOR);
            break;
    }
    return 0;
}
Exemplo n.º 4
0
int				parsing(t_env *data)
{
	char	*line;
	int		ret;

	line = NULL;
	while (!(data->ants))
		get_ants(data, line);
	while ((ret = get_next_line(0, &line)))
	{
		if (!check_line(&line, data))
		{
			if (!can_start(data))
				parsing_error(data, line);
			ft_strdel(&line);
			ft_putchar('\n');
			return (solve(data));
		}
		ft_putendl(line);
		ft_strdel(&line);
	}
	if (ret == -1)
		ft_error("read");
	ft_putchar('\n');
	if (!can_start(data))
		parsing_error(data, line);
	return (solve(data));
}
Exemplo n.º 5
0
int procedureDefParsing(int nLayer)
{
    if (allWords[nAllIndex].eType == IDENTIFY) {
        PARSING_PRINT("IDENTIFY");
        if (allWords[nAllIndex].eType == SEMICOLON) {
            PARSING_PRINT("SEMICOLON");
            subProgramParsing(nLayer+1);
            if (allWords[nAllIndex].eType == SEMICOLON) {
                PARSING_PRINT("SEMICOLON");
            }
            else {
                parsing_error(NEED_SEMICOLON);
            }
        }
        else {
            parsing_error(NEED_SEMICOLON);
        }
    }
    return 0;
}
Exemplo n.º 6
0
int oneConstDefParsing(int nLayer)
{
    if (allWords[nAllIndex].eType == IDENTIFY) {
        PARSING_PRINT("IDENTIFY");
        if (allWords[nAllIndex].eType == CONSTDEF) {
            PARSING_PRINT("CONSTDEF");
            if (allWords[nAllIndex].eType == INTEGER || allWords[nAllIndex].eType == FLOATNUM) {
                PARSING_PRINT("NUMBER");
            }
            else {
                parsing_error(NEED_NUMBER);
            }
        }
        else {
            parsing_error(NEED_CONSTDEF);
        }
    }
    else {
        parsing_error(NEED_IDENTIFY);
    }
    return 0;
}
Exemplo n.º 7
0
int varDefParsing(int nLayer)
{
    parsingPrintLn(nLayer, "ONE_VARIABLE_DEF", 0);
    if (allWords[nAllIndex].eType == IDENTIFY) {
        PARSING_PRINT("VARIABLE");
        while (allWords[nAllIndex].eType == COMMA) {
            PARSING_PRINT("COMMA");
            parsingPrintLn(nLayer, "ONE_VARIABLE_DEF", 0);
            if (allWords[nAllIndex].eType == IDENTIFY) {
                PARSING_PRINT("VARIABLE");
            }
            else {
                parsing_error(NEED_IDENTIFY);
            }
        }
    }
    else {
        parsing_error(NEED_IDENTIFY);
    }
    if (allWords[nAllIndex].eType == SEMICOLON) {
        PARSING_PRINT("SEMICOLON");
    }
    return 0;
}
Exemplo n.º 8
0
int parsing_analysis(int e)
{
    nAllIndex = 0;
    int nLayer = 0;
    if (e) {
        return 1;
    }

    subProgramParsing(nLayer);
    if (allWords[nAllIndex].eType != PERIOD) {
        parsing_error(BAD_END);
    }
    PARSING_PRINT("END_OF_PROGRAM");
    printParsingError();
    return 0;
}
Exemplo n.º 9
0
int constDefParsing(int nLayer)
{
    parsingPrintLn(nLayer, "ONE_CONSTENT_DEF", 0);
    oneConstDefParsing(nLayer+1);
    while (allWords[nAllIndex].eType == COMMA) {
        PARSING_PRINT("COMMA");
        parsingPrintLn(nLayer, "ONE_CONSTENT_DEF", 0);
        oneConstDefParsing(nLayer+1);
    }
    if (allWords[nAllIndex].eType == SEMICOLON) {
        PARSING_PRINT("SEMICOLON");
    }
    else {
        parsing_error(NEED_SEMICOLON);
    }

    return 0;
}
Exemplo n.º 10
0
int conditionParsing(int nLayer)
{
    parsingPrintLn(nLayer-1, "CONDITION", 0);
    if (allWords[nAllIndex].eType == ODDSYM) {
        PARSING_PRINT("ODD");
        expressionParsing(nLayer+1);
    }
    else {
        expressionParsing(nLayer+1);
        if (ETYPE_IN_COMPARE(allWords[nAllIndex].eType)) {
            PARSING_PRINT(symStringMap[allWords[nAllIndex].eType]);
            expressionParsing(nLayer+1);
        }
        else {
            parsing_error(NEED_COMPARE);
        }
    }
    return 0;
}
/** \brief Parse a bt_cmdtype_t::UTMSG_PAYL received by the attached bt_swarm_full_t
 * 
 * @return a tokeep for the bt_swarm_full_t
 */
bool	bt_swarm_full_utmsg_t::parse_utmsg_payl(pkt_t &pkt)		throw()
{
	uint8_t			recved_opcode;
	bt_utmsgtype_t		recved_utmsgtype;
	// log to debug
	KLOG_DBG("enter pkt="<< pkt);

	// parse the bt_utmsgtype_t
	try {
		pkt >> recved_opcode;
	}catch(serial_except_t &e){
		return bt_err_t::ERROR;
	}

	// log to debug
	KLOG_DBG("recved_opcode=" << (int)recved_opcode);

	// convert the recved_opcode with the convtable_db_t
	convtable_db_t::const_iterator	iter;
	for(iter = convtable_db.begin(); iter != convtable_db.end(); iter++){
		const bt_utmsgtype_t &	local_utmsgtype	= iter->first;
		const uint8_t &		remote_opcode	= iter->second;
		// if the remote_opcode is not the recved_opcode, goto the next
		if( recved_opcode != remote_opcode )	continue;
		// set the recved_utmsgtype and leave the loop
		recved_utmsgtype	= local_utmsgtype;
		break;
	}
	// if the recved_opcode has not been found in the convtable_db, return an error
	if( iter == convtable_db.end() )
		return parsing_error("received opcode not in convtable_db from a " + swarm_full->remote_peerid().peerid_progfull());

	// if the recved_utmsgtype is a HANDSHAKE, parse it internally
	if( recved_utmsgtype == bt_utmsgtype_t::HANDSHAKE )	return parse_handshake(pkt);

	// sanity check - the cnx_vapi_db MUST contain the bt_utmsgtype_t too
	DBG_ASSERT( cnx_vapi_db.find(recved_utmsgtype) != cnx_vapi_db.end() );

	// send the packet to parse to the bt_utmsg_cnx_vapi_t
	bt_utmsg_cnx_vapi_t * cnx_vapi	= cnx_vapi_db.find(recved_utmsgtype)->second;
	return cnx_vapi->parse_pkt(recved_utmsgtype, pkt);
}
Exemplo n.º 12
0
// Scope
ScopeNode* Parser::parse_scope()
{
	auto node = ast.store.alloc<ScopeNode>();
	node->code = *token_iter;
	std::vector<StatementNode*> statements;

	// Open scope
	if (token_iter->type != LPAREN) {
		// Error
		std::ostringstream msg;
		msg << "Opening scope with wrong character: '" << token_iter->text << "'.";
		parsing_error(*token_iter, msg.str());
	}
	++token_iter;

	// Push this scope
	fn_scope.push_scope();

	while (true) {
		skip_newlines();

		// Close scope?
		if (token_iter->type == RPAREN) {
			++token_iter;
			break;
		}
		// Should be an expression
		else {
			statements.push_back(parse_statement());
		}
	}

	node->statements = ast.store.alloc_from_iters(statements.begin(), statements.end());

	// Pop this scope
	fn_scope.pop_scope();

	node->code.text.set_end((token_iter - 1)->text.end());
	return node;
}
Exemplo n.º 13
0
// Statement
// Parses a single full statement.  In general this means a declaration
// or an expression, but also includes things like return and break
// statements.
StatementNode* Parser::parse_statement()
{
	switch (token_iter->type) {
		// Return statement
		case K_RETURN: {
			return parse_return();
		}

		// Declaration
		case K_CONST:
		case K_VAL:
		case K_VAR:
		case K_FN:
		case K_STRUCT:
		case K_TYPE: {
			return parse_declaration();
		}

		// Expression
		case INTEGER_LIT:
		case FLOAT_LIT:
		case STRING_LIT:
		case RAW_STRING_LIT:
		case LPAREN:
		case IDENTIFIER:
		case OPERATOR:
		case DOLLAR: {
			return parse_expression();
		}

		default: {
			// Error
			std::ostringstream msg;
			msg << "Unknown statement '" << token_iter->text << "'.";
			parsing_error(*token_iter, msg.str());
			throw 0; // Silence warnings about not returning, parsing_error throws anyway
		}
	}
}
/** \brief parse a bt_utmsgtype_t::HANDSHAKE
 * 
 * @return a tokeep for the bt_swarm_full_t
 */
bool	bt_swarm_full_utmsg_t::parse_handshake(pkt_t &pkt)	throw()
{
	bt_swarm_t *		bt_swarm	= swarm_full->get_swarm();
	bt_swarm_utmsg_t *	swarm_utmsg	= bt_swarm->swarm_utmsg();	
	// log to debug
	KLOG_DBG("enter pkt=" << pkt);

	// convert the handshake message body to a dvar_t
	dvar_t	handshake_dvar	= bencode_t::to_dvar(pkt.to_datum(datum_t::NOCOPY));

	// if the handshake_dvar failed to parse the bencoded data, return an error
	if( handshake_dvar.is_null() || handshake_dvar.type() != dvar_type_t::MAP )
		return parsing_error("unable to find handshake_dvar as dvar_type_t::MAP");

	// get the prog_version if available
	if( handshake_dvar.map().contain("v", dvar_type_t::STRING) )
		remote_prog_version	= handshake_dvar.map()["v"].str().get();

	// get the tcp_listen_port if available
	if( handshake_dvar.map().contain("p", dvar_type_t::INTEGER) ){
		uint16_t tcp_listen_port = handshake_dvar.map()["p"].integer().get();
		// build the remote_tcp_listen_ipport from the connection remote_addr and listen port
		remote_tcp_listen_ipport = swarm_full->remote_addr().get_peerid_vapi()->to_string()
						+ std::string(":") + OSTREAMSTR(tcp_listen_port);
		// if tcp_listen_port is 0, nullify remote_tcp_listen_ipport
		if( tcp_listen_port == 0 )	remote_tcp_listen_ipport = ipport_addr_t();
	}

	// if the handshake_dvar doesnt contains the convtable map, return now
	if( !handshake_dvar.map().contain("m", dvar_type_t::MAP) )	return true;
	// create an alias on the convtable_dvar
	const dvar_map_t &convtable_dvar	= handshake_dvar.map()["m"].map();

	// parse the convtable for each registered bt_utmsg_vapi_t
	const bt_swarm_utmsg_t::utmsg_vapi_db_t &utmsg_vapi_db	= swarm_utmsg->utmsg_vapi_db();
	bt_swarm_utmsg_t::utmsg_vapi_db_t::const_iterator	iter;
	for(iter = utmsg_vapi_db.begin(); iter != utmsg_vapi_db.end(); iter++){
		bt_utmsg_vapi_t *	utmsg_vapi	= *iter;
		bt_utmsgtype_t		bt_utmsgtype	= utmsg_vapi->utmsgtype();
		std::string		utmsgstr	= utmsg_vapi->utmsgstr();
		// if this utmsg is not supported by remove peer, goto the next
		if( !convtable_dvar.contain(utmsgstr, dvar_type_t::INTEGER) )	continue;

		// get the opcode used by the remote peer
		uint8_t	opcode	= convtable_dvar[utmsgstr].integer().get();

		// if the new opcode is 0, DO NOT add it and goes to the next
		// - if an opcode is 0, this mean disable the option
		if( opcode == 0 ){
			// if bt_utmsgtype_t is not in convtable_db, goto the next
			// - this means a bug in the remote peer as it put a 0 opcode for
			//   an extension which has not yet been initialized
			if( convtable_db.find(bt_utmsgtype) == convtable_db.end() )	continue;
			// sanity check - the cnx_vapi_db MUST contain the bt_utmsgtype_t too
			DBG_ASSERT( cnx_vapi_db.find(bt_utmsgtype) != cnx_vapi_db.end() );
			// delete the cnx_vapi object
			bt_utmsg_cnx_vapi_t * cnx_vapi	= cnx_vapi_db.find(bt_utmsgtype)->second;
			nipmem_delete	cnx_vapi;	
			// remote this bt_utmsgtype_t from both database
			cnx_vapi_db.erase(bt_utmsgtype);
			convtable_db.erase(bt_utmsgtype);
			continue;
		}		

		// insert/update this bt_utmsgtype to the convtable_db
		convtable_db[bt_utmsgtype] = opcode;

		// create the bt_utmsg_cnx_vapi_t - if not yet initialized
		// - it links itself to the bt_swarm_full_utmsg_t
		if( cnx_vapi_db.find(bt_utmsgtype) == cnx_vapi_db.end() ){
			bt_utmsg_cnx_vapi_t * cnx_vapi	= utmsg_vapi->cnx_ctor(this);
			DBG_ASSERT( cnx_vapi );
		}
	}

	// return no error
	return true;
}
Exemplo n.º 15
0
int statementParsing(int nLayer)
{
    switch(allWords[nAllIndex].eType) {
        case IDENTIFY:
            parsingPrintLn(nLayer-1, "ASSIGN_STATEMENT", 0);
            PARSING_PRINT("IDENTIFY");
            if (allWords[nAllIndex].eType == BECOMES) {
                PARSING_PRINT("BECOMES");
                expressionParsing(nLayer+1);
                if (allWords[nAllIndex].eType == SEMICOLON) {
                    PARSING_PRINT("SEMICOLON");
                }
                else {
                    parsing_error(NEED_SEMICOLON);
                }
            }
            else {
                parsing_error(NEED_BECOMES);
            }
            break;
        case CALLSYM:
            parsingPrintLn(nLayer-1, "CALL_STATEMENT", 0);
            PARSING_PRINT("CALL");
            if (allWords[nAllIndex].eType == IDENTIFY) {
                PARSING_PRINT("IDENTIFY");
            }
            else {
                parsing_error(NEED_IDENTIFY);
            }
            break;
        case BEGINSYM:
            parsingPrintLn(nLayer-1, "BEGIN_STATEMENT", 0);
            PARSING_PRINT("BEGIN");
            statementParsing(nLayer+1);
            while (allWords[nAllIndex].eType == SEMICOLON) {
                PARSING_PRINT("SEMICOLON");
                statementParsing(nLayer+1);
            }
            if (allWords[nAllIndex].eType == ENDSYM) {
                PARSING_PRINT("END");
            }
            else {
                parsing_error(NEED_END);
            }
            break;
        case IFSYM:
            parsingPrintLn(nLayer-1, "IF_STATEMENT", 0);
            PARSING_PRINT("IF");
            if (allWords[nAllIndex].eType == LPAREN) {
                PARSING_PRINT("LEFT_PAREN");
                conditionParsing(nLayer+1);
                if (allWords[nAllIndex].eType == RPAREN) {
                    PARSING_PRINT("RIGHT_PAREN");
                    statementParsing(nLayer+1);
                    if (allWords[nAllIndex].eType == ELSESYM) {
                        PARSING_PRINT("ELSE");
                        statementParsing(nLayer+1);
                    }
                }
                else {
                    parsing_error(NEED_RPAREN);
                }
            }
            else {
                parsing_error(NEED_LPAREN);
            }
            break;
        case WHILESYM:
            parsingPrintLn(nLayer-1, "WHILE_STATEMENT", 0);
            PARSING_PRINT("WHILE");
            conditionParsing(nLayer+1);
            if (allWords[nAllIndex].eType == DOSYM) {
                PARSING_PRINT("DO");
                statementParsing(nLayer+1);
            }
            else {
                parsing_error(NEED_DO);
            }
            break;
        case READSYM:
            parsingPrintLn(nLayer-1, "READ_STATEMENT", 0);
            PARSING_PRINT("READ");
            if (allWords[nAllIndex].eType == LPAREN) {
                PARSING_PRINT("LEFT_PAREN");
                if (allWords[nAllIndex].eType == IDENTIFY) {
                    PARSING_PRINT("IDENTIFY");
                    while (allWords[nAllIndex].eType == COMMA) {
                        PARSING_PRINT("COMMA");
                        if (allWords[nAllIndex].eType == IDENTIFY) {
                            PARSING_PRINT("IDENTIFY");
                        }
                        else {
                            parsing_error(NEED_IDENTIFY);
                        }
                    }
                    if (allWords[nAllIndex].eType == RPAREN) {
                        PARSING_PRINT("RIGHT_PAREN");
                    }
                    else {
                        parsing_error(NEED_RPAREN);
                    }
                }
                else {
                    parsing_error(NEED_IDENTIFY);
                }
            }
            else {
                parsing_error(NEED_LPAREN);
            }
            break;
        case WRITESYM:
            parsingPrintLn(nLayer-1, "WRITE_STATEMENT", 0);
            PARSING_PRINT("WRITE");
            if (allWords[nAllIndex].eType == LPAREN) {
                PARSING_PRINT("LEFT_PAREN");
                expressionParsing(nLayer+2);
                while (allWords[nAllIndex].eType == COMMA) {
                    PARSING_PRINT("COMMA");
                    expressionParsing(nLayer+1);
                }
                if (allWords[nAllIndex].eType == RPAREN) {
                    PARSING_PRINT("RIGHT_PAREN");
                }
                else {
                    parsing_error(NEED_RPAREN);
                }
            }
            else {
                parsing_error(NEED_LPAREN);
            }
            break;
        default:
            break;
    }       
    return 0;
}
Exemplo n.º 16
0
sc::result ParseSectionHeaders::react( const EvNewData & ev )
{
	(void) ev;

	DEBUG_MSG(NOTIFY, "new data to offset: %d", availableOffset());
	DEBUG_MSG(NOTIFY, "current offset    : %d", currentOffset());
	
	std::size_t numberOfSections = context<StreamingMelter>().numberOfSections();

	if (current_ > numberOfSections + 1) 
	{
		// we already processed all sections, send padding
		if (availableOffset() > firstSectionDataOffset_) {
			context<StreamingMelter>().complete( firstSectionDataOffset_ - currentOffset() );
			return transit<ParseNativeSections>();
		} else {
			context<StreamingMelter>().complete( availableOffset() - currentOffset() );
			return discard_event();
		}
	}
	
	if (currentOffset() + sizeof(IMAGE_SECTION_HEADER) < availableOffset())
	{
		DEBUG_MSG(NOTIFY, "header %d", current_);
		
		if (current_ < numberOfSections ) {
			// original PE sections
			PIMAGE_SECTION_HEADER header = (PIMAGE_SECTION_HEADER) context<StreamingMelter>().buffer()->data();
			DEBUG_MSG(NOTIFY, "Section %s", string((PCHAR)header->Name));
			
			if (header->PointerToRawData < firstSectionDataOffset_)
				firstSectionDataOffset_ = header->PointerToRawData;
			
			context<StreamingMelter>().addSection(header);
			
		} else {
			// added sections
			if (current_ == (numberOfSections)) 
			{
				// dropper
				DEBUG_MSG(NOTIFY, "Dropper section header.");
			}
			else if (current_ == (numberOfSections + 1))
			{
				// rebuilt resources
				DEBUG_MSG(NOTIFY, "Rebuilt resources section header.");
			}
			else
			{
				// unknown ... we have a problem
				throw parsing_error("Unknown non-original section found.");
			}
		}
		
		context<StreamingMelter>().complete( sizeof(IMAGE_SECTION_HEADER) );
		current_++;
	}
	
	DEBUG_MSG(NOTIFY, "number of sections: %d", context<StreamingMelter>().numberOfSections());
	DEBUG_MSG(NOTIFY, "file alignment    : %d", context<StreamingMelter>().fileAlignment());
	
	// context<StreamingMelter>().complete( availableOffset() - currentOffset() );
	return discard_event();
}
Exemplo n.º 17
0
static bool_t
fpgnscan (FILE *fpgn, bool_t quiet, struct DATA *d)
{
#define MAX_MYLINE 40000

	char myline[MAX_MYLINE];

	const char *whitesep = "[White \"";
	const char *whiteend = "\"]";
	const char *blacksep = "[Black \"";
	const char *blackend = "\"]";
	const char *resulsep = "[Result \"";
	const char *resulend = "\"]";

	size_t whitesep_len, blacksep_len, resulsep_len;
	char *x, *y;

	struct pgn_result 	result;
	long int			line_counter = 0;
	long int			game_counter = 0;
	int					games_x_dot  = 2000;

	assert(d);

	if (NULL == fpgn || NULL == d)
		return FALSE;

	if (!quiet) 
		printf("Loading data (%d games x dot): \n\n",games_x_dot); fflush(stdout);

	pgn_result_reset  (&result);

	whitesep_len = strlen(whitesep); 
	blacksep_len = strlen(blacksep); 
	resulsep_len = strlen(resulsep); 

	while (NULL != fgets(myline, MAX_MYLINE, fpgn)) {

		line_counter++;

		if (NULL != (x = strstr (myline, whitesep))) {
			x += whitesep_len;
			if (NULL != (y = strstr (myline, whiteend))) {
				*y = '\0';
						strcpy (result.wtag, x);
						result.wtag_present = TRUE;
			} else {
				parsing_error(line_counter);
			}
		}

		if (NULL != (x = strstr (myline, blacksep))) {
			x += blacksep_len;
			if (NULL != (y = strstr (myline, blackend))) {
				*y = '\0';
						strcpy (result.btag, x);
						result.btag_present = TRUE;
			} else {
				parsing_error(line_counter);
			}
		}

		if (NULL != (x = strstr (myline, resulsep))) {
			x += resulsep_len;
			if (NULL != (y = strstr (myline, resulend))) {
				*y = '\0';
						result.result = res2int (x);
						result.result_present = TRUE;
			} else {
				parsing_error(line_counter);
			}
		}

		if (is_complete (&result)) {
			if (!pgn_result_collect (&result, d)) {
				fprintf (stderr, "\nCould not collect more games: Limits reached\n");
				exit(EXIT_FAILURE);
			}
			pgn_result_reset  (&result);
			game_counter++;

			if (!quiet) {
				if ((game_counter%games_x_dot)==0) {
					printf ("."); fflush(stdout);
				}
				if ((game_counter%100000)==0) {
					printf ("|  %4ldk\n", game_counter/1000); fflush(stdout);
				}
			}
		}

	} /* while */

	if (!quiet) printf("|\n\n"); fflush(stdout);

	return TRUE;
}