Add mes and mescc-tools-extra

mescc-tools-extra contains two important tools:
- cp
- chmod

mes first builds itself from a mes 0.21 seed as used by guix, and then
builds a mes 0.22 and then mes 0.22 using that created mes 0.22.

It does /not/ use bootstrap.sh as we don't have a proper shell at this
point, it has been manually adapted for kaem.
This commit is contained in:
fosslinux 2020-12-25 18:40:14 +11:00
parent 2706e07556
commit 649d7b68dc
1029 changed files with 120985 additions and 18 deletions

View file

@ -0,0 +1,38 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <assert.h>
#include <stdio.h>
int
main ()
{
int f;
puts ("\n");
puts ("t: assert (1) ?\n");
assert (1);
puts ("t: assert (f==0) ?\n");
assert (f == 0);
return 0;
}

View file

@ -0,0 +1,129 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <dirent.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
int dot_seen = 0;
int dot_dot_seen = 0;
int dir_seen = 0;
int file_seen = 0;
int link_seen = 0;
void
check_seen (char const* name)
{
if (!strcmp (name, "."))
dot_seen = 1;
if (!strcmp (name, ".."))
dot_dot_seen = 1;
if (!strcmp (name, "dir"))
dir_seen = 1;
if (!strcmp (name, "file"))
file_seen = 1;
if (!strcmp (name, "link"))
link_seen = 1;
}
int
main ()
{
DIR *d = opendir ("../lib/tests/dirent/readdir-fu");
if (d)
return 1;
if (errno != ENOENT)
return 2;
d = opendir ("../lib/tests/dirent/90-readdir.c");
if (d)
return 3;
if (errno != ENOTDIR)
return 4;
errno = 0;
d = opendir ("../lib/tests/dirent/readdir.dir");
if (!d)
return 5;
if (errno)
return 6;
int i = 0;
struct dirent *entry = readdir (d);
if (!entry)
return 7;
oputs (entry->d_name);
oputs ("\n");
check_seen (entry->d_name);
entry = readdir (d);
if (!entry)
return 8;
oputs (entry->d_name);
oputs ("\n");
check_seen (entry->d_name);
entry = readdir (d);
if (!entry)
return 9;
oputs (entry->d_name);
oputs ("\n");
check_seen (entry->d_name);
entry = readdir (d);
if (!entry)
return 10;
oputs (entry->d_name);
oputs ("\n");
check_seen (entry->d_name);
entry = readdir (d);
if (!entry)
return 11;
oputs (entry->d_name);
oputs ("\n");
check_seen (entry->d_name);
entry = readdir (d);
if (entry)
return 12;
if (!dot_seen)
return 13;
if (!dot_dot_seen)
return 14;
if (!dir_seen)
return 15;
if (!file_seen)
return 16;
if (!link_seen)
return 17;
return 0;
}

View file

@ -0,0 +1 @@
file

View file

@ -0,0 +1 @@
file

View file

@ -0,0 +1,133 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#if __i386__
#define stat xstat
struct stat
{
unsigned long st_dev;
unsigned long st_ino;
unsigned short st_mode;
unsigned short st_nlink;
unsigned short st_uid;
unsigned short st_gid;
unsigned long st_rdev;
long st_size;
unsigned int st_blksize;
unsigned int st_blocks;
long st_atime;
unsigned long st_atime_usec;
long st_mtime;
unsigned long st_mtime_usec;
long st_ctime;
unsigned long st_ctime_usec;
unsigned int __foo0;
unsigned int __foo1;
};
#endif
int
main ()
{
// char buf[20];
// strcpy (buf, "Hello");
// eputs ("buf="); eputs (buf); eputs ("\n");
// strcat (buf, ", ");
// eputs ("buf="); eputs (buf); eputs ("\n");
// strncat (buf, "world!XXX", 6);
// eputs ("buf="); eputs (buf); eputs ("\n");
// if (strcmp (buf, "Hello, world!"))
// return 1;
// char *name = "boo";
// errno = 0;
// fprintf (stderr, "%s: %s\n", name, strerror (errno));
int fd = open ("../COPYING", 0);
struct stat sbuf;
if (fd < 0)
return 2;
int r = fstat (fd, &sbuf);
if (r < 0)
return 1;
eputs ("st_dev=");
eputs (itoa (sbuf.st_dev));
eputs ("\n");
eputs ("st_ino=");
eputs (itoa (sbuf.st_ino));
eputs ("\n");
eputs ("st_mode=");
eputs (itoa (sbuf.st_mode));
eputs ("\n");
eputs ("st_nlink=");
eputs (itoa (sbuf.st_nlink));
eputs ("\n");
eputs ("st_uid=");
eputs (itoa (sbuf.st_uid));
eputs ("\n");
eputs ("st_gid=");
eputs (itoa (sbuf.st_gid));
eputs ("\n");
eputs ("st_rdev=");
eputs (itoa (sbuf.st_rdev));
eputs ("\n");
eputs ("st_size=");
eputs (itoa (sbuf.st_size));
eputs ("\n");
eputs ("st_blksize=");
eputs (itoa (sbuf.st_blksize));
eputs ("\n");
eputs ("st_blocks=");
eputs (itoa (sbuf.st_blocks));
eputs ("\n");
eputs ("st_atime=");
eputs (itoa (sbuf.st_atime));
eputs ("\n");
//eputs ("st_atime_nsec="); eputs (itoa (sbuf.st_atime_nsec)); eputs ("\n");
eputs ("st_mtime=");
eputs (itoa (sbuf.st_mtime));
eputs ("\n");
//eputs ("st_mtime_nsec="); eputs (itoa (sbuf.st_mtime_nsec)); eputs ("\n");
eputs ("st_ctime=");
eputs (itoa (sbuf.st_ctime));
eputs ("\n");
//eputs ("st_ctime_nsec="); eputs (itoa (sbuf.st_ctime_nsec)); eputs ("\n");
eputs ("size:");
eputs (itoa (sizeof (struct stat)));
eputs ("\n");
return 0;
}

