diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-05-09 14:46:46 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-05-09 14:46:46 (GMT) |
commit | c83ea137d7e717f764e2f31fc2544f522de7d857 (patch) | |
tree | ccfdacfdcdc4ed68e56324a07b6f25ab5327bdcd /Demo/embed | |
parent | 368ede83d9c96004dc5c489511936a588537f410 (diff) | |
download | cpython-c83ea137d7e717f764e2f31fc2544f522de7d857.zip cpython-c83ea137d7e717f764e2f31fc2544f522de7d857.tar.gz cpython-c83ea137d7e717f764e2f31fc2544f522de7d857.tar.bz2 |
Untabify C files. Will watch buildbots.
Diffstat (limited to 'Demo/embed')
-rw-r--r-- | Demo/embed/demo.c | 64 | ||||
-rw-r--r-- | Demo/embed/loop.c | 38 |
2 files changed, 51 insertions, 51 deletions
diff --git a/Demo/embed/demo.c b/Demo/embed/demo.c index 6005f13..55bc808 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 d5af829..2f7fe62 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; } |