1 /* $Id: YapiVisitor.java 1 2010-02-24 13:03:05Z haidw $ */
2 package dol.visitor.yapi;
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 YapiVisitor extends PNVisitor {
20 public YapiVisitor(String packageName) {
21 _packageName = packageName;
27 public void visitComponent(ProcessNetwork pn) {
29 _generateDirHierarchy();
31 pn.accept(new YapiMakefileVisitor(_srcDir));
32 pn.accept(new YapiModuleVisitor(_srcDir));
33 pn.accept(new YapiProcessVisitor(_wrapperDir));
35 } catch (Exception e) {
36 System.out.println(" SystemC PN Visitor: exception " +
37 "occured: " + e.getMessage());
45 private void _generateDirHierarchy()
46 throws IOException, FileNotFoundException {
48 File dir = new File(_packageName);
51 _srcDir = _packageName + _delimiter + _srcDirName;
52 dir = new File(_srcDir);
55 _libDir = _srcDir + _delimiter + _libDirName;
56 dir = new File(_libDir);
59 _processDir = _srcDir + _delimiter + _processDirName;
60 dir = new File(_processDir);
63 _wrapperDir = _srcDir + _delimiter + _wrapperDirName;
64 dir = new File(_wrapperDir);
68 String libraryPath = _ui.getMySystemCLib();
69 libraryPath = libraryPath.replaceAll("systemC",
71 File source = new File(libraryPath);
72 File destination = new File(_libDir);
73 new Copier().copy(source, destination);
75 //copy process src code
76 source = new File(_srcDirName);
77 destination = new File(_processDir);
78 new Copier().copy(source, destination);
81 protected String _packageName = null;
83 protected String _srcDir = "";
84 protected static String _srcDirName = "src";
86 protected String _libDir = "";
87 protected static String _libDirName = "lib";
89 protected String _processDir = "";
90 protected static String _processDirName = "processes";
92 protected String _wrapperDir = "";
93 protected static String _wrapperDirName = "wrappers";