View file

@ -0,0 +1,29 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int
main ()
{
eputs ("\n");
eputs ("Hello, GNU Mes\n");
return 0;
}

View file

@ -0,0 +1,29 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int
main ()
{
oputs ("\n");
oputs ("Hello, GNU Mes\n");
return 0;
}

View file

@ -0,0 +1,2 @@
Hello, GNU Mes

View file

@ -0,0 +1,52 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <string.h>
int
main ()
{
char *p = "mes";
oputs ("\n");
oputs ("t: itoa (33) == \"33\"\n");
oputs ("=>");
oputs (itoa (33));
oputs ("\n");
if (strcmp (itoa (33), "33"))
return 1;
oputs ("strcmp (itoa (-1), \"-1\")\n");
oputs (itoa (-1));
if (strcmp (itoa (-1), "-1"))
return 2;
oputs ("strcmp (itoa (0), \"0\")\n");
if (strcmp (itoa (0), "0"))
return 3;
oputs ("strcmp (itoa (1), \"1\")\n");
if (strcmp (itoa (1), "1"))
return 4;
return 0;
}

View file

@ -0,0 +1,35 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <stdlib.h>
#include <stdio.h>
int
main ()
{
char *s = "1.2e3";
char const *p = s;
double d = abtod (&p, 0);
if (d != 1200)
return d;
return 0;
}

View file

@ -0,0 +1,36 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <stdlib.h>
int
main ()
{
double d = 1.23;
char *p = dtoab (d, 10, 1);
puts (p);
d = -3.14159265;
p = dtoab (d, 10, 1);
puts (p);
return 0;
}

View file

@ -0,0 +1,2 @@
1.23
-3.14159265

View file

@ -0,0 +1,31 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mes/lib.h"
#include "stdlib.h"
int
main (int argc, char const *argv[])
{
eputs ("test:getenv\n");
if (getenv ("PATH") == 0)
return 1;
return 0;
}

View file

@ -0,0 +1,57 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <fcntl.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int
main (int argc, char const *argv[])
{
eputs ("test:getenv\n");
char file_name[PATH_MAX];
char *srcdir = getenv ("abs_top_srcdir");
if (! srcdir) // for running by hand
srcdir = ".";
eputs ("srcdir=");
eputs (srcdir);
eputs ("\n");
strcpy (file_name, srcdir);
strcpy (file_name + strlen (srcdir), "/lib/tests/posix/data/open-read");
eputs ("test open:");
eputs (file_name);
eputs ("\n");
int filedes = open (file_name, O_RDONLY, 0);
if (filedes <= 2)
return 1;
char buf[20];
int n = read (filedes, buf, sizeof (buf));
if (n != 5)
return 2;
if (strcmp (buf, "hello"))
return 3;
eputs ("test read: ");
eputs (buf);
eputs ("\n");
return 0;
}

View file

@ -0,0 +1,28 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include "unistd.h"
int
main (int argc, char const *argv[])
{
execlp ("echo", "echo", "Hello", "World!", 0);
return 0;
}

View file

@ -0,0 +1 @@
Hello World!

View file

@ -0,0 +1,41 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int
main ()
{
eputs ("setenv\n");
setenv ("FOO", "BAR", 1);
if (strcmp (getenv ("FOO"), "BAR"))
return 1;
eputs ("unsetenv\n");
unsetenv ("FOO");
if (getenv ("FOO"))
return 2;
return 0;
}

