Back to index

texmacs  1.0.7.15
dynlink.cpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : dynlink.cpp
00004 * DESCRIPTION: Example of a plugin which is dynamically linked to TeXmacs
00005 * COPYRIGHT  : (C) 2003  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 <stdlib.h>
00013 #include <string.h>
00014 #include <TeXmacs.h>
00015 
00016 //#include <iostream>
00017 //using namespace std;
00018 
00019 static char* output= NULL;
00020 
00021 char*
00022 dynlink_install (TeXmacs_exports_1* TM, char* options, char** errors) {
00023   // cout << ">>> Install: " << options << "\n";
00024   output= (char*) malloc (50);
00025   strcpy (output, "\2verbatim:Started dynamic link\5");
00026   return output;
00027 }
00028 
00029 char*
00030 dynlink_eval (char* what, char* session, char** errors) {
00031   // cout << ">>> Evaluate: " << what << ", " << session << "\n";
00032   free (output);
00033   output= (char*) malloc (50 + strlen (what));
00034   strcpy (output, "\2verbatim:You typed ");
00035   strcat (output, what);
00036   strcat (output, "\5");
00037   return output;
00038 }
00039 
00040 package_exports_1 dynlink_exports= {
00041   (char*) "TeXmacs communication protocol 1",
00042   (char*) "Dynlink 1",
00043   dynlink_install,
00044   dynlink_eval
00045 };