source: git/modules/python.mod @ e88c64

spielwiese
Last change on this file since e88c64 was ab8c32, checked in by Michael Brickenstein <bricken@…>, 19 years ago
*bricken: synced with python.cc, will use this again if modgen generates real code git-svn-id: file:///usr/local/Singular/svn/trunk@8660 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 931 bytes
Line 
1%{
2/*
3 *  $Id: python.mod,v 1.2 2005-09-24 14:14:35 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.2 2005-09-24 14:14:35 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  init_Singular();
29
30%endinitial
31
32%procedures
33/*
34 * NAME:     python
35 *           procedure without string as parameter and no return val
36 * PURPOSE:  interprets the string in python
37 */
38none python(string a)
39{
40  %declaration;
41  %typecheck;
42  mbpython(a);
43  %return();
44}
45example
46{
47  python("print 1+1");
48}
49
50
51
52%%
53%C
54
55void mbpython(char* inp){
56
57  PyRun_SimpleString(inp);
58
59
60}
61
62
63
Note: See TracBrowser for help on using the repository browser.