View file

@ -0,0 +1 @@
hello

View file

@ -0,0 +1,25 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
return 0;
}

View file

@ -0,0 +1,25 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
return 1;
}

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1,31 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
test0 ()
{
return 0;
}
int
main ()
{
return test0 ();
}

View file

@ -0,0 +1,31 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
testi (int t)
{
return t;
}
int
main ()
{
return testi (0);
}

View file

@ -0,0 +1,31 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
testi (int t)
{
return t;
}
int
main ()
{
return testi (1);
}

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1,32 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
test (int a, int b)
{
return a + b;
}
int
main ()
{
int i = -2;
return test (i, 2);
}

View file

@ -0,0 +1,31 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
testi (int t)
{
return !t;
}
int
main ()
{
return testi (1);
}

View file

@ -0,0 +1,31 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
test (char const *s)
{
return 0;
}
int
main ()
{
return test ("hello\n");
}

View file

@ -0,0 +1,34 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
test (int a)
{
return 1 - a;
}
int (*f) (int);
int
main ()
{
f = &test;
return (*f) (1);
}

View file

@ -0,0 +1,31 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
test ()
{
return 1;
}
int
main ()
{
return !test ();
}

View file

@ -0,0 +1,33 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
void
test ()
{
return;
}
int
main ()
{
test ();
return 0;
}

View file

@ -0,0 +1,27 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include "exit-42.i"
int
main ()
{
return 1;
}

View file

@ -0,0 +1 @@
42

View file

@ -0,0 +1,32 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int foo;
int
main ()
{
if (foo)
return 1;
foo = 42;
if (foo != 42)
return 2;
return 0;
}

View file

@ -0,0 +1,29 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
int a;
int b;
a = 1;
b = -a;
return a + b;
}

View file

@ -0,0 +1,32 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
int a;
int b;
int c;
a = 2;
b = -2;
c = a + b;
asm ("nop");
return c;
}

View file

@ -0,0 +1,27 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
if (0)
return 1;
return 0;
}

View file

@ -0,0 +1,27 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
if (1)
return 0;
return 1;
}

View file

@ -0,0 +1,27 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
if (0 == 0)
return 0;
return 1;
}

View file

@ -0,0 +1,27 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
if (0 != 1)
return 0;
return 1;
}

View file

@ -0,0 +1,33 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
if (0 == 0)
goto ok;
return 1;
ok:
if (0 != 1)
goto ok1;
return 1;
ok1:
return 0;
}

View file

@ -0,0 +1,28 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
int f = 0;
if (!f)
return 0;
return 1;
}

View file

@ -0,0 +1,28 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
int t = 1;
if (t)
return 0;
return 1;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
char c = 'a';
if (c >= 'A' && c <= 'Z' || c >= '0' && c <= '9')
return 1;
if (c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'a')
return 0;
return 2;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
char c = 'a';
if (c >= 'A' && c <= 'Z')
return 1;
if (c >= 'a' && c <= 'z')
return 0;
return 2;
}

View file

@ -0,0 +1,38 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
int
test (int i)
{
return i;
}
int
main ()
{
int a;
a = 0 == 0;
if (a != 1)
return 1;
return 0;
}

View file

@ -0,0 +1,38 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
int
test (int i)
{
return i;
}
int
main ()
{
int a;
a = test (0 == 0);
if (a != 1)
return 1;
return 0;
}

View file

@ -0,0 +1,31 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
if ('0' != 48)
return 1;
if ('\a' != 7)
return 2;
if ('\b' != 8)
return 3;
return 0;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
int r = 0;
if (r > 0)
return 1;
if (r >= -1)
return 0;
return 2;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
int r = 0;
if (r > 0)
return 1;
if (r > -1)
return 0;
return 2;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
int r = 0;
if (r <= -1)
return 1;
if (r <= 0)
return 0;
return 2;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
int r = 0;
if (r < -1)
return 1;
if (r < 1)
return 0;
return 2;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
char c = 'a';
if (c == ' ' || c == '\n')
return 1;
if (c == 'A' || c == 'a')
return 0;
return 2;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
unsigned char r = -2;
if (r <= -3)
return 1;
if (r <= (unsigned char) -1)
return 0;
return 2;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
unsigned r = -2;
if (r <= -1)
return 0;
if (r <= -3)
return 1;
return 2;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
unsigned r = -2;
if (r > -1)
return 1;
if (r > 0)
return 0;
return 2;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
unsigned r = -2;
if (r <= -3)
return 1;
if (r <= -1)
return 0;
return 2;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
unsigned long r = -2;
if (r <= -3)
return 1;
if (r <= -1)
return 0;
return 2;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
unsigned r = -2;
if (r < 0)
return 1;
if (r < -1)
return 0;
return 2;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
unsigned short r = -2;
if (r <= -3)
return 1;
if (r <= (unsigned short) -1)
return 0;
return 2;
}

