1 /* $Id: ProtothreadVisitor.java 1 2010-02-24 13:03:05Z haidw $ */
2 package dol.visitor.protothread;
5 import java.io.FileNotFoundException;
6 import java.io.IOException;
8 import dol.datamodel.pn.ProcessNetwork;
9 import dol.util.Copier;
10 import dol.visitor.PNVisitor;
15 public class ProtothreadVisitor extends PNVisitor {
20 public ProtothreadVisitor(String packageName) {
21 _packageName = packageName;
27 public void visitComponent(ProcessNetwork x) {
29 _generateDirHierarchy();
31 x.accept(new ProtothreadMakefileVisitor(_srcDir));
32 x.accept(new ProtothreadModuleVisitor(_srcDir));
33 x.accept(new ProtothreadProcessVisitor(_wrapperDir));
35 } catch (Exception e) {
36 System.out.println(" SystemC PN Visitor: exception " +
37 "occured: " + e.getMessage());
46 private void _generateDirHierarchy()
47 throws IOException, FileNotFoundException {
49 File dir = new File(_packageName);
52 _srcDir = _packageName + _delimiter + _srcDirName;
53 dir = new File(_srcDir);
56 _libDir = _srcDir + _delimiter + _libDirName;
57 dir = new File(_libDir);
60 _processDir = _srcDir + _delimiter + _processDirName;
61 dir = new File(_processDir);
64 _wrapperDir = _srcDir + _delimiter + _wrapperDirName;
65 dir = new File(_wrapperDir);
69 String libraryPath = _ui.getMySystemCLib();
70 libraryPath = libraryPath.replaceAll("systemC",
72 File source = new File(libraryPath);
73 File destination = new File(_libDir);
74 new Copier().copy(source, destination);
76 //copy process src code
77 source = new File(_srcDirName);
78 destination = new File(_processDir);
79 new Copier().copy(source, destination);
82 protected String _packageName = null;
84 protected String _srcDir = "";
85 protected static String _srcDirName = "src";
87 protected String _libDir = "";
88 protected static String _libDirName = "lib";
90 protected String _processDir = "";
91 protected static String _processDirName = "processes";
93 protected String _wrapperDir = "";
94 protected static String _wrapperDirName = "wrappers";