summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredman <redman>1999-03-10 22:55:51 (GMT)
committerredman <redman>1999-03-10 22:55:51 (GMT)
commitafe8ba0aa0149beda44b0a95e50fde0897a619e4 (patch)
tree193cbcdde0237a3271891c52a8249cfff38a083a
parent10a767e6406260972a8899c07a945a9460f30258 (diff)
downloadtcl-afe8ba0aa0149beda44b0a95e50fde0897a619e4.zip
tcl-afe8ba0aa0149beda44b0a95e50fde0897a619e4.tar.gz
tcl-afe8ba0aa0149beda44b0a95e50fde0897a619e4.tar.bz2
Add Tcl_GetVersion C API
-rw-r--r--generic/tcl.h27
-rw-r--r--generic/tclBasic.c41
2 files changed, 56 insertions, 12 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index 55660cf..48869d1 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tcl.h,v 1.35 1999/03/10 06:12:55 stanton Exp $
+ * RCS: @(#) $Id: tcl.h,v 1.36 1999/03/10 22:55:51 redman Exp $
*/
#ifndef _TCL
@@ -31,17 +31,18 @@
* win/README.binary
* mac/README
*
- * The release level should be 0 for alpha, 1 for beta, and 2 for
- * final/patch. The release serial value is the number that follows the
- * "a", "b", or "p" in the patch level; for example, if the patch level
- * is 7.6b2, TCL_RELEASE_SERIAL is 2. It restarts at 1 whenever the
- * release level is changed, except for the final release which is 0
- * (the first patch will start at 1).
*/
+
+typedef enum {
+ TCL_ALPHA_RELEASE = 0,
+ TCL_BETA_RELEASE = 1,
+ TCL_FINAL_RELEASE = 2
+} Tcl_ReleaseType;
+
#define TCL_MAJOR_VERSION 8
#define TCL_MINOR_VERSION 0
-#define TCL_RELEASE_LEVEL 2
+#define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE
#define TCL_RELEASE_SERIAL 5
#define TCL_VERSION "8.0"
@@ -1097,9 +1098,13 @@ EXTERN char * Tcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp,
* Public functions that are not accessible via the stubs table.
*/
-EXTERN void Tcl_InitMemory _ANSI_ARGS_((Tcl_Interp *interp));
-EXTERN void Tcl_Main _ANSI_ARGS_((int argc, char **argv,
- Tcl_AppInitProc *appInitProc));
+EXTERN void Tcl_InitMemory _ANSI_ARGS_((Tcl_Interp *interp));
+EXTERN void Tcl_Main _ANSI_ARGS_((int argc, char **argv,
+ Tcl_AppInitProc *appInitProc));
+EXTERN void Tcl_GetVersion _ANSI_ARGS_((int *major,
+ int *minor, int *patchLevel, Tcl_ReleaseType *type));
+
+
/*
* Convenience declaration of Tcl_AppInit for backwards compatibility.
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 74d8bd1..7a41b21 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.16 1999/03/10 05:52:46 stanton Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.17 1999/03/10 22:55:51 redman Exp $
*/
#include "tclInt.h"
@@ -4153,3 +4153,42 @@ Tcl_AllowExceptions(interp)
iPtr->evalFlags |= TCL_ALLOW_EXCEPTIONS;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tcl_GetVersion
+ *
+ * Get the Tcl major, minor, and patchlevel version numbers and
+ * the release type. A patch is a release type TCL_FINAL_RELEASE
+ * with a patchLevel > 0.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void Tcl_GetVersion(major, minor, patchLevel, type)
+ int *major;
+ int *minor;
+ int *patchLevel;
+ Tcl_ReleaseType *type;
+{
+ if (major != NULL) {
+ *major = TCL_MAJOR_VERSION;
+ }
+ if (minor != NULL) {
+ *minor = TCL_MINOR_VERSION;
+ }
+ if (patchLevel != NULL) {
+ *patchLevel = TCL_RELEASE_SERIAL;
+ }
+ if (type != NULL) {
+ *type = TCL_RELEASE_LEVEL;
+ }
+}
+