View file

@ -0,0 +1,34 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
int
main ()
{
int c = 0;
{
int c = 3;
}
if (c)
return 1;
return 0;
}

View file

@ -0,0 +1,28 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
int v = 3;
while (v)
v--;
return v;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
char *s = "mes";
if (!s[0])
return 1;
if (s[1] != 'e')
return 2;
return 0;
}

View file

@ -0,0 +1,36 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
char *s = "mes";
if (!s[0])
return 1;
int f;
int v = 3;
if (!s[f])
return 2;
if (s[3])
return 3;
if (s[v])
return 4;
return 0;
}

View file

@ -0,0 +1,31 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
char *s = "mes";
int i = 0;
while (s[i])
i++;
if (i != 3)
return 1;
return 0;
}

View file

@ -0,0 +1,30 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int *foo;
//int bar = -1;
int
main ()
{
if (foo)
return 1;
return 0;
}

View file

@ -0,0 +1,33 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int foo = 1;
int *bar = &foo;
int baz = -1;
int
main ()
{
if (foo != 1)
return 1;
if (*bar != 1)
return 2;
return 0;
}

View file

@ -0,0 +1,33 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
char *g_hello = "hello";
int
main ()
{
// char *p = g_hello;
// char **pp = &p;
char **pp = &g_hello;
if (**pp != 'h')
return 1;
return 0;
}

View file

@ -0,0 +1,31 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
char *g_hello = "hello";
int
main ()
{
char *p = g_hello;
if (*p != 'h')
return 1;
return 0;
}

View file

@ -0,0 +1,32 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
int
main ()
{
char *begin = "foo";
char *end = begin + 4;
if (end - begin != 4)
return 1;
return 0;
}

View file

@ -0,0 +1,69 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
char *g_hello = "hello";
char g_arena[4] = "XXX";
char *g_chars = g_arena;
int
main ()
{
if (*g_hello != 'h')
return 1;
if (g_hello[0] != 'h')
return 2;
if (g_chars[0] != 'X')
return 3;
if (*g_chars != 'X')
return 4;
g_arena[0] = 'A';
if (*g_chars != 'A')
return 5;
char *x = g_arena;
if (*x++ != 'A')
return 5;
*x++ = 'C';
if (g_chars[1] != 'C')
return 7;
if (g_chars[2] != 'X')
return 8;
*--x = 'X';
if (g_chars[1] != 'X')
return 9;
char **pp = &x;
if (**pp != 'X')
return 10;
char *p = *pp;
if (*p != 'X')
return 11;
char ***ppp = &pp;
if (***ppp != 'X')
return 12;
char **pp2 = *ppp;
if (**pp2 != 'X')
return 13;
return 0;
}

View file

@ -0,0 +1,26 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
_exit (0);
return 1;
}

View file

@ -0,0 +1,26 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int
main ()
{
_exit (42);
return 0;
}

View file

@ -0,0 +1 @@
42

View file

@ -0,0 +1,47 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
long
wrap (long a)
{
//eputs ("wrap:"); eputs (itoa (a)); eputs ("\n");
return a;
}
int
print (int a)
{
//eputs ("print:"); eputs (itoa (a)); eputs ("\n");
return a;
}
int
main ()
{
int a[2] = { 101, -1 };
//eputs ("b:"); eputs (itoa (a[0])); eputs ("\n");
int r = wrap (print (a[0]));
if (r != 101)
return 1;
return 0;
}

View file

