@@ -6,44 +6,44 @@ PyObject* PyInit_xyzzy(void); /* Forward */
6
6
7
7
main (int argc , char * * argv )
8
8
{
9
- /* Ignore passed-in argc/argv. If desired, conversion
10
- should use mbstowcs to convert them. */
11
- wchar_t * args [] = {L"embed" , L"hello" , 0 };
9
+ /* Ignore passed-in argc/argv. If desired, conversion
10
+ should use mbstowcs to convert them. */
11
+ wchar_t * args [] = {L"embed" , L"hello" , 0 };
12
12
13
- /* Pass argv[0] to the Python interpreter */
14
- Py_SetProgramName (args [0 ]);
13
+ /* Pass argv[0] to the Python interpreter */
14
+ Py_SetProgramName (args [0 ]);
15
15
16
- /* Add a static module */
17
- PyImport_AppendInittab ("xyzzy" , PyInit_xyzzy );
16
+ /* Add a static module */
17
+ PyImport_AppendInittab ("xyzzy" , PyInit_xyzzy );
18
18
19
- /* Initialize the Python interpreter. Required. */
20
- Py_Initialize ();
19
+ /* Initialize the Python interpreter. Required. */
20
+ Py_Initialize ();
21
21
22
- /* Define sys.argv. It is up to the application if you
23
- want this; you can also let it undefined (since the Python
24
- code is generally not a main program it has no business
25
- touching sys.argv...) */
26
- PySys_SetArgv (2 , args );
22
+ /* Define sys.argv. It is up to the application if you
23
+ want this; you can also let it undefined (since the Python
24
+ code is generally not a main program it has no business
25
+ touching sys.argv...) */
26
+ PySys_SetArgv (2 , args );
27
27
28
- /* Do some application specific code */
29
- printf ("Hello, brave new world\n\n" );
28
+ /* Do some application specific code */
29
+ printf ("Hello, brave new world\n\n" );
30
30
31
- /* Execute some Python statements (in module __main__) */
32
- PyRun_SimpleString ("import sys\n" );
33
- PyRun_SimpleString ("print(sys.builtin_module_names)\n" );
34
- PyRun_SimpleString ("print(sys.modules.keys())\n" );
35
- PyRun_SimpleString ("print(sys.executable)\n" );
36
- PyRun_SimpleString ("print(sys.argv)\n" );
31
+ /* Execute some Python statements (in module __main__) */
32
+ PyRun_SimpleString ("import sys\n" );
33
+ PyRun_SimpleString ("print(sys.builtin_module_names)\n" );
34
+ PyRun_SimpleString ("print(sys.modules.keys())\n" );
35
+ PyRun_SimpleString ("print(sys.executable)\n" );
36
+ PyRun_SimpleString ("print(sys.argv)\n" );
37
37
38
- /* Note that you can call any public function of the Python
39
- interpreter here, e.g. call_object(). */
38
+ /* Note that you can call any public function of the Python
39
+ interpreter here, e.g. call_object(). */
40
40
41
- /* Some more application specific code */
42
- printf ("\nGoodbye, cruel world\n" );
41
+ /* Some more application specific code */
42
+ printf ("\nGoodbye, cruel world\n" );
43
43
44
- /* Exit, cleaning up the interpreter */
45
- Py_Exit (0 );
46
- /*NOTREACHED*/
44
+ /* Exit, cleaning up the interpreter */
45
+ Py_Exit (0 );
46
+ /*NOTREACHED*/
47
47
}
48
48
49
49
/* A static module */
@@ -52,29 +52,29 @@ main(int argc, char **argv)
52
52
static PyObject *
53
53
xyzzy_foo (PyObject * self , PyObject * args )
54
54
{
55
- return PyLong_FromLong (42L );
55
+ return PyLong_FromLong (42L );
56
56
}
57
57
58
58
static PyMethodDef xyzzy_methods [] = {
59
- {"foo" , xyzzy_foo , METH_NOARGS ,
60
- "Return the meaning of everything." },
61
- {NULL , NULL } /* sentinel */
59
+ {"foo" , xyzzy_foo , METH_NOARGS ,
60
+ "Return the meaning of everything." },
61
+ {NULL , NULL } /* sentinel */
62
62
};
63
63
64
64
static struct PyModuleDef xyzzymodule = {
65
- {}, /* m_base */
66
- "xyzzy" , /* m_name */
67
- 0 , /* m_doc */
68
- 0 , /* m_size */
69
- xyzzy_methods , /* m_methods */
70
- 0 , /* m_reload */
71
- 0 , /* m_traverse */
72
- 0 , /* m_clear */
73
- 0 , /* m_free */
65
+ {}, /* m_base */
66
+ "xyzzy" , /* m_name */
67
+ 0 , /* m_doc */
68
+ 0 , /* m_size */
69
+ xyzzy_methods , /* m_methods */
70
+ 0 , /* m_reload */
71
+ 0 , /* m_traverse */
72
+ 0 , /* m_clear */
73
+ 0 , /* m_free */
74
74
};
75
75
76
76
PyObject *
77
77
PyInit_xyzzy (void )
78
78
{
79
- return PyModule_Create (& xyzzymodule );
79
+ return PyModule_Create (& xyzzymodule );
80
80
}
0 commit comments