示例#1
0
  EXTERNAL_LIST_LOOP (path_entry, path)
    {
      /* Verify that DESC describes a menu, not single item */
      if (!CONSP (desc))
	RETURN_UNGCPRO (Qnil);

      /* Parse this menu */
      desc = menu_parse_submenu_keywords (desc, gui_item);

      /* Check that this (sub)menu is active */
      if (!gui_item_active_p (gui_item))
	RETURN_UNGCPRO (Qnil);

      /* Apply :filter */
      if (!NILP (pgui_item->filter))
	desc = call1 (pgui_item->filter, desc);

      /* Find the next menu on the path inside this one */
      EXTERNAL_LIST_LOOP (submenu_desc, desc)
	{
	  submenu = XCAR (submenu_desc);
	  if (CONSP (submenu)
	      && STRINGP (XCAR (submenu))
	      && !NILP (Fstring_equal (XCAR (submenu), XCAR (path_entry))))
	    {
	      desc = submenu;
	      goto descend;
	    }
	}
示例#2
0
int main(int argc, char *argv[])
{
    call0();
    call1();
    call2(0,0,0,0,0,0,0,0,0);
    call3();
    call4();
}
示例#3
0
文件: filelock.c 项目: mmaruska/emacs
void
lock_file (Lisp_Object fn)
{
  register Lisp_Object attack, orig_fn, encoded_fn;
  register char *lfname, *locker;
  lock_info_type lock_info;
  struct gcpro gcpro1;

  /* Don't do locking while dumping Emacs.
     Uncompressing wtmp files uses call-process, which does not work
     in an uninitialized Emacs.  */
  if (! NILP (Vpurify_flag))
    return;

  orig_fn = fn;
  GCPRO1 (fn);
  fn = Fexpand_file_name (fn, Qnil);
  encoded_fn = ENCODE_FILE (fn);

  /* Create the name of the lock-file for file fn */
  MAKE_LOCK_NAME (lfname, encoded_fn);

  /* See if this file is visited and has changed on disk since it was
     visited.  */
  {
    register Lisp_Object subject_buf;

    subject_buf = get_truename_buffer (orig_fn);

    if (!NILP (subject_buf)
	&& NILP (Fverify_visited_file_modtime (subject_buf))
	&& !NILP (Ffile_exists_p (fn)))
      call1 (intern ("ask-user-about-supersession-threat"), fn);

  }
  UNGCPRO;

  /* Try to lock the lock. */
  if (lock_if_free (&lock_info, lfname) <= 0)
    /* Return now if we have locked it, or if lock creation failed */
    return;

  /* Else consider breaking the lock */
  locker = (char *) alloca (strlen (lock_info.user) + strlen (lock_info.host)
			    + LOCK_PID_MAX + 9);
  sprintf (locker, "%s@%s (pid %lu)", lock_info.user, lock_info.host,
           lock_info.pid);
  FREE_LOCK_INFO (lock_info);

  attack = call2 (intern ("ask-user-about-lock"), fn, build_string (locker));
  if (!NILP (attack))
    /* User says take the lock */
    {
      lock_file_1 (lfname, 1);
      return;
    }
  /* User says ignore the lock */
}
示例#4
0
static void
mswindows_finish_init_device (struct device *d,
			      Lisp_Object UNUSED (props))
{
#ifdef HAVE_DRAGNDROP
  /* Tell pending clients we are ready. */
  mswindows_dde_enable = 1;
#endif
  call1 (Qmake_device_late_mswindows_entry_point, wrap_device(d));
}
示例#5
0
boost::function<int (int, int)> linear(const int& slope) {
    int BOOST_LOCAL_FUNCTION(const bind& slope,
            int x, default 1, int y, default 2) {
        return x + slope * y;
    } BOOST_LOCAL_FUNCTION_NAME(lin)

    boost::function<int (int, int)> f = lin; // Assign to local variable.
    BOOST_TEST(f(1, 2) == 5);

    call1(lin); // Pass to other functions.
    call0(lin);

    return lin; // Return.
}
示例#6
0
void
main (void)
{

  call1 (uchar0);
  call2 (uint0);
  uchar1 = call3 ();
  uint1 = call4 ();
  if (uint1)
    failures++;

  uint1 = call5 (uint0);
  if (uint1)
    failures++;

  if(call6(uchar0))
    failures++;


  if(call7(0))
    failures++;

  if(!call7(1))
    failures++;

  if(!call7(0xff00))
    failures++;

  uchar0=4;
  uchar1=3;
  uchar0 = call8(uchar0,uchar1);

  if(uchar0 != 7)
    failures++;

  call9(0x1234,0x5678);

  done ();
}
示例#7
0
文件: avail.c 项目: fuzzie/slcore
sl_def(do_test, void)
{
#define x values[p].d
#define xf values[p].f
#define y values[p+1].d
#define yf values[p+1].f
#define n values[p+2].i
#define nl values[p+2].l

#define call1(F)                                 \
  values[p].desc = #F;                           \
  values[p].d = F(x);                            \
  ++p;                                           \
  values[p].desc = #F "f";                       \
  values[p].f = F ## f (xf);                     \
  ++p


#define call1i(F)				\
  values[p].desc = #F;				\
  values[p].i = F(x);                           \
  ++p

#define call2(F)                                  \
  values[p].desc = #F;                            \
  values[p].d = F(x, y);                          \
  p += 2;                                         \
  values[p].desc = #F "f";                        \
  values[p].f = F ## f (xf, yf);                  \
  p += 2

#define call2i(F)                                 \
  values[p].desc = #F;                            \
  values[p].i = F(x, y);                          \
  p += 2;                                         \
  values[p].desc = #F "f";                        \
  values[p].i = F(xf, yf);                        \
  p += 2

  /* classify */
  call1i(fpclassify);
  call1i(signbit);
  call1i(isfinite);
  call1i(isnormal);
  call1i(isnan);
  call1i(isinf);

  /* trig */
  call1(acos);
  call1(asin);
  call1(atan);
  call2(atan2);
  call1(cos);
  call1(sin);
  call1(tan);

  /* hyperbolic */
  call1(acosh);
  call1(asinh);
  call1(atanh);
  call1(cosh);
  call1(sinh);
  call1(tanh);

  /* exp/log */
  call1(exp);
  call1(exp2);
  call1(expm1);

  values[p].desc = "frexp";
  values[p].d = frexp(x, &values[p+1].i);
  p += 2;

  values[p].desc = "frexpf";
  values[p].f = frexpf(xf, &values[p+1].i);
  p += 2;

  values[p].desc = "ilogb";
  values[p].i = ilogb(x); p++;
  values[p].desc = "ilogbf";
  values[p].i = ilogbf(xf); p++;

  values[p].desc = "ldexp";
  values[p].d = ldexp(x, n); p+=3;
  values[p].desc = "ldexpf";
  values[p].f = ldexpf(xf, n); p+=3;

  call1(log);
  call1(log10);
  call1(log1p);
  call1(log2);
  call1(logb);

  values[p].desc = "modf";
  values[p].d = modf(x, &y); 
  p += 2;

  values[p].desc = "modff";
  values[p].f = modff(xf, &yf);
  p += 2;

  values[p].desc = "scalbn";
  values[p].d = scalbn(x, n); p+=3;
  values[p].desc = "scalbnf";
  values[p].f = scalbnf(xf, n); p+=3;

  values[p].desc = "scalbln";
  values[p].d = scalbln(x, nl); p+=3;
  values[p].desc = "scalblnf";
  values[p].f = scalblnf(xf, nl); p+=3;

  /* power/abs */

  call1(cbrt);
  call1(fabs);
  call2(hypot);
  call2(pow);
  call1(sqrt);

  /* error/gamma */
  call1(erf);
  call1(erfc);
  call1(lgamma);
  call1(tgamma); 
  call1(ceil);
  call1(floor);
  call1(nearbyint);
  call1(rint);
  call1(lrint);

  values[p].desc = "lrint";
  values[p].l = lrint(x); p++;
  values[p].desc = "lrintf";
  values[p].l = lrintf(xf); p++;
  values[p].desc = "llrint";
  values[p].ll = llrint(x); p++;
  values[p].desc = "llrintf";
  values[p].ll = llrintf(xf); p++;

  call1(round);

  values[p].desc = "lround";
  values[p].l = lround(x); p++;
  values[p].desc = "lroundf";
  values[p].l = lroundf(xf); p++;
  values[p].desc = "llround";
  values[p].ll = llround(x); p++;
  values[p].desc = "llroundf";
  values[p].ll = llroundf(xf); p++;

  call1(trunc);

  /* rem/mod */
  call2(fmod);
  call2(remainder);

  values[p].desc = "remquo";
  values[p].d = remquo(x, y, &values[p+1].i); p+=2;
  values[p].desc = "remquof";
  values[p].f = remquof(xf, yf, &values[p+1].i); p+=2;

  call2(copysign);

  /* nan */

  values[p].desc = "nan";
  values[p].d = nan(""); ++p;
  values[p].desc = "nanf";
  values[p].f = nanf(""); ++p;

  call2(nextafter);

  /* min/max/dim */
  call2(fdim);
  call2(fmax);
  call2(fmin);
  values[p].desc = "fma";
  values[p].d = fma(x, y, values[p+2].d); p+=3;
  values[p].desc = "fmaf";
  values[p].d = fmaf(xf, yf, values[p+2].f); p+=3;

  /* comp */
  call2i(isgreater);
  call2i(isgreaterequal);
  call2i(isless);
  call2i(islessequal);
  call2i(islessgreater);
  call2i(isunordered);

#undef x
#undef xf
#undef y
#undef n
}
示例#8
0
void test_stacktrace(void)
{
	printk("********** Testing stacktrace **********\r\n");
	call1();
}
示例#9
0
int main(int argc, char* argv[])
{
    std::shared_ptr<Empty> blank;
    std::shared_ptr<Program> prg(new Program());

    std::shared_ptr<SharedDecl> shDecl1(new SharedDecl("y", blank));
    prg->Add(shDecl1);

    std::shared_ptr<Node> initX(new Atom("2"));
    std::shared_ptr<SharedDecl> shDecl2(new SharedDecl("x", initX));
    prg->Add(shDecl2);

    std::shared_ptr<Sub> sub1(new Sub("Main"));
    sub1->AddParam("a");
    sub1->AddParam("b");
    prg->Add(sub1);

    std::shared_ptr<Atom> atomA(new Atom("a"));
    std::shared_ptr<Atom> atomB(new Atom("b"));
    std::shared_ptr<BinaryOp> initRes(new BinaryOp("add", atomA, atomB));
    std::shared_ptr<VarDecl> resDecl(new VarDecl("res", initRes));
    sub1->Add(resDecl);

    std::shared_ptr<Atom> atom3i(new Atom("3"));
    std::shared_ptr<Atom> atom5i(new Atom("5"));
    std::shared_ptr<BinaryOp> newParam(new BinaryOp("add", atom3i, atom5i));
    std::shared_ptr<Allocation> allocat(new Allocation(newParam));
    std::shared_ptr<Atom> atomArr(new Atom("arr"));
    std::shared_ptr<Assignation> asignNew3(new Assignation(atomArr, allocat));
    sub1->Add(asignNew3);

    std::shared_ptr<Atom> atomArrBis(new Atom("arr"));
    std::shared_ptr<Deallocation> deallocat(new Deallocation(atomArrBis));
    sub1->Add(deallocat);

    std::shared_ptr<Atom> atomC(new Atom("res"));
    std::shared_ptr<BinaryOp> subCsumAB(new BinaryOp("substract", atomC, initRes));
    std::shared_ptr<Assignation> incC(new Assignation(atomC, subCsumAB));
    sub1->Add(incC);

    std::shared_ptr<Atom> atom0(new Atom("0"));
    std::shared_ptr<BinaryOp> cond1cond(new BinaryOp("equals", atomC, atom0));
    std::shared_ptr<If> cond1(new If(cond1cond, "10", "20"));
    sub1->Add(cond1);

    std::shared_ptr<Atom> atom1(new Atom("1"));
    std::shared_ptr<Atom> atom10(new Atom("10"));
    std::shared_ptr<For> for1(new For("i", atom1, atom10, atom1));
    sub1->Add(for1);

    std::shared_ptr<BinaryOp> addC1(new BinaryOp("add", atomC, atom1));
    std::shared_ptr<Assignation> incResActually(new Assignation(atomC, addC1));
    for1->Add(incResActually);

    std::shared_ptr<Loop> loop1(new Loop(cond1cond));
    loop1->Add(for1); // don't double reference ever in practice...
    loop1->Add(addC1);
    sub1->Add(loop1);

    std::shared_ptr<Call> call1(new Call("testFun", ""));
    call1->AddParam(atomA);
    call1->AddParam(addC1);
    sub1->Add(call1);

    std::shared_ptr<Return> ret1(new Return(atom0));
    sub1->Add(ret1);

    XMLDumpVisitor v;
    prg->Accept(&v);

    return 0;
}
示例#10
0
 void call2(void) {
     LOG(INFO) << "Calling call1()";
     call1();
 }
ClientBackgroundManager::ClientBackgroundManager(QWidget *parent)
    : QWidget(parent)
{
    serverIpLabel = new QLabel(tr("&Server IP:"));
    loginLabel = new QLabel(tr("&Login:"******"&Password:"******"89.103.183.36"));
    loginEdit = new QLineEdit(tr("client"));
    passwdEdit = new QLineEdit(tr(""));
    passwdEdit->setEchoMode(QLineEdit::Password);

    serverIpLabel->setBuddy(serverIpEdit);
    loginLabel->setBuddy(loginEdit);
    passwdLabel->setBuddy(passwdEdit);

    loginButton = new QPushButton(tr("Login"));
    loginButton->setEnabled(false);

    registerButton = new QPushButton(tr("Register"));
    registerButton->setEnabled(false);

    listHeaderlabel = new QLabel(tr("Seznam online klientu"));
    listHeaderlabel->setEnabled(false);

    myNewWidget = new QWidget();
    insideArea = new QVBoxLayout(myNewWidget);
    myNewWidget->setLayout(insideArea);

    logoutButton = new QPushButton(tr("Logout"));
    logoutButton->setDefault(false);
    logoutButton->setEnabled(false);

    quitButton = new QPushButton(tr("Quit"));
    quitButton->setDefault(false);
    quitButton->setEnabled(false);

    connect(serverIpEdit, SIGNAL(textChanged(QString)), this,
            SLOT(enableSubmitButton()));
    connect(loginEdit, SIGNAL(textChanged(QString)), this,
            SLOT(enableSubmitButton()));
    connect(loginButton, SIGNAL(clicked()), this, SLOT(initLogin()));
    connect(registerButton, SIGNAL(clicked()), this, SLOT(initRegister()));
    connect(logoutButton, SIGNAL(clicked()), this, SLOT(logout()));
    connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));

    //to server
    connect(this, SIGNAL(sendDataToServer(MessageEnvelop&)),
            &myClient2ServerThread, SLOT(sendMessageToServer(MessageEnvelop&)), Qt::DirectConnection);
    //from server
    connect(&myClient2ServerThread, SIGNAL(error(int, QString)),
            this, SLOT(displayError(int, QString)));
    connect(&myClient2ServerThread, SIGNAL(clientList(const QList<QString>)),
            this, SLOT(displayClientList(const QList<QString>)), Qt::DirectConnection);
    connect(&myClient2ServerThread,
            SIGNAL(incommingCall(const QString, const QHostAddress, const quint16, const quint16)),
            this, SLOT(incommingCall(const QString, const QHostAddress, const quint16, const quint16)),
            Qt::DirectConnection);
    connect(&myClient2ServerThread,
            SIGNAL(successResponseCall(const QString, const QHostAddress, const quint16, const quint16)),
            this, SLOT(successResponseCall(const QString, const QHostAddress, const quint16, const quint16)),
            Qt::DirectConnection);

    /*test*/callAnotherClient1 = new QPushButton(tr("call 1. client"));
    /*test*/callAnotherClient1->setDefault(true);
    /*test*/callAnotherClient1->setEnabled(true);
    /*test*/callAnotherClient2 = new QPushButton(tr("call 2. client"));
    /*test*/callAnotherClient2->setDefault(true);
    /*test*/callAnotherClient2->setEnabled(true);
    /*test*/connect(callAnotherClient1, SIGNAL(clicked()), this, SLOT(call1()));
    /*test*/connect(callAnotherClient2, SIGNAL(clicked()), this, SLOT(call2()));


    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->addWidget(serverIpLabel, 0, 0);
    mainLayout->addWidget(serverIpEdit, 0, 1);
    mainLayout->addWidget(loginLabel, 1, 0);
    mainLayout->addWidget(loginEdit, 1, 1);
    mainLayout->addWidget(passwdLabel, 2, 0);
    mainLayout->addWidget(passwdEdit, 2, 1);
    mainLayout->addWidget(loginButton, 3, 0);
    mainLayout->addWidget(registerButton, 3, 1);

    mainLayout->addWidget(listHeaderlabel, 4, 0);
    mainLayout->addWidget(myNewWidget, 5, 0);
    /*test*/mainLayout->addWidget(callAnotherClient1, 6, 0);
    /*test*/mainLayout->addWidget(callAnotherClient2, 6, 1);
    mainLayout->addWidget(logoutButton, 7, 0);
    mainLayout->addWidget(quitButton, 7, 1);

    setLayout(mainLayout);


    setWindowTitle(tr("Penguin Client"));
    serverIpEdit->setFocus();
}