blob: 7036c740116f7d0728225c9d908d0fd3787f4e5c (
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
|
/*
* TranslatorThread.java
*
*/
package io.devnulllabs.openjava.ojc;
import io.devnulllabs.openjava.mop.Environment;
import io.devnulllabs.openjava.mop.OJClass;
import io.devnulllabs.openjava.mop.OJSystem;
import io.devnulllabs.openjava.ptree.ClassDeclaration;
public class TranslatorThread extends Thread {
private final Environment env;
private final OJClass clazz;
public TranslatorThread(Environment env, OJClass clazz) {
this.env = env;
this.clazz = clazz;
}
public void run() {
try {
ClassDeclaration cdecl = clazz.getSourceCode();
ClassDeclaration newdecl = clazz.translateDefinition(env, cdecl);
if (newdecl != cdecl)
cdecl.replace(newdecl);
} catch (Exception ex) {
System.err.println(
"fail to translate " + clazz.getName() + " : " + ex);
ex.printStackTrace();
}
synchronized (clazz) {
OJSystem.waited = null;
clazz.notifyAll();
}
}
}
|