* configure.ac: New switch for disabling -O2 (--disable-optimizations).
[cacao.git] / tests / x.java
1
2 import java.io.*;
3
4 public class x {
5         static public char[][] text;
6         static public int letters;
7         final static int maxwidth = 200;
8         final static int maxheight = 200;
9
10         static public void main(java.lang.String [] argv) throws 
11             FileNotFoundException, IOException {
12
13                 int l,c,width,height;
14                 char a;
15                 int i;
16                 FileInputStream input = new FileInputStream ("x.java");
17                 PrintStream output = System.out;
18
19         output.println ("Ausgabe startet");
20                 
21                 text =  new char[maxheight][maxwidth];
22         output.println ("Feld angelegt");
23         
24                 for (l=0; l<maxheight; l++) for (c=0; c<maxwidth; c++) 
25                         text[l][c] = ' ';
26                 
27                 letters = 0;
28                 width = 0;
29                 height = 0;
30
31                 l=0; c=0;
32                 try {
33                  while ( (i=input.read()) != -1) {
34                         if (i == '\n') { c=0; l++; }
35                         else {
36                                 if (i == '\t') { c = ( (c/4 + 1) * 4); }
37                                 else {
38                                         if (c<maxwidth && l<maxheight) {
39                                                 a = (char) i;
40                                                 text[l][c] = a;
41                                                 if (c>=width)  width=c+1;
42                                                 if (l>=height) height=l+1;
43                                                 }
44                                         c++;
45                                         }
46                                 }
47                         }
48                 } catch (Throwable e) { };
49                 
50             output.println ("------------------------------------------------------");
51
52                 for (c=width-1; c>=0; c--) {
53                         for (l=0; l<height; l++) {
54                                 if ( (a=text[l][c]) != ' ' ) letters ++;
55                                 i = a;
56                                 output.write (i);
57                                 }
58                         output.println ();
59                         }
60
61                 output.println ("------------------------------------------------------");
62                 output.println ("Abdruckbare Buchstaben im Text: " + Integer.toString(letters) );
63
64
65                 output.flush();
66
67                 }
68
69
70         }
71