Back to index

texmacs  1.0.7.15
axel.cpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : axel.cpp
00004 * DESCRIPTION: interface with Axel
00005 * COPYRIGHT  : (C) 2008  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #include "Axel/axel.hpp"
00013 #include "dyn_link.hpp"
00014 
00015 #ifdef USE_AXEL
00016 
00017 /******************************************************************************
00018 * Routines used from Axel
00019 ******************************************************************************/
00020 
00021 void (*AXEL_test) (void);
00022 
00023 /******************************************************************************
00024 * Initialization
00025 ******************************************************************************/
00026 
00027 static bool axel_initialized= false;
00028 static bool axel_error      = false;
00029 
00030 #ifdef LINKED_AXEL
00031 #define axel_bind(orig,tm) \
00032   tm= orig;
00033 #else
00034 #define axel_bind(orig,tm) \
00035   (void) symbol_install ("libAxel.so", #orig, (pointer&) tm); \
00036   if (tm == NULL) return;
00037 #endif
00038 
00039 void
00040 axel_initialize () {
00041   axel_initialized= true;
00042   axel_error      = true;
00043 
00044   int status= debug_off ();
00045   axel_bind (axel_test, AXEL_test);
00046   debug_on (status);
00047 
00048 #ifdef LINKED_AXEL
00049   if (DEBUG_AUTO) cout << "TeXmacs] With linked Axel support\n";
00050 #else
00051   if (DEBUG_AUTO) cout << "TeXmacs] Installed Axel support\n";
00052 #endif
00053 
00054   axel_error= false;
00055 }
00056 
00057 /******************************************************************************
00058 * Functionality provided by the plug-in
00059 ******************************************************************************/
00060 
00061 bool
00062 axel_present () {
00063   if (!axel_initialized)
00064     axel_initialize ();
00065   return !axel_error;
00066 }
00067 
00068 void
00069 axel_test () {
00070   AXEL_test ();
00071 }
00072 
00073 #else // USE_AXEL
00074 
00075 /******************************************************************************
00076 * If Axel is not present...
00077 ******************************************************************************/
00078 
00079 bool axel_present () { return false; }
00080 void axel_test () {}
00081 
00082 #endif // USE_AXEL