コード例 #1
0
ファイル: sccp_device.c プロジェクト: mehulsbhatt/voip-foip
void
sccp_dev_statusprompt_set(sccp_device_t * d, sccp_channel_t * c, char * msg, int timeout)
{
  sccp_moo_t * r;

  if (!d->session)
    return;

  if (msg == NULL) {

    REQ(r, ClearPromptStatusMessage)
    r->msg.ClearPromptStatusMessage.callReference = (c) ? c->callid : 0;
    r->msg.ClearPromptStatusMessage.lineInstance  = (c) ? c->line->instance : 0;

  } else {

    REQ(r, DisplayPromptStatusMessage)
    r->msg.DisplayPromptStatusMessage.messageTimeout = timeout;
    r->msg.DisplayPromptStatusMessage.callReference = (c) ? c->callid : 0;
    r->msg.DisplayPromptStatusMessage.lineInstance  = (c) ? c->line->instance : 0;
    strncpy(r->msg.DisplayPromptStatusMessage.promptMessage, msg, sizeof(r->msg.DisplayPromptStatusMessage.promptMessage) - 1);

  }

  sccp_dev_send(d, r);
}
コード例 #2
0
ファイル: pgen.c プロジェクト: 10sr/cpython
static void
compile_rhs(labellist *ll, nfa *nf, node *n, int *pa, int *pb)
{
    int i;
    int a, b;

    REQ(n, RHS);
    i = n->n_nchildren;
    REQN(i, 1);
    n = n->n_child;
    REQ(n, ALT);
    compile_alt(ll, nf, n, pa, pb);
    if (--i <= 0)
        return;
    n++;
    a = *pa;
    b = *pb;
    *pa = addnfastate(nf);
    *pb = addnfastate(nf);
    addnfaarc(nf, *pa, a, EMPTY);
    addnfaarc(nf, b, *pb, EMPTY);
    for (; --i >= 0; n++) {
        REQ(n, VBAR);
        REQN(i, 1);
        --i;
        n++;
        REQ(n, ALT);
        compile_alt(ll, nf, n, &a, &b);
        addnfaarc(nf, *pa, a, EMPTY);
        addnfaarc(nf, b, *pb, EMPTY);
    }
}
コード例 #3
0
ファイル: pgen.c プロジェクト: 10sr/cpython
static void
compile_atom(labellist *ll, nfa *nf, node *n, int *pa, int *pb)
{
    int i;

    REQ(n, ATOM);
    i = n->n_nchildren;
    (void)i; /* Don't warn about set but unused */
    REQN(i, 1);
    n = n->n_child;
    if (n->n_type == LPAR) {
        REQN(i, 3);
        n++;
        REQ(n, RHS);
        compile_rhs(ll, nf, n, pa, pb);
        n++;
        REQ(n, RPAR);
    }
    else if (n->n_type == NAME || n->n_type == STRING) {
        *pa = addnfastate(nf);
        *pb = addnfastate(nf);
        addnfaarc(nf, *pa, *pb, addlabel(ll, n->n_type, n->n_str));
    }
    else
        REQ(n, NAME);
}
コード例 #4
0
ファイル: sccp_device.c プロジェクト: mehulsbhatt/voip-foip
void sccp_dev_set_sptone_byid(sccp_device_t * d, int tone)
{
  sccp_moo_t * r;

  if (!d->session)
    return;

  if (d->currentTone == tone) {
    if (sccp_debug)
      ast_verbose(VERBOSE_PREFIX_3 "Current tone (%d) is equiv to wanted tone (%d).  Ignoring.\n", d->currentTone, tone);
    return;
  }

  if (sccp_debug)
    ast_verbose(VERBOSE_PREFIX_3 "Sending tone %d\n", tone);

  if (tone > 0) {
    REQ(r, StartToneMessage)
    r->msg.StartToneMessage.tone = tone;
  } else {
    REQ(r, StopToneMessage)
  }

  sccp_dev_send(d, r);
  d->currentTone = tone;

}
コード例 #5
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *lisp_print (object_t * lst)
{
  DOC ("Print object or sexp in parse-able form.");
  REQ (lst, 1, c_sym ("print"));
  obj_print (CAR (lst), 1);
  return NIL;
}
コード例 #6
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *numberp (object_t * lst)
{
  DOC ("Return t if object is a number.");
  REQ (lst, 1, c_sym ("numberp"));
  if (NUMP (CAR (lst)))
    return T;
  return NIL;
}
コード例 #7
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *symbolp (object_t * lst)
{
  DOC ("Return t if object is a symbol.");
  REQ (lst, 1, c_sym ("symbolp"));
  if (SYMBOLP (CAR (lst)))
    return T;
  return NIL;
}
コード例 #8
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *listp (object_t * lst)
{
  DOC ("Return t if object is a list.");
  REQ (lst, 1, c_sym ("listp"));
  if (LISTP (CAR (lst)))
    return T;
  return NIL;
}
コード例 #9
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *funcp (object_t * lst)
{
  DOC ("Return t if object is a function.");
  REQ (lst, 1, c_sym ("funcp"));
  if (FUNCP (CAR (lst)))
    return T;
  return NIL;
}
コード例 #10
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *nullp (object_t * lst)
{
  DOC ("Return t if object is nil.");
  REQ (lst, 1, c_sym ("nullp"));
  if (CAR (lst) == NIL)
    return T;
  return NIL;
}
コード例 #11
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *symbol_name (object_t * lst)
{
  DOC ("Return symbol name as string.");
  REQ (lst, 1, c_sym ("symbol-name"));
  if (!SYMBOLP (CAR (lst)))
    THROW (wrong_type, UPREF (CAR (lst)));
  return c_strs (xstrdup (SYMNAME (CAR (lst))));
}
コード例 #12
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *stringp (object_t * lst)
{
  DOC ("Return t if object is a string.");
  REQ (lst, 1, c_sym ("stringp"));
  if (STRINGP (CAR (lst)))
    return T;
  return NIL;
}
コード例 #13
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *floatp (object_t * lst)
{
  DOC ("Return t if object is a floating-point number.");
  REQ (lst, 1, c_sym ("floatp"));
  if (FLOATP (CAR (lst)))
    return T;
  return NIL;
}
コード例 #14
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *vectorp (object_t * lst)
{
  DOC ("Return t if object is a vector.");
  REQ (lst, 1, c_sym ("vectorp"));
  if (VECTORP (CAR (lst)))
    return T;
  return NIL;
}
コード例 #15
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *integerp (object_t * lst)
{
  DOC ("Return t if object is an integer.");
  REQ (lst, 1, c_sym ("integerp"));
  if (INTP (CAR (lst)))
    return T;
  return NIL;
}
コード例 #16
0
ファイル: neigh.c プロジェクト: ebichu/dd-wrt
static int neigh_filter(struct nl_common *obj, struct nl_common *filter)
{
	struct rtnl_neigh *o = (struct rtnl_neigh *) obj;
	struct rtnl_neigh *f = (struct rtnl_neigh *) filter;

	if (obj->ce_type != RTNL_NEIGH || filter->ce_type != RTNL_NEIGH)
		return 0;

#define REQ(F) (f->n_mask & NEIGH_HAS_##F)
#define AVAIL(F) (o->n_mask & NEIGH_HAS_##F)
	if ((REQ(IFINDEX) &&
	      (!AVAIL(IFINDEX) || o->n_ifindex != f->n_ifindex))	   ||
	    (REQ(FAMILY)  &&
	      (!AVAIL(FAMILY)  || o->n_family != f->n_family))		   ||
	    (REQ(TYPE)    &&
	      (!AVAIL(TYPE)    || o->n_type != f->n_type))		   ||
	    (REQ(LLADDR)  &&
	      (!AVAIL(LLADDR)  || nl_addrcmp(&o->n_lladdr, &f->n_lladdr))) ||
	    (REQ(DST)     &&
	      (!AVAIL(DST)     || nl_addrcmp(&o->n_dst, &f->n_dst)))	   ||
	    (REQ(STATE)   &&
	      (!AVAIL(STATE)   || f->n_state ^
					(o->n_state & f->n_state_mask)))   ||
	    (REQ(FLAGS)   &&
	      (!AVAIL(FLAGS)   || f->n_flags ^
					(o->n_flags & f->n_flag_mask))))
		return 0;
#undef REQ
#undef AVAIL

	return 1;
}
コード例 #17
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *lisp_value (object_t * lst)
{
  DOC ("Get value stored in symbol.");
  REQ (lst, 1, c_sym ("value"));
  if (!SYMBOLP (CAR (lst)))
    THROW (wrong_type, c_cons (c_sym ("value"), CAR (lst)));

  return UPREF (GET (CAR (lst)));
}
コード例 #18
0
ファイル: pgen.c プロジェクト: 10sr/cpython
static void
compile_rule(nfagrammar *gr, node *n)
{
    nfa *nf;

    REQ(n, RULE);
    REQN(n->n_nchildren, 4);
    n = n->n_child;
    REQ(n, NAME);
    nf = addnfa(gr, n->n_str);
    n++;
    REQ(n, COLON);
    n++;
    REQ(n, RHS);
    compile_rhs(&gr->gr_ll, nf, n, &nf->nf_start, &nf->nf_finish);
    n++;
    REQ(n, NEWLINE);
}
コード例 #19
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *eq (object_t * lst)
{
  DOC ("Return t if both arguments are the same lisp object.");
  REQ (lst, 2, c_sym ("eq"));
  object_t *a = CAR (lst);
  object_t *b = CAR (CDR (lst));
  if (a == b)
    return T;
  return NIL;
}
コード例 #20
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *lisp_car (object_t * lst)
{
  DOC ("Return car element of cons cell.");
  REQ (lst, 1, c_sym ("car"));
  if (CAR (lst) == NIL)
    return NIL;
  if (!LISTP (CAR (lst)))
    THROW (wrong_type, CAR (lst));
  return UPREF (CAR (CAR (lst)));
}
コード例 #21
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *lisp_apply (object_t * lst)
{
  DOC ("Apply function to a list.");
  REQ (lst, 2, c_sym ("apply"));
  object_t *f = CAR (lst);
  object_t *args = CAR (CDR (lst));
  if (!LISTP (args))
    THROW (wrong_type, UPREF (args));
  return apply (f, args);
}
コード例 #22
0
ファイル: sccp_device.c プロジェクト: mehulsbhatt/voip-foip
void
sccp_dev_set_speaker(sccp_device_t * d, StationSpeakerMode mode)
{
  sccp_moo_t * r;
  if (!d->session)
    return;
  REQ(r, SetSpeakerModeMessage)
  r->msg.SetSpeakerModeMessage.speakerMode = mode;
  ast_verbose(VERBOSE_PREFIX_2 "{SetSpeakerModeMessage} speakerMode=%d\n", mode);
  sccp_dev_send(d, r);
}
コード例 #23
0
ファイル: sccp_device.c プロジェクト: mehulsbhatt/voip-foip
void
sccp_dev_set_microphone(sccp_device_t * d, StationMicrophoneMode opt)
{
  sccp_moo_t * r;
  if (!d->session)
    return;
  REQ(r, SetMicroModeMessage)
  r->msg.SetMicroModeMessage.micMode = opt;
  ast_verbose(VERBOSE_PREFIX_2 "{SetMicroModeMessage} micMode=%d\n", opt);
  sccp_dev_send(d, r);
}
コード例 #24
0
ファイル: pgen.c プロジェクト: 10sr/cpython
static void
compile_alt(labellist *ll, nfa *nf, node *n, int *pa, int *pb)
{
    int i;
    int a, b;

    REQ(n, ALT);
    i = n->n_nchildren;
    REQN(i, 1);
    n = n->n_child;
    REQ(n, ITEM);
    compile_item(ll, nf, n, pa, pb);
    --i;
    n++;
    for (; --i >= 0; n++) {
        REQ(n, ITEM);
        compile_item(ll, nf, n, &a, &b);
        addnfaarc(nf, *pb, a, EMPTY);
        *pb = b;
    }
}
コード例 #25
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *lisp_set (object_t * lst)
{
  DOC ("Store object in symbol.");
  REQ (lst, 2, c_sym ("set"));
  if (!SYMBOLP (CAR (lst)))
    THROW (wrong_type, c_cons (c_sym ("set"), CAR (lst)));
  if (CONSTANTP (CAR (lst)))
    THROW (c_sym ("setting-constant"), CAR (lst));

  SET (CAR (lst), CAR (CDR (lst)));
  return UPREF (CAR (CDR (lst)));
}
コード例 #26
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *lisp_concat (object_t * lst)
{
  DOC ("Concatenate two strings.");
  REQ (lst, 2, c_sym ("concat"));
  object_t *a = CAR (lst);
  object_t *b = CAR (CDR (lst));
  if (!STRINGP (a))
    THROW (wrong_type, UPREF (a));
  if (!STRINGP (b))
    THROW (wrong_type, UPREF (b));
  return str_cat (a, b);
}
コード例 #27
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *lisp_load (object_t * lst)
{
  DOC ("Evaluate contents of a file.");
  REQ (lst, 1, c_sym ("load"));
  object_t *str = CAR (lst);
  if (!STRINGP (str))
    THROW (wrong_type, UPREF (str));
  char *filename = OSTR (str);
  int r = load_file (NULL, filename, 0);
  if (!r)
    THROW (c_sym ("load-file-error"), UPREF (str));
  return T;
}
コード例 #28
0
ファイル: future.c プロジェクト: JupiterSmalltalk/openqwaq
static int
future_check_features(PyFutureFeatures *ff, node *n, const char *filename)
{
	int i;
	char *feature;
	node *ch, *nn;

	REQ(n, import_from);
	nn = CHILD(n, 3 + (TYPE(CHILD(n, 3)) == LPAR));
	if (TYPE(nn) == STAR) {
		PyErr_SetString(PyExc_SyntaxError, FUTURE_IMPORT_STAR);
		PyErr_SyntaxLocation(filename, nn->n_lineno);
		return -1;
	}
	REQ(nn, import_as_names);
	for (i = 0; i < NCH(nn); i += 2) {
		ch = CHILD(nn, i);
		REQ(ch, import_as_name);
		feature = STR(CHILD(ch, 0));
		if (strcmp(feature, FUTURE_NESTED_SCOPES) == 0) {
			continue;
		} else if (strcmp(feature, FUTURE_GENERATORS) == 0) {
			continue;
		} else if (strcmp(feature, FUTURE_DIVISION) == 0) {
			ff->ff_features |= CO_FUTURE_DIVISION;
		} else if (strcmp(feature, "braces") == 0) {
			PyErr_SetString(PyExc_SyntaxError,
					"not a chance");
			PyErr_SyntaxLocation(filename, CHILD(ch, 0)->n_lineno);
			return -1;
		} else {
			PyErr_Format(PyExc_SyntaxError,
				     UNDEFINED_FUTURE_FEATURE, feature);
			PyErr_SyntaxLocation(filename, CHILD(ch, 0)->n_lineno);
			return -1;
		}
	}
	return 0;
}
コード例 #29
0
ファイル: pgen.c プロジェクト: 10sr/cpython
static void
compile_item(labellist *ll, nfa *nf, node *n, int *pa, int *pb)
{
    int i;
    int a, b;

    REQ(n, ITEM);
    i = n->n_nchildren;
    REQN(i, 1);
    n = n->n_child;
    if (n->n_type == LSQB) {
        REQN(i, 3);
        n++;
        REQ(n, RHS);
        *pa = addnfastate(nf);
        *pb = addnfastate(nf);
        addnfaarc(nf, *pa, *pb, EMPTY);
        compile_rhs(ll, nf, n, &a, &b);
        addnfaarc(nf, *pa, a, EMPTY);
        addnfaarc(nf, b, *pb, EMPTY);
        REQN(i, 1);
        n++;
        REQ(n, RSQB);
    }
    else {
        compile_atom(ll, nf, n, pa, pb);
        if (--i <= 0)
            return;
        n++;
        addnfaarc(nf, *pb, *pa, EMPTY);
        if (n->n_type == STAR)
            *pb = *pa;
        else
            REQ(n, PLUS);
    }
}
コード例 #30
0
ファイル: lisp.c プロジェクト: qyqx/wisp
object_t *lisp_read_string (object_t * lst)
{
  DOC ("Parse a string into a sexp or list object.");
  REQ (lst, 1, c_sym ("eval-string"));
  object_t *stro = CAR (lst);
  if (!STRINGP (stro))
    THROW (wrong_type, UPREF (stro));
  char *str = OSTR (stro);
  reader_t *r = reader_create (NULL, str, "eval-string", 0);
  object_t *sexp = read_sexp (r);
  reader_destroy (r);
  if (sexp == err_symbol)
    THROW (c_sym ("parse-error"), UPREF (stro));
  return sexp;
}