Пример #1
0
Toxme::ExecCode Toxme::extractError(QString json)
{
    static const QByteArray pattern{"c\":"};

    if (json.isEmpty())
        return ServerError;

    json = json.remove(' ');
    const int start = json.indexOf(pattern);
    if (start == -1)
        return ServerError;

    json = json.mid(start+pattern.size());
    int end = json.indexOf(",");
    if (end == -1)
    {
        end = json.indexOf("}");
        if (end == -1)
            return IncorrectResponse;
    }

    json.truncate(end);
    bool ok;
    int r = json.toInt(&ok);
    if (!ok)
        return IncorrectResponse;

    return ExecCode(r);
}
Пример #2
0
void    R_FExec( void ) {
//=================

    ExecInit();
    for(;;) {
        ExecCode();
        if( IOCB->flags & IOF_FMTDONE ) break;
    }
    if( IOCB->flags & IOF_OUTPT ) {
        R_NewRec();
    }
}
Пример #3
0
static  void    R_FELParen( uint rep_spec, char dummy2 ) {
//===========================================

    fmt_desc PGM *revert;

    IOCB->fmtptr = (fmt_desc PGM *)((fmt PGM *)IOCB->fmtptr + 1);
    revert = IOCB->fmtptr;
    for(;;) {
        IOCB->fmtptr = revert;
        for(;;) {
            if( (IOCB->fmtptr->fmt.code & ~EXTEND_FORMAT) == RP_FORMAT ) break;
            if( IOCB->flags & IOF_FMTDONE ) break;
            ExecCode();
        }
        if( IOCB->flags & IOF_FMTDONE ) break;
        if( --rep_spec == 0 ) break;
    }
    IOCB->fmtptr = (fmt_desc PGM *)((fmt PGM *)IOCB->fmtptr + 1);
}
Пример #4
0
int scheduler(void)
{
	struct process *prc;

	prc = Find_max_prio();

	current_proc = prc;

	if (prc->run)
	{
		printf("\nbegin working on process with pid %d\n",prc->pid);

		if(prc->code == NULL)
		{
			printf("NULL proc(there are no tasks for it)\n");
		}
		else
			ExecCode(prc);

		printf("finished working on process with pid %d\n",prc->pid);
	}

	return 0;
}