25 #include <qfileinfo.h>
34 QObject::tr(
"Name of Verilog file")));
47 p->
Props.getFirst()->Value =
Props.getFirst()->Value;
55 Name = QObject::tr(
"Verilog file");
56 BitmapFile = (
char *)
"vhdlfile";
76 for(pp =
Ports.next(); pp != 0; pp =
Ports.next())
95 if(!f.open(IO_ReadOnly))
98 QTextStream stream(&f);
112 int fHeight = metrics.lineSpacing();
115 QString tmp, PortNames =
loadFile();
116 if(!PortNames.isEmpty())
117 No = PortNames.contains(
',') + 1;
121 int h = 30*((No-1)/2) + 15;
127 tmp = QObject::tr(
"verilog");
128 int w = metrics.width(tmp);
129 Texts.append(
new Text(w/-2, fHeight/-2, tmp));
136 tmp = PortNames.section(
',', i, i);
137 w = metrics.width(tmp);
138 Texts.append(
new Text(-26-w, y-fHeight-2, tmp));
144 tmp = PortNames.section(
',', i, i);
145 Texts.append(
new Text( 27, y-fHeight-2, tmp));
160 QString FileName =
Props.getFirst()->Value;
170 QString FileName =
Props.getFirst()->Value;
171 if(FileName.isEmpty()) {
172 ErrText += QObject::tr(
"ERROR: No file name in %1 component \"%2\".").
182 if(!f.open(IO_ReadOnly)) {
183 ErrText += QObject::tr(
"ERROR: Cannot open %1 file \"%2\".").
189 QByteArray FileContent = f.readAll();
192 stream->writeRawBytes(FileContent.data(), FileContent.size());
209 if(!f.open(IO_ReadOnly))
212 QByteArray FileContent = f.readAll();
213 File = QString(FileContent);
220 while((i=File.find(
"//", i)) >= 0) {
221 j = File.find(
'\n', i+2);
229 while((i=File.find(
"/*", i)) >= 0) {
230 j = File.find(
"*/", i+2);
234 File.remove(i, j-i+2);
238 Expr.setCaseSensitive(
true);
239 Expr1.setCaseSensitive(
true);
241 Expr.setPattern(
"\\bmodule\\b");
242 k = File.findRev(Expr, k);
246 Expr.setPattern(
"\\bendmodule\\b");
247 i = File.find(Expr, k+7);
250 s = File.mid(k+7, i-k-7);
252 Expr.setPattern(
"\\b");
256 j = s.find(Expr, i+1);
268 s = s.mid(i+1, j-i-1);
278 Expr.setCaseSensitive(
true);
279 Expr1.setCaseSensitive(
true);
283 Expr.setPattern(
"(\\binput\\b|\\boutput\\b|\\binout\\b)");
284 Expr1.setPattern(
"(\\b)");
285 while((i=s.find(Expr, i)) >= 0) {
286 j = s.find(Expr1, i+1);