@ -0,0 +1,267 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int
isid (char c)
{
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_';
}
int
main (int c)
{
int f = 0;
int t = 1;
int one = t;
oputs ("\n");
oputs ("t: if (f)\n");
if (f)
return 1;
oputs ("t: if (one != 1)\n");
if (one != 1)
return 2;
oputs ("t: if (1 != one)\n");
if (1 != one)
return 3;
oputs ("t: if (one > 1)\n");
if (one > 1)
return 4;
oputs ("t: if (one < 0)\n");
if (one < 0)
return 5;
oputs ("t: if (one <= 0)\n");
if (one <= 0)
return 6;
oputs ("t: if (one >= 2)\n");
if (one >= 2)
return 7;
oputs ("t: if (!1)\n");
if (!1)
return 8;
oputs ("t: if (one == 0)\n");
if (one == 0)
return 9;
oputs ("t: if (f != 0)\n");
if (one != 1)
return 10;
oputs ("t: if (1)\n");
if (1)
goto ok0;
return 111;
ok0:
oputs ("t: if (0); return 1; else;\n");
if (0)
return 12;
else
goto ok1;
ok1:
oputs ("t: if (t)\n");
if (t)
goto ok2;
return 13;
ok2:
oputs ("t: if (one > 0)\n");
if (one > 0)
goto ok3;
return 14;
ok3:
oputs ("t: if (one < 2)\n");
if (one < 2)
goto ok4;
return 15;
ok4:
oputs ("t: if (one >= 0)\n");
if (one >= 0)
goto ok5;
return 16;
ok5:
oputs ("t: if (one >= 1)\n");
if (one >= 0)
goto ok6;
return 17;
ok6:
oputs ("t: if (one <= 2)\n");
if (one <= 2)
goto ok7;
return 18;
ok7:
oputs ("t: if (one <= 1)\n");
if (one <= 1)
goto ok8;
return 19;
ok8:
oputs ("t: if (!0)\n");
if (!0)
goto ok9;
return 20;
ok9:
oputs ("t: if (one == 1)\n");
if (one == 1)
goto ok10;
return 21;
ok10:
oputs ("t: if (one != 0)\n");
if (one != 0)
goto ok11;
return 22;
ok11:
;
int m1 = -1;
int i;
oputs ("t: i = one > 0\n");
i = one > 0;
if (!i)
return 23;
oputs ("t: i = one >= 1\n");
i = one >= 1;
if (!i)
return 24;
oputs ("t: i = one < 2\n");
i = one < 2;
if (!i)
return 25;
oputs ("t: i = one <= 1\n");
i = one <= 1;
if (!i)
return 26;
oputs ("t: i = 0 > one\n");
i = 0 > one;
if (i)
return 27;
oputs ("t: i = 0 >= one\n");
i = 0 >= one;
if (i)
return 28;
oputs ("t: i = 1 < one \n");
i = 1 < one;
if (i)
return 29;
oputs ("t: i = 2 <= one\n");
i = 2 <= one;
if (i)
return 30;
oputs ("t: i = m1 > -2\n");
i = m1 > -2;
if (!i)
return 31;
oputs ("t: i = m1 >= -1\n");
i = m1 >= -1;
if (!i)
return 32;
oputs ("t: i = m1 < 0\n");
i = m1 < 0;
if (!i)
return 33;
oputs ("t: i = m1 <= -1\n");
i = m1 <= -1;
if (!i)
return 34;
oputs ("t: i = -1 > m1\n");
i = -1 > m1;
if (i)
return 35;
oputs ("t: i = -2 >= m1\n");
i = -2 >= m1;
if (i)
return 36;
oputs ("t: i = -1 < m1 \n");
i = -1 < m1;
if (i)
return 37;
oputs ("t: i = -2 <= m1\n");
i = 0 <= m1;
if (i)
return 38;
oputs ("t: isid (0)\n");
if (isid (0))
return 39;
oputs ("t: isid (6)\n");
if (isid (6))
return 40;
oputs ("t: isid (a)\n");
if (isid ('a') != 1)
return 41;
oputs ("t: isid ( )\n");
if (isid (' '))
return 42;
return 0;
}

View file

@ -0,0 +1,60 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int
main ()
{
int f = 0;
int t = 1;
int one = t;
oputs ("\n");
oputs ("t: if (1 && 0)\n");
if (1 && 0)
return 1;
oputs ("t: if (!t && f)\n");
if (!t && f)
return 1;
oputs ("t: if (t && !one)\n");
if (t && !one)
return 1;
oputs ("t: if (f || !t)\n");
if (f || !t)
return 1;
oputs ("t: if (1 && !0)\n");
if (1 && !0)
goto ok0;
return 1;
ok0:
oputs ("t: if (f || t)\n");
if (f || t)
goto ok1;
return 1;
ok1:
return 0;
}

View file

@ -0,0 +1,63 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int
main ()
{
int f = 0;
int t = 1;
int one = t;
int i = 0;
oputs ("\n");
oputs ("t: if (i++)\n");
if (i++)
return 1;
oputs ("t: if (--i)\n");
if (--i)
return 1;
oputs ("t: i += 2\n");
i += 2;
if (i != 2)
return 1;
oputs ("t: i -= 2\n");
i -= 2;
if (i != 0)
return 1;
oputs ("t: if (++i)\n");
if (++i)
goto ok0;
return 1;
ok0:
oputs ("t: if (i--)\n");
if (i--)
goto ok1;
return 1;
ok1:
return 0;
}

View file

