Exemplo n.º 1
0
/* Begin new glyph definition. */
static int glyphBeg(abfGlyphCallbacks *cb, abfGlyphInfo *info) {
	cfwCtx g = cb->direct_ctx;
	cstrCtx h = g->ctx.cstr;

	cb->info = info;
	if (g->err.code != 0) {
		if (g->flags & CFW_CHECK_IF_GLYPHS_DIFFER) {
			if (g->err.code & cfwErrGlyphPresent) {
				g->err.code = g->err.code & ~cfwErrGlyphPresent;
			}

			if (g->err.code & cfwErrGlyphDiffers) {
				g->err.code = g->err.code & ~cfwErrGlyphDiffers;
			}

			if (g->err.code != 0) {
				return ABF_FAIL_RET;    /* Error on last glyph */
			}
		}
		else {
			return ABF_FAIL_RET;    /* Error on last glyph */
		}
	}
	else if ((info->flags & ABF_GLYPH_SEEN) && (!(g->flags & CFW_CHECK_IF_GLYPHS_DIFFER))) {
		return ABF_SKIP_RET;    /* Ignore duplicate glyph */
	}
	else if (!(info->flags & ABF_GLYPH_CID) &&
	         (info->gname.ptr == NULL || info->gname.ptr[0] == '\0')) {
		return ABF_FAIL_RET;    /* No glyph name in name-keyed font */
	}
	/* Initialize */
	h->flags = 0;
	h->pendop = tx_noop;
	h->seqop = tx_noop;
	h->x = 0;
	h->y = 0;
	h->stack.cnt = 0;
	h->cstr.cnt = 0;
	h->stems.cnt = 0;
	h->iCstr = -1;
	h->masks.cnt = 0;
	h->hints.cnt = 0;
	h->cntrs.cnt = 0;
	CLEAR_MASK(h->initmask);
	CLEAR_MASK(h->hintmask);
	CLEAR_MASK(h->cntrmask);
	h->glyph.info = info;

	return ABF_CONT_RET;
}
Exemplo n.º 2
0
static void set_io_status(unsigned int &status, io_status s)
{
    switch ( s ) {
    case set_wait_read_status:
        SET_WAIT_READ(status);
        break;
    case set_wait_write_status:
        SET_WAIT_WRITE(status);
        break;
    case set_read_status:
        SET_READ(status);
        break;
    case set_write_status:
        SET_WRITE(status);
        break;
    case set_wait_accept_status:
        SET_WAIT_ACCEPT(status);
        break;
    case set_wait_io_status:
        SET_WAIT_IO(status);
        break;
    case set_wait_connect_status:
        SET_WAIT_CONNECT(status);
        break;
    case clear_status:
        CLEAR_MASK(status);
        break;
    default:
        break;
    }
}
Exemplo n.º 3
0
int sock_accept(int fd, struct sockaddr *, socklen_t*)
{
    coro_sock *sock = find_sock_by_fd(fd);
    sock->op = ACCEPTING;
    coro_sock *client = NULL;
    uthread_t cur = coro_current_uthread();
    set_pending_status(sock, set_wait_accept_status, cur, set_wait_accept_status);
    sock->eventqueue->push(cur);
    client = sock_accept_inner(sock, NULL, NULL);
    // 对于一个accept成功的socket,我们认为他是可以写的
    // 因此我们给他增加写入标志
    clear_pending_status(client, cur);
    CLEAR_MASK(client->status);
    SET_WRITE(client->status);
    return client->sock;
}
Exemplo n.º 4
0
/* Start new hint. */
static void newHint(cstrCtx h) {
	if (h->pendop == tx_noop && h->iCstr == h->cstr.cnt) {
		/* Consecutive hintsubs; clear mask */
		addWarn(h, warn_hint6);
		CLEAR_MASK(h->hintmask);
	}
	else {
		if (h->pendop != tx_noop) {
			saveop(h, h->pendop);   /* Save pending op */
		}
		if (h->flags & SEEN_HINT) {
			saveHint(h);
		}
		else {
			h->flags |= SEEN_HINT;
		}

		h->iCstr = h->cstr.cnt;
	}
}
Exemplo n.º 5
0
static void clear_pending_status(coro_sock *sock, uthread_t tid)
{
    (void)sock;
    CLEAR_MASK(__g_coroutine_ctx->ths[tid]->status);
}