summaryrefslogtreecommitdiff
path: root/Demo/embed
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-05-09 14:46:46 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2010-05-09 14:46:46 +0000
commit7674841ef015b47767c7939c16a8ea1fe92ae340 (patch)
tree7d47cc565698109d01fd147dcbfa17c669f5aece /Demo/embed
parent976291be7875a1f83dcb64b9c936175fb1cefc8c (diff)
downloadcpython-7674841ef015b47767c7939c16a8ea1fe92ae340.tar.gz
Untabify C files. Will watch buildbots.
Diffstat (limited to 'Demo/embed')
-rw-r--r--Demo/embed/demo.c64
-rw-r--r--Demo/embed/loop.c38
2 files changed, 51 insertions, 51 deletions
diff --git a/Demo/embed/demo.c b/Demo/embed/demo.c
index 6005f1396b..55bc8087d6 100644
--- a/Demo/embed/demo.c
+++ b/Demo/embed/demo.c
@@ -6,40 +6,40 @@ void initxyzzy(void); /* Forward */
main(int argc, char **argv)
{
- /* Pass argv[0] to the Python interpreter */
- Py_SetProgramName(argv[0]);
+ /* Pass argv[0] to the Python interpreter */
+ Py_SetProgramName(argv[0]);
- /* Initialize the Python interpreter. Required. */
- Py_Initialize();
+ /* Initialize the Python interpreter. Required. */
+ Py_Initialize();
- /* Add a static module */
- initxyzzy();
+ /* Add a static module */
+ initxyzzy();
- /* Define sys.argv. It is up to the application if you
- want this; you can also let it undefined (since the Python
- code is generally not a main program it has no business
- touching sys.argv...) */
- PySys_SetArgv(argc, argv);
+ /* Define sys.argv. It is up to the application if you
+ want this; you can also let it undefined (since the Python
+ code is generally not a main program it has no business
+ touching sys.argv...) */
+ PySys_SetArgv(argc, argv);
- /* Do some application specific code */
- printf("Hello, brave new world\n\n");
+ /* Do some application specific code */
+ printf("Hello, brave new world\n\n");
- /* Execute some Python statements (in module __main__) */
- PyRun_SimpleString("import sys\n");
- PyRun_SimpleString("print sys.builtin_module_names\n");
- PyRun_SimpleString("print sys.modules.keys()\n");
- PyRun_SimpleString("print sys.executable\n");
- PyRun_SimpleString("print sys.argv\n");
+ /* Execute some Python statements (in module __main__) */
+ PyRun_SimpleString("import sys\n");
+ PyRun_SimpleString("print sys.builtin_module_names\n");
+ PyRun_SimpleString("print sys.modules.keys()\n");
+ PyRun_SimpleString("print sys.executable\n");
+ PyRun_SimpleString("print sys.argv\n");
- /* Note that you can call any public function of the Python
- interpreter here, e.g. call_object(). */
+ /* Note that you can call any public function of the Python
+ interpreter here, e.g. call_object(). */
- /* Some more application specific code */
- printf("\nGoodbye, cruel world\n");
+ /* Some more application specific code */
+ printf("\nGoodbye, cruel world\n");
- /* Exit, cleaning up the interpreter */
- Py_Exit(0);
- /*NOTREACHED*/
+ /* Exit, cleaning up the interpreter */
+ Py_Exit(0);
+ /*NOTREACHED*/
}
/* A static module */
@@ -48,18 +48,18 @@ main(int argc, char **argv)
static PyObject *
xyzzy_foo(PyObject *self, PyObject* args)
{
- return PyInt_FromLong(42L);
+ return PyInt_FromLong(42L);
}
static PyMethodDef xyzzy_methods[] = {
- {"foo", xyzzy_foo, METH_NOARGS,
- "Return the meaning of everything."},
- {NULL, NULL} /* sentinel */
+ {"foo", xyzzy_foo, METH_NOARGS,
+ "Return the meaning of everything."},
+ {NULL, NULL} /* sentinel */
};
void
initxyzzy(void)
{
- PyImport_AddModule("xyzzy");
- Py_InitModule("xyzzy", xyzzy_methods);
+ PyImport_AddModule("xyzzy");
+ Py_InitModule("xyzzy", xyzzy_methods);
}
diff --git a/Demo/embed/loop.c b/Demo/embed/loop.c
index d5af82986d..2f7fe621c9 100644
--- a/Demo/embed/loop.c
+++ b/Demo/embed/loop.c
@@ -6,28 +6,28 @@
main(int argc, char **argv)
{
- int count = -1;
- char *command;
+ int count = -1;
+ char *command;
- if (argc < 2 || argc > 3) {
- fprintf(stderr, "usage: loop <python-command> [count]\n");
- exit(2);
- }
- command = argv[1];
+ if (argc < 2 || argc > 3) {
+ fprintf(stderr, "usage: loop <python-command> [count]\n");
+ exit(2);
+ }
+ command = argv[1];
- if (argc == 3) {
- count = atoi(argv[2]);
- }
+ if (argc == 3) {
+ count = atoi(argv[2]);
+ }
- Py_SetProgramName(argv[0]);
+ Py_SetProgramName(argv[0]);
- /* uncomment this if you don't want to load site.py */
- /* Py_NoSiteFlag = 1; */
+ /* uncomment this if you don't want to load site.py */
+ /* Py_NoSiteFlag = 1; */
- while (count == -1 || --count >= 0 ) {
- Py_Initialize();
- PyRun_SimpleString(command);
- Py_Finalize();
- }
- return 0;
+ while (count == -1 || --count >= 0 ) {
+ Py_Initialize();
+ PyRun_SimpleString(command);
+ Py_Finalize();
+ }
+ return 0;
}