Back to index

texmacs  1.0.7.15
TeXmacs.h
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : TeXmacs.h
00004 * DESCRIPTION: Include file for communication of extern packages with TeXmacs
00005 * COPYRIGHT  : (C) 1999  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 * The TeXmacs communication protocol works as follows:
00012 *   - First of all, the protocol is dynamic. All protocols define
00013 *     the abstract structures 'TeXmacs_exports' and 'package_exports'.
00014 *     These structures contain the version of the protocol used
00015 *     and the versions of TeXmacs and the package
00016 *   - Version n of the concrete protocol implements two structures
00017 *     'TeXmacs_exports_n' and 'package_exports_n'.
00018 *     The first structure contains all routines and data of TeXmacs,
00019 *     which may be necessary for the package.
00020 *     The structure 'package_exports' contains all routines and data
00021 *     of the package, which should be visible for TeXmacs
00022 *   - Now the package has to be a dynamically linkable library,
00023 *     which implements a function
00024 *        package_exports* get_my_package (int version);
00025 *     In order to link your package to TeXmacs, you will now have to
00026 *     call the TeXmacs function
00027 *        void package_declare (string name, string lib, string f, string init);
00028 *     Here 'name' is the name of your package under TeXmacs,
00029 *     'lib' the name of the library, 'f' the function 'get_my_package' and
00030 *     'init' an initialization string.
00031 ******************************************************************************/
00032 
00033 #ifndef __TEXMACS_H
00034 #define __TEXMACS_H
00035 
00036 #if defined (__cplusplus)
00037 extern "C" {
00038 #endif
00039 
00040 /******************************************************************************
00041 * Any communication protocol contains at least the following
00042 ******************************************************************************/
00043 
00044 typedef struct TeXmacs_exports {
00045   char* version_protocol;
00046   char* version_TeXmacs;
00047 } TeXmacs_exports;
00048 
00049 typedef struct package_exports {
00050   char* version_protocol;
00051   char* version_package;
00052 } package_exports;
00053 
00054 /******************************************************************************
00055 * The first TeXmacs <-> package communication protocol from September 1999
00056 ******************************************************************************/
00057 
00058 typedef struct TeXmacs_exports_1 {
00059   char* version_protocol; /* "TeXmacs communication protocol 1" */
00060   char* version_TeXmacs;
00061 } TeXmacs_exports_1;
00062 
00063 typedef struct package_exports_1 {
00064   char* version_protocol; /* "TeXmacs communication protocol 1" */
00065   char* version_package;
00066 
00067   char* (*install) (TeXmacs_exports_1* TeXmacs,
00068                   char* options, char** errors);
00069   /* Installation routine for extern package.
00070      TeXmacs: pointer to routines exported by TeXmacs
00071      options: a string with installation option (freed by TeXmacs)
00072      *errors: contains error and warning messages (freed by TeXmacs)
00073      returned string: status of installation (freed by TeXmacs)
00074                     : NULL indicates a pure error */
00075 
00076   char* (*evaluate) (char* what, char* session, char** errors);
00077   /* Interactive evaluation routine for shells.
00078      what: string to be evaluated (freed by TeXmacs)
00079      session: name of your session ("default" by default, freed by TeXmacs)
00080      *errors: contains error and warning messages (freed by TeXmacs)
00081      returned string: result of the evaluation (freed by TeXmacs)
00082                     : NULL indicates a pure error */
00083 } package_exports_1;
00084 
00085 #if defined (__cplusplus)
00086 }
00087 #endif
00088 
00089 #endif /* __TEXMACS_H */