Beispiel #1
0
void
fn2 (void *p1)
{
  int a[7];
  float *b;
  int c, n;

  if (c != p1) /* { dg-warning "comparison between pointer and integer" } */
    fn1 (1);

  n = 0;
  for (; c; n++)
    {
      int d;
      if (a[n] != d)
	fn1(n);
    }

  b = p1;

  while (1)
    {
      *b = 3.40282347e38f;
      if (a[0])
	return;
    }
}
Beispiel #2
0
double getL(double *L1){
  int a,b,c,d,i,r;
  double L,la,la1,mu,mu1,d1,d2;
  L=prior(pa,L1);
  for(r=0;r<nr;r++){
    a=res[r][0];b=res[r][1];c=res[r][2];d=res[r][3];
    la=fn(al[a]-be[b]+hh[0]);
    la1=fn1(al[a]-be[b]+hh[0]);
    //la2=fn2(al[a]-be[b]+hh[0]);
    mu=fn(al[b]-be[a]-hh[1]);
    mu1=fn1(al[b]-be[a]-hh[1]);
    //mu2=fn2(al[b]-be[a]-hh[1]);
    L+=-la+c*log(la)-lfac[c]-mu+d*log(mu)-lfac[d];
    //L+=-log(phg[c])-log(pag[d]);
    //if(it==5000)printf("%12g --> %d\n%12 --> %d\n",la,c,mu,d);
    L1[a]+=(-1+c/la)*la1;
    L1[b]+=(-1+d/mu)*mu1;
    L1[nt+a]-=(-1+d/mu)*mu1;
    L1[nt+b]-=(-1+c/la)*la1;
    L1[2*nt]+=(-1+c/la)*la1;
    L1[2*nt+1]-=(-1+d/mu)*mu1;
  }
  d1=d2=0;
  for(i=0;i<nt;i++){d1+=L1[i];d2+=L1[nt+i];}
  for(i=0;i<nt;i++){L1[i]-=d1/nt;L1[nt+i]-=d2/nt;}
  return L;
}
Beispiel #3
0
int
main ()
{
  int i;
  char buf[64], buf2[64];
  for (i = 0; i < 5; i++)
    {
      const char *p = "abcdefghijklmnop" + (i < 3 ? i : 3) * 4;
      const char *q;
      q = fn1 (i, 1);
      if (memcmp (q - 4, p, 4) != 0 || q[0] != '\0')
	abort ();
      q = fn1 (i, 0);
      if (memcmp (q - 3, p, 4) != 0 || q[1] != '\0')
	abort ();
    }
  memset (buf, '\0', sizeof buf);
  memset (buf + 4, 'z', 2);
  if (fn2 (buf, buf2) != 6
      || memcmp (buf, "abcdzz", 7) != 0
      || memcmp (buf2, "abcdzz", 7) != 0)
    abort ();
  memset (buf, '\0', sizeof buf);
  memset (buf + 4, 'z', 2);
  if (fn3 (buf) != buf + 6 || memcmp (buf, "abcdzzefgh", 11) != 0)
    abort ();
  return 0;
}
Beispiel #4
0
int
main ()
{
  volatile int l = 1;
  char b[64];

  if (memcmp (fn1 (l) - 1, "a", 2) != 0)
    abort ();
  if (memcmp (fn1 (!l) - 2, "bc", 3) != 0)
    abort ();
  if (fn2 (l) != 1 || fn2 (!l) != 3)
    abort ();
  memset (b, '\0', sizeof b);
  memset (b, 'a', 3);
  if (fn3 (b, 10) != 4 || memcmp (b, "aaaabcd", 8) != 0)
    abort ();
  if (fn3 (b, 128) != 7 || memcmp (b, "aaaabcdabcdefg", 15) != 0)
    abort ();
  if (fn3 (b, 256) != 10 || memcmp (b, "aaaabcdabcdefgabcdefgefg", 25) != 0)
    abort ();
  if (fn4 (b, 10) != 4
      || memcmp (b, "aaaabcdabcdefgabcdefgefgabcd", 29) != 0
      || memcmp (buf, "aaaabcdabcdefgabcdefgefg", 25) != 0)
    abort ();
  if (fn4 (b, 128) != 4
      || memcmp (b, "aaaabcdabcdefgabcdefgefgabcdabcd", 33) != 0
      || memcmp (buf, "aaaabcdabcdefgabcdefgefgabcdefg", 32) != 0)
    abort ();
  if (fn4 (b, 256) != 4
      || memcmp (b, "aaaabcdabcdefgabcdefgefgabcdabcdabcd", 37) != 0
      || memcmp (buf, "aaaabcdabcdefgabcdefgefgabcdabcdefgefg", 39) != 0)
    abort ();
  return 0;
}
Beispiel #5
0
static void testBindValue()
{
   CppTL::Functor2R<int,int,int> fn2 = CppTL::cfn2r( &multiply );
   CppTL::Functor1R<int,int> fn1 = CppTL::fn1r( CppTL::bind2r( fn2, 3 ) );
   CPPUT_ASSERT_EQUAL( 2*3, fn1(2) );
   CPPUT_ASSERT_EQUAL( 5*3, fn1(5) );
}
Beispiel #6
0
int main ()
{
  int i;
  i = 0;
  for (;; i++)
    if (*fn1 ()[i] && !'a' <= 0 && i <= 'z' || *fn1 ()[0] && 'a' <= 'z')
      return 0;
}
Beispiel #7
0
int
main (void)
{
  if (fn1 (3, 3) != 0)
    __builtin_abort ();

  if (fn1 (6, 7) != -1)
    __builtin_abort ();
}
Beispiel #8
0
void fn2(void)
{
    int g;
    for (; b; --b) {
        int *h = 0;
        int f = fn1(c);
        *h &= f;
        e;
        *h &= *d = fn1(a);
    }
    int *i[930] = { &g };
}
Beispiel #9
0
int
main ()
{
  int l[5] = { 0 };
  fn1 (b);
  for (c = 0; c < 3; c++)
    for (g = 0; g < 3; g++)
      l[c * 2] = e = l[c];
  if (f)
    fn1 (b);
  return 0;
}
Beispiel #10
0
int
main ()
{
  int i;
  for (i = 0; i < 5; i++)
    {
      const char *p = "abcdefghijklmnop" + (i < 3 ? i : 3) * 4;
      const char *q;
      fn1 (i ? 0 : 1, 1, 1);
      q = fn1 (i, 0, 0);
      if (memcmp (q, p + 1, 3) != 0 || memcmp (q + 3, "RST", 4) != 0)
	abort ();
      fn1 (i ? 0 : 1, 0, 1);
      q = fn1 (i, 1, 0);
      if (memcmp (q, p, 4) != 0 || memcmp (q + 4, "HIJKLMN", 8) != 0)
	abort ();
      fn1 (i ? 0 : 1, 1, 0);
      q = fn1 (i, 0, 1);
      if (memcmp (q, p + 1, 3) != 0 || memcmp (q + 3, "OPQ", 4) != 0)
	abort ();
      fn1 (i ? 0 : 1, 0, 0);
      q = fn1 (i, 1, 1);
      if (memcmp (q, p, 4) != 0 || memcmp (q + 4, "ABCDEFG", 8) != 0)
	abort ();
    }
  return 0;
}
Beispiel #11
0
int
main (void)
{
  a = ONE;
  b = 1;
  if (fn1 () != ONE)
    __builtin_abort ();

  a = TWO;
  b = 0;
  if (fn1 () != 0)
    __builtin_abort ();

  return 0;
}
Beispiel #12
0
void
foo (T x)
{
  int a, b, c, d, e;
  T f, g;
  S h;
  a = x->t2;
  fn1 (x->t1);
  h = bar (b);
  c = fn1 (e);
  d = fn3 ();
  f->t3 &= g->t3 |= fn2 (0, b, x->t1);
  fn2 (0, c, d);
  fn2 (0, e, 0);
}
CDialogPromptNewerFile::CDialogPromptNewerFile(
  wxWindow *parent, const wxString &sFileName, const wxString &sNewest) :
    wxDialog(
      parent,wxID_ANY,"Newer file available",
      wxDefaultPosition, wxDefaultSize,
      mainApp::DIALOG_STYLE)
{
  wxFileName fn1(sFileName);
  wxFileName fn2(sNewest);

  wxString sPrompt;
  const wxChar *ButtonText[4] = 
  {
    wxS("Open the newer file"),        // yes
		wxS("Open the selected file"),     // no
		wxS("Do not open either file"),    // cancel
		wxS("View folder before deciding") // view
  };
  SetupURL(fn2);
  sPrompt.Alloc(1024);
  sPrompt = "The folder containing the selected file,\n  ";
  sPrompt.Append(fn1.GetFullName());
  sPrompt.Append("\n");
  AFTER_FILE_NAMES(sPrompt,fn2.GetFullName());
  Setup(sPrompt,ButtonText);
}
Beispiel #14
0
void FileFunctionsTestCase::FindFileNext()
{
    // Construct file name containing ASCII characters only.
    const wxString fileMask(wxT("horse.*"));

    // Check using method 1.
    wxString foundFile1 = wxFindFirstFile(fileMask, wxFILE);
    wxString foundFile2 = wxFindNextFile();
    wxFileName fn1(foundFile1);
    wxFileName fn2(foundFile2);
    // Full names must be different.
    CPPUNIT_ASSERT( foundFile1 != foundFile2 );
    // Base names must be the same.
    CPPUNIT_ASSERT( fn1.GetName() == fn2.GetName() );

    // Check using method 2.
    wxFileSystem fs;
    wxString furl = fs.FindFirst(fileMask, wxFILE);
    fn1 = wxFileSystem::URLToFileName(furl);
    foundFile1 = fn1.GetFullPath();
    furl = fs.FindNext();
    fn2 = wxFileSystem::URLToFileName(furl);
    foundFile2 = fn2.GetFullPath();
    // Full names must be different.
    CPPUNIT_ASSERT( fn1.GetFullPath() != fn2.GetFullPath() );
    // Base names must be the same.
    CPPUNIT_ASSERT( fn1.GetName() == fn2.GetName() );
}
Beispiel #15
0
void t_string(void)
{
	const char string[] = "Hello world!";
	KHT_DEFINE_HASH_FN(fn1, strlen(ptr));
	KHT_DEFINE_HASH_FN(fn2, sizeof(string)-1);
	TEST_FAIL_IF(fn1(string) != fn2(string));
}
Beispiel #16
0
void fn2 ()
{
    do
          while (fn1 ())
	          ;
      while (1);
}
Beispiel #17
0
DbHeaderListItem::DbHeaderListItem(QTreeWidget* parent, const QString& key)
    : QObject(parent),
      QTreeWidgetItem(parent)
{
    // Reset all item flags: item is not selectable.
    setFlags(Qt::ItemIsEnabled);

    setDisabled(false);
    setExpanded(true);

    setFirstColumnSpanned(true);
    setTextAlignment(0, Qt::AlignCenter);
    QFont fn0(font(0));
    fn0.setBold(true);
    fn0.setItalic(false);
    setFont(0, fn0);
    QFont fn1(font(1));
    fn1.setBold(true);
    fn1.setItalic(false);
    setFont(1, fn1);
    setText(0, key);
    slotThemeChanged();

    connect(ThemeManager::instance(), SIGNAL(signalThemeChanged()),
            this, SLOT(slotThemeChanged()));
}
Beispiel #18
0
NO_INLINE int
fn2 (void)
{
  fn1 ();
  /* Prevent tail calls.  */
  return x;
}
Beispiel #19
0
static inline struct S *
fn3 (struct S *x)
{
  if (x->c != 6)
    fn1 (0);
  return (struct S *) x;
}
Beispiel #20
0
int
main ()
{
  for (; a; a--)
    {
      int l = 0;
      if (f >= 0)
	{
	  for (; h;)
	    e = 0;
	  for (; l != -6; l--)
	    {
	      j = fn1 (b--, d);
	      for (g = 0; g; g = 1)
		;
	      k = e ? 2 : 0;
	    }
	  i = 0;
	  for (;;)
	    ;
	}
    }
  d = 0;
  return 0;
}
Beispiel #21
0
int main(void)
{
  printf("Entering 100 iterations of incrementing pose X and Y and decrementing Theta...");
  for (int i = 0; i < 100; i++)
    fn2(fn1());

  printf("\nTesting ArPose::operator+(const ArPose&) and ArPose::operator-(const ArPose&)...\n");
  ArPose p1(10, 10, 90);
  ArPose p2(10, 10, 45);
  ArPose p3(0, 0, 0);
  ArPose p4(-20, 0, 360);
  ArPose p5(-20, -20, -180);
  printf("(10,10,90) + (10,10,90) => ");
  (p1 + p1).log();
  printf("(10,10,90) - (10,10,90) => ");
  (p1 - p1).log();
  printf("(10,10,90) + (10,10,45) => ");
  (p1 + p2).log();
  printf("(10,10,90) + (0,0,0) => ");
  (p1 + p3).log();
  printf("(10,10,90) - (0,0,0) => ");
  (p1 - p3).log();
  printf("(0,0,0) + (-20,0,360) => ");
  (p3 + p4).log();
  printf("(0,0,0) - (-20,0,360) => ");
  (p3 - p4).log();
  printf("(10,10,90) + (-20,0,360) => ");
  (p1 + p4).log();
  printf("(-20,0,360) + (-20,0,360) => ");
  (p4 + p4).log();
  printf("(-20,-20,-180) - (10,10,45) => ");
  (p5 - p2).log();

}
Beispiel #22
0
void FileFunctionsTestCase::setUp()
{
    // Under Unix we need to use UTF-8 for the tests using non-ASCII filenames
    // and this is not necessarily the case because the tests don't call
    // setlocale(LC_ALL, ""), so ensure it explicitly. This is just a temporary
    // hack until we find the solution to make the library work with Unicode
    // filenames irrespectively of the current locale.
#ifndef __DARWIN__
    m_convFNOld = wxConvFileName;
    wxConvFileName = &wxConvUTF8;
#endif

    // Initialize local data

    wxFileName fn1(wxFileName::GetTempDir(), wxT("wx_file_mask.txt"));
    m_fileNameASCII = fn1.GetFullPath();

    // This file name is 'wx_file_mask.txt' in Russian.
    wxFileName fn2(wxFileName::GetTempDir(),
      wxT("wx_\u043C\u0430\u0441\u043A\u0430_\u0444\u0430\u0439\u043B\u0430.txt"));
    m_fileNameNonASCII = fn2.GetFullPath();

    wxFileName fn3(wxFileName::GetTempDir(), wxT("wx_test_copy"));
    m_fileNameWork = fn3.GetFullPath();
}
Beispiel #23
0
int main( void )
{
    unsigned long   ul = 0xCCCCCCCC;
    void            *pv = NULL;

    x1 = test1;
    x1( 1, 2, 3, 4, 5 );
    if( res[0] != 1 ) fail( __LINE__ );
    if( res[1] != 2 ) fail( __LINE__ );
    if( res[2] != 3 ) fail( __LINE__ );
    if( res[3] != 4 ) fail( __LINE__ );
    if( res[4] != 5 ) fail( __LINE__ );
    x2 = test1;
    x2( 1, 2, 3, 4, 5 );
    if( res[0] != 1 ) fail( __LINE__ );
    if( res[1] != 2 ) fail( __LINE__ );
    if( res[2] != 3 ) fail( __LINE__ );
    if( res[3] != 4 ) fail( __LINE__ );
    if( res[4] != 5 ) fail( __LINE__ );
    x3 = test2;
    x3( 1, 2, 3, 4, 5 );
    if( res[0] != 1 ) fail( __LINE__ );
    if( res[1] != 2 ) fail( __LINE__ );
    if( res[2] != 3 ) fail( __LINE__ );
    if( res[3] != 4 ) fail( __LINE__ );
    if( res[4] != 5 ) fail( __LINE__ );
    if( !fn1( ul, 0x55AA ) ) fail( __LINE__ );
    if( !fn2( pv, 0x55AA ) ) fail( __LINE__ );
    _PASS;
}
Beispiel #24
0
int main(void)
{
	for (int i = 0; i < 42; i++)
		fn1(1);

	return 0;
}
Beispiel #25
0
int main() {
    for (; a;) {
        b = fn1(a);
    }

    return 0;
}
Beispiel #26
0
int main(void)
{
	a = fn1(2);
	a = fn2(a);

	return 0;
}
Beispiel #27
0
int main() {
    int b[4][4];
    globali = 4;
    fn1();
    fn2(global);
    fn3(2, b,b);
}
Beispiel #28
0
void
fn2 (T *x)
{
    if (x)
        x->~T();
    fn1 (x);
}
Beispiel #29
0
void fn2(void) {
  struct callchain_cursor *b = &a;
  while (1) {
    fn3();
    fn1(b);
  }
}
Beispiel #30
0
int *
fn2 (int i)
{
  int *p = i;
  p = i;
  fn1 (i);
  return i;
}