diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2015-04-21 12:44:46 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2015-04-21 12:44:46 +0000 |
| commit | 333b5268c3d8a956e3dd8e8085a090b333417853 (patch) | |
| tree | f1762452f9cde7fa791df3fda5d27be4bfe8d81d | |
| parent | b79ad86683f13418a77aa2eab6557158b2bfc3a8 (diff) | |
Add FLTK version test program examples/fltk-versions.cxx.
This program can be used to verify that the FLTK runtime system
(ABI version) is binary compatible with the compiled and linked program.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10712 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | examples/Makefile | 1 | ||||
| -rw-r--r-- | examples/fltk-versions.cxx | 85 |
3 files changed, 87 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index 00cd16ada..5a7822bf7 100644 --- a/.gitignore +++ b/.gitignore @@ -64,6 +64,7 @@ # /examples/ /examples/*.exe /examples/clipboard +/examples/fltk-versions /examples/howto-add_fd-and-popen /examples/howto-browser-with-icons /examples/howto-drag-and-drop diff --git a/examples/Makefile b/examples/Makefile index def7376c9..3572f953b 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -6,6 +6,7 @@ SHELL = /bin/sh # Executables ALL = clipboard$(EXEEXT) \ + fltk-versions$(EXEEXT) \ howto-add_fd-and-popen$(EXEEXT) \ howto-browser-with-icons$(EXEEXT) \ howto-drag-and-drop$(EXEEXT) \ diff --git a/examples/fltk-versions.cxx b/examples/fltk-versions.cxx new file mode 100644 index 000000000..aa2adf6c0 --- /dev/null +++ b/examples/fltk-versions.cxx @@ -0,0 +1,85 @@ +// +// "$Id$" +// +// Library version test program for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2015 by Bill Spitzak and others. +// +// This library is free software. Distribution and use rights are outlined in +// the file "COPYING" which should have been included with this file. If this +// file is missing or damaged, see the license at: +// +// http://www.fltk.org/COPYING.php +// +// Please report all bugs and problems on the following page: +// +// http://www.fltk.org/str.php +// + +#include <FL/Fl.H> +#include <FL/Fl_Window.H> +#include <FL/Fl_Box.H> +#include <FL/fl_ask.H> + +static char version[8][80] = { "","","","","","","","" }; + +int main(int argc, char **argv) { + + int versions = 0; + + sprintf(version[versions++],"FL_VERSION = %6.4f",FL_VERSION); + sprintf(version[versions++],"Fl::version() = %6.4f %s",Fl::version(), + (FL_VERSION == Fl::version()) ? "" : "***"); + +#ifdef FL_API_VERSION + sprintf(version[versions++],"FL_API_VERSION = %6d",FL_API_VERSION); + sprintf(version[versions++],"Fl::api_version() = %6d %s",Fl::api_version(), + (FL_API_VERSION == Fl::api_version()) ? "" : "***"); +#endif + +#ifdef FL_ABI_VERSION + sprintf(version[versions++],"FL_ABI_VERSION = %6d",FL_ABI_VERSION); + sprintf(version[versions++],"Fl::abi_version() = %6d %s",Fl::abi_version(), + (FL_ABI_VERSION == Fl::abi_version()) ? "" : "***"); +#endif + +#ifdef FLTK_ABI_VERSION + sprintf(version[versions++],"FLTK_ABI_VERSION = %6d",FLTK_ABI_VERSION); +#endif + + for (int i=0; i<versions; i++) { + printf("%s\n",version[i]); + } + +#ifdef FL_ABI_VERSION + if (FL_ABI_VERSION != Fl::abi_version()) { + printf("*** FLTK ABI version mismatch: headers = %d, lib = %d ***\n", + FL_ABI_VERSION, Fl::abi_version()); + fflush(stdout); + fl_message("*** FLTK ABI version mismatch: headers = %d, lib = %d ***", + FL_ABI_VERSION, Fl::abi_version()); + // exit(1); + } +#endif + + Fl_Window *window = new Fl_Window(630,300); + + Fl_Box *box[8]; + for (int i=0; i<4; i++) { + box[2*i] = new Fl_Box( 10,40+40*i,300,30,version[2*i]); + box[2*i+1] = new Fl_Box(320,40+40*i,300,30,version[2*i+1]); + } + + for (int i=0; i<8; i++) { + box[i]->labelfont(FL_COURIER); + box[i]->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); + } + + window->end(); + window->show(argc, argv); + return Fl::run(); +} + +// +// End of "$Id$". +// |
