~ubuntu-branches/ubuntu/hardy/texmacs/hardy

« back to all changes in this revision

Viewing changes to TeXmacs/examples/plugins/dynlink/src/dynlink.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ralf Treinen
  • Date: 2004-04-19 20:34:00 UTC
  • Revision ID: james.westby@ubuntu.com-20040419203400-g4e34ih0315wcn8v
Tags: upstream-1.0.3-R2
ImportĀ upstreamĀ versionĀ 1.0.3-R2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/******************************************************************************
 
3
* MODULE     : dynlink.cpp
 
4
* DESCRIPTION: Example of a plugin which is dynamically linked to TeXmacs
 
5
* COPYRIGHT  : (C) 2003  Joris van der Hoeven
 
6
*******************************************************************************
 
7
* This software falls under the GNU general public license and comes WITHOUT
 
8
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
 
9
* If you don't have this file, write to the Free Software Foundation, Inc.,
 
10
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
11
******************************************************************************/
 
12
 
 
13
#include <stdlib.h>
 
14
#include <string.h>
 
15
#include <iostream>
 
16
#include <TeXmacs.h>
 
17
 
 
18
static char* output= NULL;
 
19
 
 
20
char*
 
21
dynlink_install (TeXmacs_exports_1* TM, char* options, char** errors) {
 
22
  // cout << ">>> Install: " << options << "\n";
 
23
  output= (char*) malloc (50);
 
24
  strcpy (output, "\2verbatim:Started dynamic link\5");
 
25
  return output;
 
26
}
 
27
 
 
28
char*
 
29
dynlink_eval (char* what, char* session, char** errors) {
 
30
  // cout << ">>> Evaluate: " << what << ", " << session << "\n";
 
31
  free (output);
 
32
  output= (char*) malloc (50 + strlen (what));
 
33
  strcpy (output, "\2verbatim:You typed ");
 
34
  strcat (output, what);
 
35
  strcat (output, "\5");
 
36
  return output;
 
37
}
 
38
 
 
39
package_exports_1 dynlink_exports= {
 
40
  "TeXmacs communication protocol 1",
 
41
  "Dynlink 1",
 
42
  dynlink_install,
 
43
  dynlink_eval
 
44
};