summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOle Streicher <olebole@debian.org>2016-06-05 12:13:20 (GMT)
committerOle Streicher <olebole@debian.org>2016-06-05 12:13:20 (GMT)
commit6fd5fd65d1d2ad1c6b20630af4dcfcda36635fd3 (patch)
treecc2c1e64693f15675b62cdc1c55f97466e5e55c8
parent0dec7bfd2833105b5c1a59893f0b6da802fbaedc (diff)
downloadblt-6fd5fd65d1d2ad1c6b20630af4dcfcda36635fd3.zip
blt-6fd5fd65d1d2ad1c6b20630af4dcfcda36635fd3.tar.gz
blt-6fd5fd65d1d2ad1c6b20630af4dcfcda36635fd3.tar.bz2
Create stubs library for simpler linking f.e. with saotk
-rwxr-xr-xMakefile.in4
-rwxr-xr-xconfigure.in4
-rw-r--r--src/tkblt.decl88
-rw-r--r--src/tkbltDecls.h146
-rw-r--r--src/tkbltInt.C5
-rw-r--r--src/tkbltStubInit.c29
-rw-r--r--src/tkbltStubLib.C21
-rw-r--r--src/tkbltVector.h2
-rw-r--r--tclconfig/tcl.m42
9 files changed, 296 insertions, 5 deletions
diff --git a/Makefile.in b/Makefile.in
index 5f0401e..67664be 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -34,7 +34,7 @@
#========================================================================
PKG_SOURCES = @PKG_SOURCES@
-PKG_OBJECTS = @PKG_OBJECTS@
+PKG_OBJECTS = @PKG_OBJECTS@ @PKG_STUB_OBJECTS@
PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
@@ -60,7 +60,7 @@ PKG_HEADERS = @PKG_HEADERS@
PKG_LIB_FILE = @PKG_LIB_FILE@
PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
-lib_BINARIES = $(PKG_LIB_FILE)
+lib_BINARIES = $(PKG_LIB_FILE) $(PKG_STUB_LIB_FILE)
BINARIES = $(lib_BINARIES)
SHELL = @SHELL@
diff --git a/configure.in b/configure.in
index 73ea4df..fcf5455 100755
--- a/configure.in
+++ b/configure.in
@@ -119,11 +119,11 @@ src/tkbltVecOp.C
src/tkbltVecMath.C
src/tkbltVector.C
])
-TEA_ADD_HEADERS([src/tkbltVector.h])
+TEA_ADD_HEADERS([src/tkbltVector.h src/tkbltDecls.h])
TEA_ADD_INCLUDES([-I./src])
TEA_ADD_LIBS([-lstdc++])
TEA_ADD_CFLAGS([])
-TEA_ADD_STUB_SOURCES([])
+TEA_ADD_STUB_SOURCES([src/tkbltStubLib.C])
TEA_ADD_TCL_SOURCES([library/graph.tcl])
#--------------------------------------------------------------------
diff --git a/src/tkblt.decl b/src/tkblt.decl
new file mode 100644
index 0000000..8354376
--- /dev/null
+++ b/src/tkblt.decl
@@ -0,0 +1,88 @@
+library tkblt
+interface tkblt
+
+declare 0 generic {
+ int Blt_CreateVector(Tcl_Interp* interp, const char *vecName,
+ int size, Blt_Vector** vecPtrPtr)
+}
+
+declare 1 generic {
+ int Blt_CreateVector2(Tcl_Interp* interp, const char *vecName,
+ const char *cmdName, const char *varName,
+ int initialSize, Blt_Vector **vecPtrPtr)
+}
+
+declare 2 generic {
+ int Blt_DeleteVectorByName(Tcl_Interp* interp, const char *vecName)
+}
+
+declare 3 generic {
+ int Blt_DeleteVector(Blt_Vector *vecPtr)
+}
+
+declare 4 generic {
+ int Blt_GetVector(Tcl_Interp* interp, const char *vecName,
+ Blt_Vector **vecPtrPtr)
+}
+
+declare 5 generic {
+ int Blt_GetVectorFromObj(Tcl_Interp* interp, Tcl_Obj *objPtr,
+ Blt_Vector **vecPtrPtr)
+}
+
+declare 6 generic {
+ int Blt_ResetVector(Blt_Vector *vecPtr, double *dataArr, int n,
+ int arraySize, Tcl_FreeProc *freeProc)
+}
+
+declare 7 generic {
+ int Blt_ResizeVector(Blt_Vector *vecPtr, int n)
+}
+
+declare 8 generic {
+ int Blt_VectorExists(Tcl_Interp* interp, const char *vecName)
+}
+
+declare 9 generic {
+ int Blt_VectorExists2(Tcl_Interp* interp, const char *vecName)
+}
+
+declare 10 generic {
+ Blt_VectorId Blt_AllocVectorId(Tcl_Interp* interp, const char *vecName)
+}
+
+declare 11 generic {
+ int Blt_GetVectorById(Tcl_Interp* interp, Blt_VectorId clientId,
+ Blt_Vector **vecPtrPtr)
+}
+
+declare 12 generic {
+ void Blt_SetVectorChangedProc(Blt_VectorId clientId,
+ Blt_VectorChangedProc *proc,
+ ClientData clientData)
+}
+
+declare 13 generic {
+ void Blt_FreeVectorId(Blt_VectorId clientId)
+}
+
+declare 14 generic {
+ const char *Blt_NameOfVectorId(Blt_VectorId clientId)
+}
+
+declare 15 generic {
+ const char *Blt_NameOfVector(Blt_Vector *vecPtr)
+}
+
+declare 16 generic {
+ void Blt_InstallIndexProc(Tcl_Interp* interp, const char *indexName,
+ Blt_VectorIndexProc * procPtr)
+}
+
+declare 17 generic {
+ double Blt_VecMin(Blt_Vector *vPtr)
+}
+
+declare 18 generic {
+ double Blt_VecMax(Blt_Vector *vPtr)
+}
diff --git a/src/tkbltDecls.h b/src/tkbltDecls.h
new file mode 100644
index 0000000..ca194cd
--- /dev/null
+++ b/src/tkbltDecls.h
@@ -0,0 +1,146 @@
+/* !BEGIN!: Do not edit below this line. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Exported function declarations:
+ */
+
+/* 0 */
+EXTERN int Blt_CreateVector(Tcl_Interp*interp,
+ const char *vecName, int size,
+ Blt_Vector**vecPtrPtr);
+/* 1 */
+EXTERN int Blt_CreateVector2(Tcl_Interp*interp,
+ const char *vecName, const char *cmdName,
+ const char *varName, int initialSize,
+ Blt_Vector **vecPtrPtr);
+/* 2 */
+EXTERN int Blt_DeleteVectorByName(Tcl_Interp*interp,
+ const char *vecName);
+/* 3 */
+EXTERN int Blt_DeleteVector(Blt_Vector *vecPtr);
+/* 4 */
+EXTERN int Blt_GetVector(Tcl_Interp*interp, const char *vecName,
+ Blt_Vector **vecPtrPtr);
+/* 5 */
+EXTERN int Blt_GetVectorFromObj(Tcl_Interp*interp,
+ Tcl_Obj *objPtr, Blt_Vector **vecPtrPtr);
+/* 6 */
+EXTERN int Blt_ResetVector(Blt_Vector *vecPtr, double *dataArr,
+ int n, int arraySize, Tcl_FreeProc *freeProc);
+/* 7 */
+EXTERN int Blt_ResizeVector(Blt_Vector *vecPtr, int n);
+/* 8 */
+EXTERN int Blt_VectorExists(Tcl_Interp*interp,
+ const char *vecName);
+/* 9 */
+EXTERN int Blt_VectorExists2(Tcl_Interp*interp,
+ const char *vecName);
+/* 10 */
+EXTERN Blt_VectorId Blt_AllocVectorId(Tcl_Interp*interp,
+ const char *vecName);
+/* 11 */
+EXTERN int Blt_GetVectorById(Tcl_Interp*interp,
+ Blt_VectorId clientId,
+ Blt_Vector **vecPtrPtr);
+/* 12 */
+EXTERN void Blt_SetVectorChangedProc(Blt_VectorId clientId,
+ Blt_VectorChangedProc *proc,
+ ClientData clientData);
+/* 13 */
+EXTERN void Blt_FreeVectorId(Blt_VectorId clientId);
+/* 14 */
+EXTERN const char * Blt_NameOfVectorId(Blt_VectorId clientId);
+/* 15 */
+EXTERN const char * Blt_NameOfVector(Blt_Vector *vecPtr);
+/* 16 */
+EXTERN void Blt_InstallIndexProc(Tcl_Interp*interp,
+ const char *indexName,
+ Blt_VectorIndexProc *procPtr);
+/* 17 */
+EXTERN double Blt_VecMin(Blt_Vector *vPtr);
+/* 18 */
+EXTERN double Blt_VecMax(Blt_Vector *vPtr);
+
+typedef struct TkbltStubs {
+ int magic;
+ void *hooks;
+
+ int (*blt_CreateVector) (Tcl_Interp*interp, const char *vecName, int size, Blt_Vector**vecPtrPtr); /* 0 */
+ int (*blt_CreateVector2) (Tcl_Interp*interp, const char *vecName, const char *cmdName, const char *varName, int initialSize, Blt_Vector **vecPtrPtr); /* 1 */
+ int (*blt_DeleteVectorByName) (Tcl_Interp*interp, const char *vecName); /* 2 */
+ int (*blt_DeleteVector) (Blt_Vector *vecPtr); /* 3 */
+ int (*blt_GetVector) (Tcl_Interp*interp, const char *vecName, Blt_Vector **vecPtrPtr); /* 4 */
+ int (*blt_GetVectorFromObj) (Tcl_Interp*interp, Tcl_Obj *objPtr, Blt_Vector **vecPtrPtr); /* 5 */
+ int (*blt_ResetVector) (Blt_Vector *vecPtr, double *dataArr, int n, int arraySize, Tcl_FreeProc *freeProc); /* 6 */
+ int (*blt_ResizeVector) (Blt_Vector *vecPtr, int n); /* 7 */
+ int (*blt_VectorExists) (Tcl_Interp*interp, const char *vecName); /* 8 */
+ int (*blt_VectorExists2) (Tcl_Interp*interp, const char *vecName); /* 9 */
+ Blt_VectorId (*blt_AllocVectorId) (Tcl_Interp*interp, const char *vecName); /* 10 */
+ int (*blt_GetVectorById) (Tcl_Interp*interp, Blt_VectorId clientId, Blt_Vector **vecPtrPtr); /* 11 */
+ void (*blt_SetVectorChangedProc) (Blt_VectorId clientId, Blt_VectorChangedProc *proc, ClientData clientData); /* 12 */
+ void (*blt_FreeVectorId) (Blt_VectorId clientId); /* 13 */
+ const char * (*blt_NameOfVectorId) (Blt_VectorId clientId); /* 14 */
+ const char * (*blt_NameOfVector) (Blt_Vector *vecPtr); /* 15 */
+ void (*blt_InstallIndexProc) (Tcl_Interp*interp, const char *indexName, Blt_VectorIndexProc *procPtr); /* 16 */
+ double (*blt_VecMin) (Blt_Vector *vPtr); /* 17 */
+ double (*blt_VecMax) (Blt_Vector *vPtr); /* 18 */
+} TkbltStubs;
+
+extern const TkbltStubs *tkbltStubsPtr;
+
+#ifdef __cplusplus
+}
+#endif
+
+#if defined(USE_TKBLT_STUBS)
+
+/*
+ * Inline function declarations:
+ */
+
+#define Blt_CreateVector \
+ (tkbltStubsPtr->blt_CreateVector) /* 0 */
+#define Blt_CreateVector2 \
+ (tkbltStubsPtr->blt_CreateVector2) /* 1 */
+#define Blt_DeleteVectorByName \
+ (tkbltStubsPtr->blt_DeleteVectorByName) /* 2 */
+#define Blt_DeleteVector \
+ (tkbltStubsPtr->blt_DeleteVector) /* 3 */
+#define Blt_GetVector \
+ (tkbltStubsPtr->blt_GetVector) /* 4 */
+#define Blt_GetVectorFromObj \
+ (tkbltStubsPtr->blt_GetVectorFromObj) /* 5 */
+#define Blt_ResetVector \
+ (tkbltStubsPtr->blt_ResetVector) /* 6 */
+#define Blt_ResizeVector \
+ (tkbltStubsPtr->blt_ResizeVector) /* 7 */
+#define Blt_VectorExists \
+ (tkbltStubsPtr->blt_VectorExists) /* 8 */
+#define Blt_VectorExists2 \
+ (tkbltStubsPtr->blt_VectorExists2) /* 9 */
+#define Blt_AllocVectorId \
+ (tkbltStubsPtr->blt_AllocVectorId) /* 10 */
+#define Blt_GetVectorById \
+ (tkbltStubsPtr->blt_GetVectorById) /* 11 */
+#define Blt_SetVectorChangedProc \
+ (tkbltStubsPtr->blt_SetVectorChangedProc) /* 12 */
+#define Blt_FreeVectorId \
+ (tkbltStubsPtr->blt_FreeVectorId) /* 13 */
+#define Blt_NameOfVectorId \
+ (tkbltStubsPtr->blt_NameOfVectorId) /* 14 */
+#define Blt_NameOfVector \
+ (tkbltStubsPtr->blt_NameOfVector) /* 15 */
+#define Blt_InstallIndexProc \
+ (tkbltStubsPtr->blt_InstallIndexProc) /* 16 */
+#define Blt_VecMin \
+ (tkbltStubsPtr->blt_VecMin) /* 17 */
+#define Blt_VecMax \
+ (tkbltStubsPtr->blt_VecMax) /* 18 */
+
+#endif /* defined(USE_TKBLT_STUBS) */
+
+/* !END!: Do not edit above this line. */
diff --git a/src/tkbltInt.C b/src/tkbltInt.C
index 0ac31ae..f5b0a60 100644
--- a/src/tkbltInt.C
+++ b/src/tkbltInt.C
@@ -39,6 +39,8 @@ Tcl_AppInitProc Tkblt_SafeInit;
Tcl_AppInitProc Blt_VectorCmdInitProc;
Tcl_AppInitProc Blt_GraphCmdInitProc;
+#include "tkbltStubInit.c"
+
int Tkblt_Init(Tcl_Interp* interp)
{
Tcl_Namespace *nsPtr;
@@ -63,6 +65,9 @@ int Tkblt_Init(Tcl_Interp* interp)
if (Tcl_PkgProvide(interp, PACKAGE_NAME, PACKAGE_VERSION) != TCL_OK)
return TCL_ERROR;
+ if (Tcl_PkgProvideEx(interp, PACKAGE_NAME, PACKAGE_VERSION, &tkbltStubs) != TCL_OK)
+ return TCL_ERROR;
+
return TCL_OK;
}
diff --git a/src/tkbltStubInit.c b/src/tkbltStubInit.c
new file mode 100644
index 0000000..b54cc97
--- /dev/null
+++ b/src/tkbltStubInit.c
@@ -0,0 +1,29 @@
+#include <tkbltVector.h>
+
+/* !BEGIN!: Do not edit below this line. */
+
+const TkbltStubs tkbltStubs = {
+ TCL_STUB_MAGIC,
+ 0,
+ Blt_CreateVector, /* 0 */
+ Blt_CreateVector2, /* 1 */
+ Blt_DeleteVectorByName, /* 2 */
+ Blt_DeleteVector, /* 3 */
+ Blt_GetVector, /* 4 */
+ Blt_GetVectorFromObj, /* 5 */
+ Blt_ResetVector, /* 6 */
+ Blt_ResizeVector, /* 7 */
+ Blt_VectorExists, /* 8 */
+ Blt_VectorExists2, /* 9 */
+ Blt_AllocVectorId, /* 10 */
+ Blt_GetVectorById, /* 11 */
+ Blt_SetVectorChangedProc, /* 12 */
+ Blt_FreeVectorId, /* 13 */
+ Blt_NameOfVectorId, /* 14 */
+ Blt_NameOfVector, /* 15 */
+ Blt_InstallIndexProc, /* 16 */
+ Blt_VecMin, /* 17 */
+ Blt_VecMax, /* 18 */
+};
+
+/* !END!: Do not edit above this line. */
diff --git a/src/tkbltStubLib.C b/src/tkbltStubLib.C
new file mode 100644
index 0000000..b4180f3
--- /dev/null
+++ b/src/tkbltStubLib.C
@@ -0,0 +1,21 @@
+#ifndef USE_TCL_STUBS
+#define USE_TCL_STUBS
+#endif
+
+#include <tcl.h>
+
+void *tkbltStubsPtr;
+
+CONST char *
+Tkblt_InitStubs(Tcl_Interp *interp, CONST char *version, int exact)
+{
+ CONST char *result;
+
+ result = Tcl_PkgRequireEx(interp, "tkblt", version, exact,
+ (ClientData *) &tkbltStubsPtr);
+ if (!result || !tkbltStubsPtr) {
+ return (char *) NULL;
+ }
+
+ return result;
+}
diff --git a/src/tkbltVector.h b/src/tkbltVector.h
index 04d5b1d..a59e542 100644
--- a/src/tkbltVector.h
+++ b/src/tkbltVector.h
@@ -123,4 +123,6 @@ extern "C" {
double Blt_VecMax(Blt_Vector *vPtr);
}
+#include "tkbltDecls.h"
+
#endif /* _BLT_VECTOR_H */
diff --git a/tclconfig/tcl.m4 b/tclconfig/tcl.m4
index c641fe0..c8989eb 100644
--- a/tclconfig/tcl.m4
+++ b/tclconfig/tcl.m4
@@ -2995,7 +2995,7 @@ AC_DEFUN([TEA_ADD_STUB_SOURCES], [
fi
PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
# this assumes it is in a VPATH dir
- i=`basename $i`
+ #i=`basename $i`
# handle user calling this before or after TEA_SETUP_COMPILER
if test x"${OBJEXT}" != x ; then
j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"