@ -0,0 +1,103 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
char g_arena[10];
char *g_chars = g_arena;
int
main ()
{
int i = 0;
char c = 'C';
char *p = "mes";
char *x = g_arena;
char *y = g_chars;
oputs ("\n");
oputs ("t: p[0] != 'm'\n");
if (p[0] != 'm')
return p[0];
oputs ("t: p[i] != 't'\n");
if (p[i] != 'm')
return p[i];
oputs ("t: *g_chars != 'A'\n");
g_arena[0] = 'A';
if (*g_chars != 'A')
return 1;
oputs ("t: *x != 'A'\n");
if (*x != 'A')
return 1;
oputs ("t: *y != 'A'\n");
if (*y != 'A')
return 1;
oputs ("t: *x != 'Q'\n");
g_chars[0] = 'Q';
if (*x != 'Q')
return 1;
oputs ("t: *x++ != 'C'\n");
*x++ = c;
if (*g_chars != 'C')
return 1;
oputs ("t: *g_chars == 'B'\n");
g_arena[0] = 'B';
if (*g_chars == 'B')
goto ok1;
return 1;
ok1:
oputs ("t: *x == 'B'\n");
x = g_arena;
if (*x == 'B')
goto ok2;
return 1;
ok2:
oputs ("t: *y == 'B'\n");
y = g_chars;
if (*y == 'B')
goto ok3;
return 1;
ok3:
oputs ("t: *x == 'R'\n");
g_chars[0] = 'R';
if (*x == 'R')
goto ok4;
return 1;
ok4:
oputs ("t: *x++ == 'C'\n");
*x++ = c;
if (*g_chars == 'C')
goto ok5;
return 1;
ok5:
return 0;
}

View file

@ -0,0 +1,48 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int
main ()
{
oputs ("\n");
oputs ("t: 1 + 2\n");
if (1 + 2 != 3)
return 1;
oputs ("t: 2 - 1\n");
if (0)
return 1;
oputs ("t: 1 << 3\n");
if (1 << 3 != 8)
return 1;
oputs ("t: 8 >> 3\n");
if (8 >> 3 != 1)
return 1;
oputs ("t: 8 / 4\n");
if (8 / 4 != 2)
return 1;
return 0;
}

View file

@ -0,0 +1,48 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int
main ()
{
int f = 0;
int t = 1;
int one = t;
oputs ("\n");
oputs ("t: if (f = 0) ?\n");
if (f = 0)
return 1;
oputs ("t: if (!(t = 1)) ?\n");
if (!(t = 1))
return 1;
oputs ("t: if ((f = 0) != 0) ?\n");
if ((f = 0) != 0)
return 1;
oputs ("t: if ((t = 1) != 1) ?\n");
if ((t = 1) != 1)
return 1;
return 0;
}

View file

@ -0,0 +1,42 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int
add (int a, int b)
{
return a + b;
}
int
identity (int i)
{
return i;
}
int
main ()
{
if (add (identity (1), identity (2)) != 3)
return 1;
return 0;
}

View file

@ -0,0 +1,42 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int
add (int a, int b)
{
return a + b;
}
int
inc (int i)
{
return i + 1;
}
int
main ()
{
if (add (inc (0), inc (1)) != 3)
return 1;
return 0;
}

View file

@ -0,0 +1,116 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
enum type_t
{ TCHAR, TCLOSURE, TCONTINUATION, TFUNCTION, TKEYWORD, TMACRO, TNUMBER, TPAIR, TREF, TSPECIAL, TSTRING,
TSYMBOL, TVALUES, TVECTOR, TBROKEN_HEART };
int
add (int a, int b)
{
return a + b;
}
int
inc (int i)
{
return i + 1;
}
int
identity (int i)
{
return i;
}
int
main ()
{
int i = 0;
int f = 0;
int t = 1;
int one = t;
char *p = "mes";
oputs ("\n");
oputs ("t: if (strlen (\"\"))\n");
if (strlen (""))
return 1;
oputs ("t: if (strlen (p) != 3)\n");
if (strlen (p) != 3)
return 2;
oputs ("t: if (!strlen (\".\"))\n");
if (!strlen ("."))
return 3;
oputs ("t: identity (p[i]) != 'm'\n");
if (identity (p[i]) != 'm')
return identity (p[i]);
oputs ("t: inc (0)\n");
if (inc (0) != 1)
return 4;
oputs ("t: inc (inc (0))\n");
if (inc (inc (0)) != 2)
return 5;
oputs ("t: inc (inc (inc (0)))\n");
if (inc (inc (inc (0))) != 3)
return 6;
oputs ("t: add (1, 2)\n");
if (add (1, 2) != 3)
return 7;
// broken x86, x86_64
oputs ("t: add (inc (0), inc (1))\n");
if (add (inc (0), inc (1)) != 3)
return 8;
// end broken x86, x86_64
oputs ("t: add (TSTRING, 3)\n");
if (add (TSTRING, 3) != 13)
return 9;
// broken x86_64
oputs ("t: add (inc (inc (0)), inc (inc (1)))\n");
if (add (inc (inc (0)), inc (inc (1))) != 5)
return 10;
// end broken x86_64
oputs ("t: if (strlen (\".\"))\n");
if (strlen ("."))
goto ok1;
return 11;
ok1:
oputs ("t: if (strlen (p) == 3)\n");
if (strlen (p) == 3)
goto ok2;
return 12;
ok2:
return 0;
}

