source: git/modules/python.mod @ 2dc9fea

fieker-DuValspielwiese
Last change on this file since 2dc9fea was c64546, checked in by Michael Brickenstein <bricken@…>, 19 years ago
*bricken: embed and extend python git-svn-id: file:///usr/local/Singular/svn/trunk@8272 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 911 bytes
Line 
1%{
2/*
3 *  $Id: python.mod,v 1.1 2005-05-22 12:38:19 bricken Exp $
4 *
5 *  Python module
6 */
7
8#include <stdio.h>
9#include <stdlib.h>
10#include <string.h>
11#include <time.h>
12#include <Python.h>
13#include <wrapper.h>
14
15void mbpython(char* in);
16%}
17
18// some comments here
19
20category="tests";
21package="python_module";
22version = "$Id: python.mod,v 1.1 2005-05-22 12:38:19 bricken Exp $";
23info    ="LIBRARY: kernel.lib  PROCEDURES OF GENERAL TYPE WRITEN IN C python(input); eval a string  in python";
24//files= wrapper.cc;
25%modinitial
26  Py_Initialize();
27  initSingular();
28%endinitial
29
30%procedures
31/*
32 * NAME:     python
33 *           procedure without string as parameter and no return val
34 * PURPOSE:  interprets the string in python
35 */
36none python(string a)
37{
38  %declaration;
39  %typecheck;
40  mbpython(a);
41  %return();
42}
43example
44{
45  python("print 1+1");
46}
47
48
49
50%%
51%C
52
53void mbpython(char* inp){
54
55  PyRun_SimpleString(inp);
56
57
58}
59
60
61
Note: See TracBrowser for help on using the repository browser.