summaryrefslogtreecommitdiff
path: root/tests/gen-all-unicode.c
blob: 90ff4dbd54253eb314442bc069fa83d825f248c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <glib.h>
#include <stdio.h>

int
main (int argc, char **argv)
{
  gunichar i;
  gint j;

  /* Output all characters in the BMP twice, once directly
   * concatenated, once with spaces between them
   */
  for (j = 0 ; j < 2 ; j++)
    {
      for (i = 0; i < 65536; i++)
	{
	  if (g_unichar_validate (i))
	    {
	      gchar buffer[7];
	      int len = g_unichar_to_utf8 (i, buffer);
	      buffer[len] = '\0';

	      if (j == 1)
		fputs (" ", stdout);

	      fputs (buffer, stdout);

	      if (j == 0)
		{
		  if (i % 40 == 0 && i != 0)
		    fputs ("\n", stdout);
		}
	      else
		{
		  if (i % 20 == 0 && i != 0)
		    fputs ("\n", stdout);
		}
	    }
	}
    }
  fputs ("\n", stdout);

  return 0;
}