View file

@ -0,0 +1,42 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int
main ()
{
int i = 0;
oputs ("\n");
if (i)
return 1;
else
oputs ("t: else 1\n");
if (i)
oputs ("0");
else if (i == 1)
oputs ("1");
else
oputs ("t: else if 2\n");
return 0;
}

View file

@ -0,0 +1,47 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int
main ()
{
int f = 0;
int t = 1;
int one = t;
oputs ("\n");
oputs ("t: (one == 1) ?\n");
(one == 1) ? 1 : exit (1);
oputs ("t: (f) ?\n");
(f) ? exit (2) : 1;
int r = f ? 3 - 1 : 2 - 2;
if (r)
return 3;
r = t ? 2 + 3 - 1 : 3 + 4 - 5;
if (r != 4)
return 4;
oputs ("t: f ? 3 - 1 : 2 - 2\n");
return f ? 3 - 1 : 2 - 2;
}

View file

@ -0,0 +1,47 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int
label (int c)
{
label:
if (c == 0)
return c;
c--;
goto label;
return 1;
}
int
main ()
{
int f;
int t = 1;
int one = t;
oputs ("\n");
oputs ("t: goto label\n");
if (label (1) != 0)
return 1;
return 0;
}

View file

@ -0,0 +1,90 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
int
main ()
{
int i = 0;
int f = 0;
int t = 1;
int one = t;
char *p = "mes";
oputs ("\n");
oputs ("t: for (i=1; i<5; ++i)\n");
for (i = 1; i < 5; ++i)
;
if (i != 5)
return i;
oputs ("t: while (i<3) i++\n");
i = 1;
while (i < 3)
i++;
if (i != 3)
return i;
oputs ("t: do i-- while (i>0)\n");
do
i--;
while (i > 0)
;
if (i != 0)
return 1;
oputs ("t: while (1) break;\n");
while (1)
break;
oputs ("t: while (1) ... break;\n");
while (1)
{
f = 0;
break;
}
oputs ("t: while (1) {while (1) break;break;}\n");
while (1)
{
while (1)
break;
break;
}
oputs ("t: while () {continue;...}\n");
while (one--)
{
continue;
one = 1;
}
one += 2;
oputs ("t: while (1) { goto label; };\n");
while (1)
{
goto ok1;
}
ok1:
return 0;
}

View file

@ -0,0 +1,47 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
int
main ()
{
int r;
int i = 2;
switch (i)
{
// case 0:
// r = 0;
// break;
// case 1:
// r = 1;
// break;
case 2:
r = 2;
default:
r++;
break;
}
if (r != 3)
return 1;
return 0;
}

View file

@ -0,0 +1,46 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
int
main ()
{
int r;
int i = 2;
switch (i)
{
// case 0:
// r = 0;
// break;
// case 1:
// r = 1;
// break;
case 2:
default:
r = 2;
break;
}
if (r != 2)
return 1;
return 0;
}

View file

@ -0,0 +1,174 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
enum type_t
{ TCHAR, TCLOSURE, TCONTINUATION, TFUNCTION, TKEYWORD, TMACRO, TNUMBER, TPAIR, TREF, TSPECIAL, TSTRING,
TSYMBOL, TVALUES, TVECTOR, TBROKEN_HEART };
int
swits (int c)
{
int x = -1;
switch (c)
{
case TCHAR:
{
oputs ("TCHAR\n");
goto next;
}
case 1:
{
oputs ("1\n");
goto next;
}
case 2:
{
oputs ("2\n");
goto next;
}
default:
{
oputs ("default\n");
goto next;
}
}
return 1;
next:
switch (c)
{
case 0:
{
oputs ("0\n");
x = 0;
c = 34;
break;
}
case 5:
case 4:
case 3:
case 2:
case -1:
case 1:
oputs ("5..1, -1\n");
x = 1;
break;
default:
oputs ("default\n");
x = 2;
x = 2;
break;
}
return x;
}
int
default_first (int c)
{
int a;
switch (c)
{
here:
default:
a = 1;
{
}
a = 2;
return a;
there:
case 0:
;
{
}
return 0;
}
return -1;
}
int
main ()
{
oputs ("\n");
oputs ("t: switch 0\n");
int i = swits (0);
if (i != 0)
return i;
oputs ("t: switch 1\n");
if (swits (1) != 1)
return 10;
oputs ("t: switch -1\n");
if (swits (-1) != 1)
return 11;
oputs ("t: switch -1\n");
if (swits (-2) != 2)
return 12;
if (default_first (1) != 2)
return 13;
if (default_first (0) != 0)
return 14;
i = 15;
switch (i)
{
case 0:
case 1:
case 2:
case 3:
case 4:
i = 15;
break;
}
if (i != 15)
return 15;
i = 16;
switch (i)
{
case 1:
default:
case 0:
i = 0;
break;
}
if (i != 0)
return 16;
i = 2;
switch (i)
{
default:
case 0:
i = 17;
break;
case 2:
i = 0;
}
return i;
}

