[Kst] branches/work/kst/1.6/kst
George Staikos
staikos at kde.org
Mon Apr 28 06:01:22 CEST 2008
SVN commit 801887 by staikos:
patch from Karin and Claude to fix dmc build
M +11 -10 configure.in.in
M +1 -0 src/datasources/dmc/dmcdata.cpp
M +109 -31 src/datasources/dmc/dmcobj.cpp
--- branches/work/kst/1.6/kst/configure.in.in #801886:801887
@@ -25,14 +25,20 @@
ac_piolib_libraries="-L$withval/`uname -s`-`uname -m`"
])
+AC_ARG_WITH(postgres-headers,
+ AC_HELP_STRING([--with-postgres-headers=DIR],[where the PostgreSQL headers are installed ]),
+ [ ac_postgres_includes="-I$withval"
+ ])
+
+
all_includes_save="$all_includes"
-all_includes="$all_includes $ac_piolib_includes"
-KDE_CHECK_HEADER(HL2_PIOLIB/PIOLib.h, AC_DEFINE(HAVE_PIOLIB_H, 1, [If we have piolib headers]) have_piolib_h=yes PIOINCLUDES="$ac_piolib_includes", , )
+all_includes="$all_includes $ac_piolib_includes $ac_postgres_includes"
+KDE_CHECK_HEADER(PioLib/HL2_PIOLIB/PIOLib.h, AC_DEFINE(HAVE_PIOLIB_H, 1, [If we have piolib headers]) have_piolib_h=yes PIOINCLUDES="$ac_piolib_includes", , )
all_includes="$all_includes_save"
ldflags_save="$LDFLAGS"
LDFLAGS="$LDFLAGS $ac_piolib_libraries"
-KDE_CHECK_LIB(piolib, PIOGetObjectList, PIOLIBS="$ac_piolib_libraries -lpiolib $PIOLIBS", , -lm -lpthread -ldl)
+KDE_CHECK_LIB(piolib, PIOGetObjectList, PIOLIBS="$ac_piolib_libraries -lpq -lpiolib $PIOLIBS", , -lm -lpthread -ldl -lpq)
LDFLAGS="$ldflags_save"
if test "x$ac_cv_lib_piolib_PIOGetObjectList" = "xyes"; then
@@ -51,14 +57,9 @@
AC_ARG_WITH(dmc,
AC_HELP_STRING([--with-dmc=DIR],[where the root of DMC is installed ]),
[ ac_dmc_includes="-I$withval -I$withval/PioLib"
- ac_dmc_libraries="-L$withval/`uname -s`-`uname -m`"
+ ac_dmc_libraries="-L$withval/`uname -s`-`uname -m` -L$withval/../../../InstallArea/`uname -s`-`uname -m`/lib"
])
-AC_ARG_WITH(postgres-headers,
- AC_HELP_STRING([--with-postgres-headers=DIR],[where the PostgreSQL headers are installed ]),
- [ ac_postgres_includes="-I$withval"
- ])
-
all_includes_save="$all_includes"
all_includes="$all_includes $ac_dmc_includes $ac_postgres_includes"
KDE_CHECK_HEADER(HL2_DMC/PIODB.h, AC_DEFINE(HAVE_PIODB_H, 1, [If we have dmc headers]) have_piodb_h=yes DMCINCLUDES="$ac_dmc_includes $ac_postgres_includes", , )
@@ -66,7 +67,7 @@
ldflags_save="$LDFLAGS"
LDFLAGS="$LDFLAGS $ac_dmc_libraries"
-KDE_CHECK_LIB(dmc, PIOGetObjectList, DMCLIBS="$ac_dmc_libraries -ldmc -lpq -lxml2 $DMCLIBS", , -lm -lpthread -ldl -lpq -lxml2)
+KDE_CHECK_LIB(dmc, PIOGetObjectList, DMCLIBS="$ac_dmc_libraries -ldmc -lpq -lxml2 -lsqlite -ltransfunc $DMCLIBS", , -lm -lpthread -ldl -lpq -lxml2 -lsqlite -ltransfunc)
LDFLAGS="$ldflags_save"
if test "x$ac_cv_lib_dmc_PIOGetObjectList" = "xyes"; then
--- branches/work/kst/1.6/kst/src/datasources/dmc/dmcdata.cpp #801886:801887
@@ -29,6 +29,7 @@
bool validDatabase(const QString& db) {
if (getenv("PGUSER") == NULL || getenv("DBROOT") == NULL) {
+ qDebug("DMC is missing environment variables");
/* DMC will lock up if these environment variables are not set */
return false;
}
--- branches/work/kst/1.6/kst/src/datasources/dmc/dmcobj.cpp #801886:801887
@@ -52,6 +52,9 @@
PIOLONG *firstIndex;
PIOLONG *lastIndex;
+ PIOSTRING *TOItypes;
+ PIOSTRING *Datatypes;
+
PIOGroup *_group;
bool _valid;
};
@@ -234,6 +237,10 @@
return 0;
}
+#ifdef PIOLIBDEBUG
+ kdDebug() << "Found object " << object << " in group " << _group << " , type is " << g->objTypes[i] << ", data type is " << g->Datatypes[i] << endl;
+#endif
+
QString range("");
if (start < 0 || end < start) {
@@ -253,48 +260,98 @@
/* open the group only for reading this object */
PIOGroup *MyGroup=NULL;
+ long n=0;
- long n = PIORead_1(ObjName,
- const_cast<char*>("Written"),
- const_cast<char*>("PIODOUBLE"),
- const_cast<char*>(range.latin1()),
- &MyGroup, &MyObject, &MyData, &MyDataFlag);
+ if (strncmp(g->Datatypes[i], "PIOFLAG", 7) == 0) {
+ n = PIORead_1(ObjName,
+ const_cast<char*>("Written"),
+ const_cast<char*>("PIOFLAG"),
+ const_cast<char*>(range.latin1()),
+ &MyGroup, &MyObject, &MyData, &MyDataFlag);
#ifdef PIOLIBDEBUG
- kdDebug() << "READ " << n << " doubles." << endl;
+ kdDebug() << "READ " << n << " flags." << endl;
#endif
- if (n < 0) { // error
- // FIXME - might have to reset() here
- abort();
- n = 0;
- return n;
- }
+ if (n < 0) { // error
+ // FIXME - might have to reset() here
+ abort();
+ n = 0;
+ return n;
+ }
- {
- /* table to store the sample validity */
- PIOFLAG *Mask = (PIOFLAG*)_PIOMALLOC(n);
+ {
+ /* table to store the sample validity */
+ PIOFLAG *Mask = (PIOFLAG*)_PIOMALLOC(n);
- PIORead_2(buf, 0L, Mask,
- ObjName,
+ /* temporary buffer */
+ PIOFLAG *flagbuf = (PIOFLAG*)_PIOMALLOC(n);
+
+ PIORead_2(flagbuf, 0L, Mask,
+ ObjName,
+ const_cast<char*>("PIOFLAG"),
+ const_cast<char*>(range.latin1()),
+ const_cast<char*>("Written"),
+ MyGroup,
+ &MyObject,
+ &MyData,
+ &MyDataFlag,
+ PIOLONG(n));
+
+ for (i = 0; i < n; i++) {
+ if (Mask[i] == 0) {
+ buf[i] = NOPOINT;
+ } else {
+ // just cast flags to doubles
+ buf[i] = (PIODOUBLE)flagbuf[i];
+ }
+ }
+
+ _PIOFREE(flagbuf);
+ _PIOFREE(Mask);
+ }
+ } else {
+ n = PIORead_1(ObjName,
+ const_cast<char*>("Written"),
const_cast<char*>("PIODOUBLE"),
const_cast<char*>(range.latin1()),
- const_cast<char*>("Written"),
- MyGroup,
- &MyObject,
- &MyData,
- &MyDataFlag,
- PIOLONG(n));
+ &MyGroup, &MyObject, &MyData, &MyDataFlag);
- /* the group is close no need to deletelink */
- //PIODeleteLink(buf, g->_group);
+#ifdef PIOLIBDEBUG
+ kdDebug() << "READ " << n << " doubles." << endl;
+#endif
+ if (n < 0) { // error
+ // FIXME - might have to reset() here
+ abort();
+ n = 0;
+ return n;
+ }
- for (i = 0; i < n; i++) {
- if (Mask[i] == 0) {
- buf[i] = NOPOINT;
+ {
+ /* table to store the sample validity */
+ PIOFLAG *Mask = (PIOFLAG*)_PIOMALLOC(n);
+
+ PIORead_2(buf, 0L, Mask,
+ ObjName,
+ const_cast<char*>("PIODOUBLE"),
+ const_cast<char*>(range.latin1()),
+ const_cast<char*>("Written"),
+ MyGroup,
+ &MyObject,
+ &MyData,
+ &MyDataFlag,
+ PIOLONG(n));
+
+ /* the group is close no need to deletelink */
+ //PIODeleteLink(buf, g->_group);
+
+ for (i = 0; i < n; i++) {
+ if (Mask[i] == 0) {
+ buf[i] = NOPOINT;
+ }
}
+
+ _PIOFREE(Mask);
}
-
- _PIOFREE(Mask);
}
#ifdef PIOLIBDEBUG
kdDebug() << "Read " << n << " samples of data. Range = [" << range << "]" << endl;
@@ -452,6 +509,8 @@
firstIndex = 0L;
lastIndex = 0L;
objectListSize = 0;
+ TOItypes = 0L;
+ Datatypes = 0L;
_group = 0L;
_valid = false;
@@ -471,6 +530,11 @@
_PIOFREE(objTypes);
objTypes = 0L;
+ delete[] TOItypes;
+ TOItypes = 0L;
+ delete[] Datatypes;
+ Datatypes = 0L;
+
objectListSize = 0;
_valid = false;
}
@@ -499,12 +563,16 @@
PIOErr e = PIOGetObjectList(&objNames, &objTypes, _group);
if (e > 0) {
- _valid = true;
delete[] firstIndex;
delete[] lastIndex;
firstIndex = new PIOLONG[e];
lastIndex = new PIOLONG[e];
+ delete[] TOItypes;
+ TOItypes = new PIOSTRING[e];
+ delete[] Datatypes;
+ Datatypes = new PIOSTRING[e];
objectListSize = e;
+ _valid = true;
#ifdef PIOLIBDEBUG
kdDebug() << " -> info acquired." << endl;
@@ -520,6 +588,16 @@
for (int i = 0; i < e; ++i) {
firstIndex[i] = FirstIdx;
lastIndex[i] = LastIdx;
+
+ PIOLONG beginIdx, endIdx;
+ PIOSTRING author, date;
+ PIOErr ret = PIOInfoObject(TOItypes[i], Datatypes[i], &beginIdx, &endIdx, author, date, objNames[i], _group);
+#ifdef PIOLIBDEBUG
+ kdDebug() << " PIOInfoObject(" << TOItypes[i] << "," << Datatypes[i] << "," << beginIdx << "," << endIdx << "," << author << "," << date << "," << objNames[i] << ") returned " << ret << endl;
+#endif
+ if (ret != 0) {
+ _valid = false;
+ }
}
}
return _valid;
More information about the Kst
mailing list