dlugolecki.net.pl
Dziennik
Polecane
Software
projects
/
vlp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Port most of the code to the Qt4
[vlp.git]
/
src
/
preproc
/
prep.cpp
diff --git
a/src/preproc/prep.cpp
b/src/preproc/prep.cpp
index 285b2c899d69502b0dea048527afa23de6a7a9d3..dda3901c4149ad32f404b8ce82848306d95db08e 100644
(file)
--- a/
src/preproc/prep.cpp
+++ b/
src/preproc/prep.cpp
@@
-1,10
+1,10
@@
-#include <
qlist.h
>
-#include <
qstring.h
>
+#include <
QtCore/QList
>
+#include <
QtCore/QString
>
#include <stdio.h>
#include <stdio.h>
-#include <qfile.h>
-#include <
qtstream.h
>
+#include <
QtCore/
qfile.h>
+#include <
QtCore/QTextStream
>
#include <string.h>
#include <string.h>
-#include <
qdir.h
>
+#include <
QtCore/QDir
>
#include <unistd.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdlib.h>
@@
-21,13
+21,15
@@
public:
};
};
};
};
-QList<IncFile> inc;
+QList<IncFile
*
> inc;
IncFile *findTrueLine(int ln, int *trueline)
{
IncFile *findTrueLine(int ln, int *trueline)
{
- IncFile *pom, *pom1;
- QList<IncFile> pl;
- int c1 = 0, c2 = 0;
+ IncFile *pom;
+ IncFile *pom1;
+ QList<IncFile*> pl;
+ int c1 = 0;
+// int c2 = 0;
if (inc.isEmpty()) {
*trueline = ln;
if (inc.isEmpty()) {
*trueline = ln;
@@
-46,7
+48,7
@@
IncFile *findTrueLine(int ln, int *trueline)
return pom;
}
pl.append(pom);
return pom;
}
pl.append(pom);
- pom=inc.
nex
t();
+ pom=inc.
takeFirs
t();
}
if (pom != NULL) {
}
if (pom != NULL) {
@@
-54,7
+56,7
@@
IncFile *findTrueLine(int ln, int *trueline)
c1=0;
while (pom1 != NULL) {
c1 += pom1->len;
c1=0;
while (pom1 != NULL) {
c1 += pom1->len;
- pom1 = pl.
nex
t();
+ pom1 = pl.
takeFirs
t();
}
*trueline = ln - c1;
return NULL;
}
*trueline = ln - c1;
return NULL;
@@
-63,7
+65,7
@@
IncFile *findTrueLine(int ln, int *trueline)
c1 = 0;
while (pom1 != NULL) {
c1 += pom1->len;
c1 = 0;
while (pom1 != NULL) {
c1 += pom1->len;
- pom1=inc.
nex
t();
+ pom1=inc.
takeFirs
t();
}
*trueline = ln - c1;
return NULL;
}
*trueline = ln - c1;
return NULL;
@@
-89,7
+91,7
@@
int main(int argc,char **argv)
//******* get home directory
if (i != -1) {
poms1 = poms.left(i + 1);
//******* get home directory
if (i != -1) {
poms1 = poms.left(i + 1);
- strcpy(homedir, poms1.
data
());
+ strcpy(homedir, poms1.
toStdString().c_str
());
}
else
strcpy(homedir, "");
}
else
strcpy(homedir, "");
@@
-102,26
+104,25
@@
int main(int argc,char **argv)
else
poms1.sprintf(".");
else
poms1.sprintf(".");
- strcpy(mydir,
poms1.data
());
+ strcpy(mydir,
poms1.toStdString().c_str
());
poms.sprintf("%s", argv[1]);
i = poms.findRev(".log", poms.length()-1, FALSE);
poms1 = poms.left(i);
poms.sprintf("%s", argv[1]);
i = poms.findRev(".log", poms.length()-1, FALSE);
poms1 = poms.left(i);
- strcpy(fname, poms1.
data
());
+ strcpy(fname, poms1.
toStdString().c_str
());
// ********************
poms.sprintf("%s/.cmp00", mydir);
poms1.sprintf("%s/cmp01.log", mydir);
// ********************
poms.sprintf("%s/.cmp00", mydir);
poms1.sprintf("%s/cmp01.log", mydir);
- unlink(poms.
data
());
- unlink(poms1.
data
());
+ unlink(poms.
toStdString().c_str
());
+ unlink(poms1.
toStdString().c_str
());
- QFile compfile(poms1
.data()
);
+ QFile compfile(poms1);
QFile srcfile(argv[1]);
if (!compfile.open(IO_WriteOnly)) {
QFile srcfile(argv[1]);
if (!compfile.open(IO_WriteOnly)) {
- fprintf(stdout,"Cannot open temp file to write %s\n",
- poms1.data());
+ fprintf(stdout,"Cannot open temp file to write %s\n", poms1.toStdString().c_str());
exit(1);
}
exit(1);
}
@@
-133,7
+134,7
@@
int main(int argc,char **argv)
QTextStream comps(&compfile);
QTextStream src(&srcfile);
QTextStream comps(&compfile);
QTextStream src(&srcfile);
- while (!src.
eof
()) {
+ while (!src.
atEnd
()) {
poms = src.readLine();
i = poms.find("#include");
if (i != -1) {
poms = src.readLine();
i = poms.find("#include");
if (i != -1) {
@@
-147,17
+148,17
@@
int main(int argc,char **argv)
poms1 = poms.mid(i + 1, j - i - 1);
p = new IncFile((char*)poms1.ascii(),
currentline);
poms1 = poms.mid(i + 1, j - i - 1);
p = new IncFile((char*)poms1.ascii(),
currentline);
- poms2.sprintf("%s%s", homedir, poms1.
data
());
- QFile pomf(poms2.
data
());
+ poms2.sprintf("%s%s", homedir, poms1.
toStdString().c_str
());
+ QFile pomf(poms2.
toStdString().c_str
());
if (!pomf.open(IO_ReadOnly)) {
fprintf(stdout, "Cannot open include "
if (!pomf.open(IO_ReadOnly)) {
fprintf(stdout, "Cannot open include "
- "file: %s\n", poms2.
data
());
+ "file: %s\n", poms2.
toStdString().c_str
());
exit(1);
}
QTextStream pomstream(&pomf);
exit(1);
}
QTextStream pomstream(&pomf);
- while (!pomstream.
eof
()) {
+ while (!pomstream.
atEnd
()) {
poms1 = pomstream.readLine();
poms1 = pomstream.readLine();
- comps << poms1.
data
();
+ comps << poms1.
toStdString().c_str
();
comps << "\n";
p->len++;
currentline++;
comps << "\n";
p->len++;
currentline++;
@@
-166,7
+167,7
@@
int main(int argc,char **argv)
inc.append(p);
}
} else {
inc.append(p);
}
} else {
- comps << poms.
data
();
+ comps << poms.
toStdString().c_str
();
comps << "\n";
}
currentline++;
comps << "\n";
}
currentline++;
@@
-176,7
+177,7
@@
int main(int argc,char **argv)
compfile.close();
poms.sprintf("%s/cmp01.lcd", mydir);
compfile.close();
poms.sprintf("%s/cmp01.lcd", mydir);
- unlink(poms.
data
());
+ unlink(poms.
toStdString().c_str
());
sprintf(ss, "%s/loglan %s/cmp01 > %s/.cmp00", mydir, mydir, mydir);
if (system(ss) == -1) {
sprintf(ss, "%s/loglan %s/cmp01 > %s/.cmp00", mydir, mydir, mydir);
if (system(ss) == -1) {
@@
-186,9
+187,9
@@
int main(int argc,char **argv)
poms1.sprintf("%s.lcd", fname);
poms1.sprintf("%s.lcd", fname);
- if (QFile::exists(poms.
data
())) {
- rename(poms.
data(), poms1.data
());
- unlink(poms.
data
());
+ if (QFile::exists(poms.
toStdString().c_str
())) {
+ rename(poms.
toStdString().c_str(), poms1.toStdString().c_str
());
+ unlink(poms.
toStdString().c_str
());
fprintf(stdout, "Compile ok\n");
sprintf(ss,"%s/gen %s", mydir, fname);
if (system(ss)==-1) {
fprintf(stdout, "Compile ok\n");
sprintf(ss,"%s/gen %s", mydir, fname);
if (system(ss)==-1) {
@@
-196,13
+197,13
@@
int main(int argc,char **argv)
exit(1);
}
poms.sprintf("%s.ccd", fname);
exit(1);
}
poms.sprintf("%s.ccd", fname);
- if (QFile::exists(poms.
data
())) {
- unlink(poms1.
data
());
+ if (QFile::exists(poms.
toStdString().c_str
())) {
+ unlink(poms1.
toStdString().c_str
());
}
} else {
fprintf(stdout, "Errors\n");
poms.sprintf("%s/.cmp00", mydir);
}
} else {
fprintf(stdout, "Errors\n");
poms.sprintf("%s/.cmp00", mydir);
- QFile err(poms.
data
());
+ QFile err(poms.
toStdString().c_str
());
if (!err.open(IO_ReadOnly)) {
fprintf(stdout,"Cannot open error file\n");
if (!err.open(IO_ReadOnly)) {
fprintf(stdout,"Cannot open error file\n");
@@
-213,12
+214,12
@@
int main(int argc,char **argv)
poms = errstream.readLine();
i = poms.find("LOGLAN-82");
poms = errstream.readLine();
i = poms.find("LOGLAN-82");
- while ((!errstream.
eof
()) && (i == -1)) {
+ while ((!errstream.
atEnd
()) && (i == -1)) {
poms = errstream.readLine();
i = poms.find("LOGLAN-82");
}
poms = errstream.readLine();
i = poms.find("LOGLAN-82");
}
- while (!errstream.
eof
()) {
+ while (!errstream.
atEnd
()) {
poms = errstream.readLine();
i = poms.find("ERROR");
if (i != -1) {
poms = errstream.readLine();
i = poms.find("ERROR");
if (i != -1) {
@@
-231,16
+232,16
@@
int main(int argc,char **argv)
if (fl != NULL)
fprintf(stdout, "%s: ", fl->filename);
fprintf(stdout, "%d %s\n",
if (fl != NULL)
fprintf(stdout, "%s: ", fl->filename);
fprintf(stdout, "%d %s\n",
- tline, poms2.
data
());
+ tline, poms2.
toStdString().c_str
());
}
}
err.close();
} /* errors */
poms.sprintf("%s/cmp01.log",mydir);
}
}
err.close();
} /* errors */
poms.sprintf("%s/cmp01.log",mydir);
- unlink(poms.
data
());
+ unlink(poms.
toStdString().c_str
());
poms.sprintf("%s/.cmp00",mydir);
poms.sprintf("%s/.cmp00",mydir);
- unlink(poms.
data
());
+ unlink(poms.
toStdString().c_str
());
return 0;
}
return 0;
}