View file

@ -0,0 +1,36 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib-mini.h>
void
void_func ()
{
}
int
main ()
{
oputs ("\n");
oputs ("void_func ()\n");
void_func ();
return 0;
}

View file

@ -0,0 +1,39 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int bar;
static int i = 2;
int baz;
int
test ()
{
static int i = 1;
static int foo = 0;
foo = 0;
return foo - i--;
}
int
main ()
{
test ();
return i - 2 - test ();
}

View file

@ -0,0 +1,37 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
int g_time = 1;
#if __TINYC__
#define time time_
#endif
int *
time ()
{
return &g_time;
}
int
main ()
{
return *time () - 1;
}

View file

@ -0,0 +1,43 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#if __TINYC__
#define unsigned
#endif
static int sint;
static int sint2, sint3;
typedef unsigned int size;
static void *
test (size u)
{
void *r;
if (u)
r = test (u);
}
static int i = 2;
int
main ()
{
void (*foo) () = &test;
test (0);
return 0;
}

View file

@ -0,0 +1,33 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
int
main ()
{
int **p = 1;
int **q = -1;
oputs ("p - q");
oputs (itoa (p - q));
oputs ("\n");
return 0;
}

View file

@ -0,0 +1,36 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <stdio.h>
#include <string.h>
int
main (int argc, char *argv[])
{
oputs ("argc=");
oputs (itoa (argc));
oputs ("\n");
if (argc != 5)
return 1;
return 0;
}

View file

@ -0,0 +1,51 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <stdio.h>
#include <string.h>
int
main (int argc, char *argv[])
{
oputs ("\n");
oputs ("t: argv[0] == \"lib/tests/scaffold....\"\n");
oputs ("argv0=");
oputs (argv[0]);
oputs ("\n");
if (strcmp (argv[0], "lib/tests/scaffold/54-argv"))
return 1;
oputs ("t: *argv\"\n");
oputs (*argv);
oputs ("\n");
if (argc != 5)
return 2;
if (strcmp (argv[1], "-s"))
return 3;
if (strcmp (argv[2], "--long"))
return 4;
return 0;
}

View file

@ -0,0 +1,90 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <mes/lib-mini.h>
char g_hello[] = "hello\n" "world\n";
char *g_hello2 = "hello\n" "world\n";
char g_hello3[] = {
'h', 'e', 'l', 'l', 'o', '\n',
'w', 'o', 'r', 'l', 'd', '\n',
'\0',
}
;
int g_hello_int[] = { 0, 1, 2, 3, 4, 5 };
int
main (int argc)
{
oputs ("0:"); oputs (g_hello); oputs ("\n");
oputs ("2:"); oputs (g_hello2); oputs ("\n");
oputs ("3:"); oputs (g_hello3); oputs ("\n");
if (strcmp (g_hello, g_hello2))
return 1;
if (strcmp (g_hello, g_hello3))
return 2;
char hello[] =
"hello\n"
"world\n"
;
char *hello2 =
"hello\n"
"world\n"
;
oputs (hello);
oputs (hello2);
if (strcmp (hello, hello2))
return 3;
char hello3[] =
{
'h', 'e', 'l', 'l', 'o', '\n',
'w', 'o', 'r', 'l', 'd', '\n',
'\0',
}
;
oputs (hello3);
if (strcmp (hello, hello3))
return 4;
if (g_hello_int[0])
return 5;
if (g_hello_int[1] != 1)
return 6;
int hello_int[] = {0, 1, 2, 3, 4, 5};
if (hello_int[0])
return 7;
if (hello_int[1] != 1)
return 8;
return 0;
}

Some files were not shown because too many files have changed in this diff Show more