[cig-commits] r5356 - in cs/pythia/trunk: . mpi opal/applications pyre pyre/applications pyre/parsing/locators

leif at geodynamics.org leif at geodynamics.org
Mon Nov 27 19:29:32 PST 2006


Author: leif
Date: 2006-11-27 19:29:32 -0800 (Mon, 27 Nov 2006)
New Revision: 5356

Added:
   cs/pythia/trunk/pyre/applications/Shell.py
Modified:
   cs/pythia/trunk/mpi/_mpi.c
   cs/pythia/trunk/mpi/_mpi.pyx
   cs/pythia/trunk/opal/applications/CGI.py
   cs/pythia/trunk/pyre/__init__.py
   cs/pythia/trunk/pyre/applications/Application.py
   cs/pythia/trunk/pyre/applications/CommandlineParser.py
   cs/pythia/trunk/pyre/applications/__init__.py
   cs/pythia/trunk/pyre/parsing/locators/__init__.py
   cs/pythia/trunk/setup.cfg
Log:
Pythia v0.8.1.0b7: introduced class Shell, a component which encloses
the main application, and initializes before anything else.

Moved the 'journal' facility from Application into Shell to fix an
order-of-initialization problem.  In C++, the standard library ensures
that std::cout and std::cout are initialized before any application
code runs -- even global ctors.  Moving 'journal' into the Shell
application harness (so that it initializes early) provides the same
guarantee with respect to 'journal' for Pyre apps.  (The problem that
motivated this was a lack of colorization on inventory-related error
messages.  I like pretty colors.)

The problem which remains is, how to configure journal?
"AppName.journal.xxx" will no longer work.  Currently,
~/.pyre/shell/shell.cfg will work:

    [shell.journal]
    device = file

I'm considering '@' for shell command-line options, because it is one
of the few ASCII characters that doesn't have meaning in the real
shell, and the '@' character itself might be interpreted as a
representation of an (a)pplication inside a shell.  E.g.,

    citcoms example1.cfg @journal.device=file

I think "shell" options should probably at least be allowed in
'CitcomS.cfg', to allow for per-app journal config.  Although I
haven't really made up my mind about any of this yet.

Also moved the excepthook stuff into Shell.

Also fixed a bug that prevented apps from exiting with an error
when non-existent .cfg/.pml files were named on the command line.

Also removed MPI_Init() and MPI_Finalize() from _mpi.pyx, since these
functions are no longer called from Python.


Modified: cs/pythia/trunk/mpi/_mpi.c
===================================================================
--- cs/pythia/trunk/mpi/_mpi.c	2006-11-28 03:01:37 UTC (rev 5355)
+++ cs/pythia/trunk/mpi/_mpi.c	2006-11-28 03:29:32 UTC (rev 5356)
@@ -1,4 +1,4 @@
-/* Generated by Pyrex 0.9.4.1 on Wed Oct  4 19:01:14 2006 */
+/* Generated by Pyrex 0.9.4.1 on Mon Nov 27 16:50:24 2006 */
 
 #include "Python.h"
 #include "structmember.h"
@@ -11,7 +11,6 @@
 #define __PYX_EXTERN_C extern
 #endif
 __PYX_EXTERN_C double pow(double, double);
-#include "stdlib.h"
 #include "mpi.h"
 
 
@@ -64,8 +63,6 @@
 static PyObject *__pyx_n_cmpi;
 static PyObject *__pyx_n_MPI_COMM_WORLD;
 static PyObject *__pyx_n_MPI_Error;
-static PyObject *__pyx_n_MPI_Init;
-static PyObject *__pyx_n_MPI_Finalize;
 static PyObject *__pyx_n_MPI_Comm_rank;
 static PyObject *__pyx_n_MPI_Comm_size;
 static PyObject *__pyx_n_MPI_Error_string;
@@ -79,7 +76,7 @@
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
   Py_INCREF(__pyx_v_self);
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":17 */
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":12 */
   ((struct __pyx_obj_4_mpi_MPI_Comm *)__pyx_v_self)->comm = MPI_COMM_WORLD;
 
   __pyx_r = 0;
@@ -107,17 +104,17 @@
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_self)) return 0;
   Py_INCREF(__pyx_v_self);
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":25 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error_string); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_args); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
-  __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
-  __pyx_4 = PyObject_GetItem(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":20 */
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error_string); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_args); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
+  __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetItem(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
   __pyx_4 = 0;
-  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   __pyx_r = __pyx_3;
@@ -138,204 +135,6 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_n_len;
-static PyObject *__pyx_n_append;
-
-static PyObject *__pyx_f_4_mpi_MPI_Init(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_4_mpi_MPI_Init(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_argv = 0;
-  int __pyx_v_error;
-  int __pyx_v_cargc;
-  int __pyx_v_i;
-  char (*(*__pyx_v_cargv));
-  char (*(*__pyx_v_mycargv));
-  PyObject *__pyx_v_myargv;
-  PyObject *__pyx_v_arg;
-  PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
-  PyObject *__pyx_2 = 0;
-  PyObject *__pyx_3 = 0;
-  int __pyx_4;
-  char (*__pyx_5);
-  static char *__pyx_argnames[] = {"argv",0};
-  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_argv)) return 0;
-  Py_INCREF(__pyx_v_argv);
-  __pyx_v_myargv = Py_None; Py_INCREF(Py_None);
-  __pyx_v_arg = Py_None; Py_INCREF(Py_None);
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":31 */
-  __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
-  Py_DECREF(__pyx_v_myargv);
-  __pyx_v_myargv = __pyx_1;
-  __pyx_1 = 0;
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":34 */
-  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
-  Py_INCREF(__pyx_v_argv);
-  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_argv);
-  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_v_cargc = __pyx_4;
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":35 */
-  __pyx_v_cargv = ((char (*(*)))malloc(((__pyx_v_cargc + 1) * (sizeof(char (*))))));
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":36 */
-  for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_cargc; ++__pyx_v_i) {
-
-    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":37 */
-    __pyx_1 = PyInt_FromLong(__pyx_v_i); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;}
-    __pyx_2 = PyObject_GetItem(__pyx_v_argv, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    Py_DECREF(__pyx_v_arg);
-    __pyx_v_arg = __pyx_2;
-    __pyx_2 = 0;
-
-    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":38 */
-    __pyx_3 = PyObject_GetAttr(__pyx_v_myargv, __pyx_n_append); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
-    Py_INCREF(__pyx_v_arg);
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_arg);
-    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
-
-    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":39 */
-    __pyx_5 = PyString_AsString(__pyx_v_arg); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; goto __pyx_L1;}
-    (__pyx_v_cargv[__pyx_v_i]) = __pyx_5;
-    __pyx_L2:;
-  }
-  __pyx_L3:;
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":40 */
-  (__pyx_v_cargv[__pyx_v_cargc]) = 0;
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":43 */
-  __pyx_v_mycargv = __pyx_v_cargv;
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":44 */
-  __pyx_v_error = MPI_Init((&__pyx_v_cargc),(&__pyx_v_cargv));
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":45 */
-  __pyx_4 = (__pyx_v_error != MPI_SUCCESS);
-  if (__pyx_4) {
-
-    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":46 */
-    free(__pyx_v_mycargv);
-
-    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":47 */
-    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;}
-    __pyx_1 = PyInt_FromLong(__pyx_v_error); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;}
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
-    __pyx_1 = 0;
-    __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;}
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_1, 0, 0);
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;}
-    goto __pyx_L4;
-  }
-  __pyx_L4:;
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":50 */
-  if (PySequence_DelSlice(__pyx_v_argv, 0, 0x7fffffff) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; goto __pyx_L1;}
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":51 */
-  for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_cargc; ++__pyx_v_i) {
-
-    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":52 */
-    __pyx_3 = PyObject_GetAttr(__pyx_v_argv, __pyx_n_append); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
-    __pyx_2 = PyString_FromString((__pyx_v_cargv[__pyx_v_i])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
-    __pyx_2 = 0;
-    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __pyx_L5:;
-  }
-  __pyx_L6:;
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":53 */
-  free(__pyx_v_mycargv);
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":55 */
-  __pyx_r = Py_None; Py_INCREF(Py_None);
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; Py_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1:;
-  Py_XDECREF(__pyx_1);
-  Py_XDECREF(__pyx_2);
-  Py_XDECREF(__pyx_3);
-  __Pyx_AddTraceback("_mpi.MPI_Init");
-  __pyx_r = 0;
-  __pyx_L0:;
-  Py_DECREF(__pyx_v_myargv);
-  Py_DECREF(__pyx_v_arg);
-  Py_DECREF(__pyx_v_argv);
-  return __pyx_r;
-}
-
-static PyObject *__pyx_f_4_mpi_MPI_Finalize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_4_mpi_MPI_Finalize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  int __pyx_v_error;
-  PyObject *__pyx_r;
-  int __pyx_1;
-  PyObject *__pyx_2 = 0;
-  PyObject *__pyx_3 = 0;
-  PyObject *__pyx_4 = 0;
-  static char *__pyx_argnames[] = {0};
-  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":60 */
-  __pyx_v_error = MPI_Finalize();
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":61 */
-  __pyx_1 = (__pyx_v_error != MPI_SUCCESS);
-  if (__pyx_1) {
-
-    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":62 */
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
-    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
-    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
-    __pyx_3 = 0;
-    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
-    Py_DECREF(__pyx_4); __pyx_4 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
-    goto __pyx_L2;
-  }
-  __pyx_L2:;
-
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":63 */
-  __pyx_r = Py_None; Py_INCREF(Py_None);
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; Py_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1:;
-  Py_XDECREF(__pyx_2);
-  Py_XDECREF(__pyx_3);
-  Py_XDECREF(__pyx_4);
-  __Pyx_AddTraceback("_mpi.MPI_Finalize");
-  __pyx_r = 0;
-  __pyx_L0:;
-  return __pyx_r;
-}
-
 static PyObject *__pyx_f_4_mpi_MPI_Comm_rank(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static PyObject *__pyx_f_4_mpi_MPI_Comm_rank(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_comm = 0;
@@ -352,37 +151,37 @@
   Py_INCREF(__pyx_v_comm);
   __pyx_v_c_comm = ((struct __pyx_obj_4_mpi_MPI_Comm *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":70 */
-  if (!__Pyx_TypeTest(__pyx_v_comm, __pyx_ptype_4_mpi_MPI_Comm)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":27 */
+  if (!__Pyx_TypeTest(__pyx_v_comm, __pyx_ptype_4_mpi_MPI_Comm)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; goto __pyx_L1;}
   Py_INCREF(__pyx_v_comm);
   Py_DECREF(((PyObject *)__pyx_v_c_comm));
   __pyx_v_c_comm = ((struct __pyx_obj_4_mpi_MPI_Comm *)__pyx_v_comm);
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":71 */
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":28 */
   __pyx_v_error = MPI_Comm_rank(__pyx_v_c_comm->comm,(&__pyx_v_rank));
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":72 */
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":29 */
   __pyx_1 = (__pyx_v_error != MPI_SUCCESS);
   if (__pyx_1) {
 
-    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":73 */
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
-    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":30 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
     PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
     __pyx_3 = 0;
-    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
     __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; goto __pyx_L1;}
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":74 */
-  __pyx_2 = PyInt_FromLong(__pyx_v_rank); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":31 */
+  __pyx_2 = PyInt_FromLong(__pyx_v_rank); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
   __pyx_r = __pyx_2;
   __pyx_2 = 0;
   goto __pyx_L0;
@@ -417,37 +216,37 @@
   Py_INCREF(__pyx_v_comm);
   __pyx_v_c_comm = ((struct __pyx_obj_4_mpi_MPI_Comm *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":81 */
-  if (!__Pyx_TypeTest(__pyx_v_comm, __pyx_ptype_4_mpi_MPI_Comm)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":38 */
+  if (!__Pyx_TypeTest(__pyx_v_comm, __pyx_ptype_4_mpi_MPI_Comm)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}
   Py_INCREF(__pyx_v_comm);
   Py_DECREF(((PyObject *)__pyx_v_c_comm));
   __pyx_v_c_comm = ((struct __pyx_obj_4_mpi_MPI_Comm *)__pyx_v_comm);
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":82 */
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":39 */
   __pyx_v_error = MPI_Comm_size(__pyx_v_c_comm->comm,(&__pyx_v_size));
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":83 */
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":40 */
   __pyx_1 = (__pyx_v_error != MPI_SUCCESS);
   if (__pyx_1) {
 
-    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":84 */
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
-    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
+    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":41 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
+    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
     PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
     __pyx_3 = 0;
-    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
+    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
     __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":85 */
-  __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":42 */
+  __pyx_2 = PyInt_FromLong(__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; goto __pyx_L1;}
   __pyx_r = __pyx_2;
   __pyx_2 = 0;
   goto __pyx_L0;
@@ -487,55 +286,55 @@
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "i", __pyx_argnames, &__pyx_v_errorcode)) return 0;
   __pyx_v_string = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":93 */
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":50 */
   __pyx_v_error = MPI_Error_string(__pyx_v_errorcode,__pyx_v_4_mpi_cstring,(&__pyx_v_resultlen));
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":94 */
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":51 */
   __pyx_1 = (__pyx_v_error != MPI_SUCCESS);
   if (__pyx_1) {
 
-    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":95 */
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
-    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
+    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":52 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MPI_Error); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
+    __pyx_3 = PyInt_FromLong(__pyx_v_error); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
     PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
     __pyx_3 = 0;
-    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
+    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
     __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; goto __pyx_L1;}
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":96 */
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":53 */
   __pyx_1 = (__pyx_v_resultlen >= 1024);
   if (__pyx_1) {
 
-    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":97 */
-    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+    /* "/home/leif/dv/pythia/mpi/_mpi.pyx":54 */
+    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
     Py_INCREF(__pyx_k2p);
     PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k2p);
-    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
     __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":98 */
-  __pyx_2 = PyString_FromString(__pyx_v_4_mpi_cstring); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":55 */
+  __pyx_2 = PyString_FromString(__pyx_v_4_mpi_cstring); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; goto __pyx_L1;}
   Py_DECREF(__pyx_v_string);
   __pyx_v_string = __pyx_2;
   __pyx_2 = 0;
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":99 */
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":56 */
   Py_INCREF(__pyx_v_string);
   __pyx_r = __pyx_v_string;
   goto __pyx_L0;
@@ -560,14 +359,10 @@
   {&__pyx_n_MPI_Comm_size, "MPI_Comm_size"},
   {&__pyx_n_MPI_Error, "MPI_Error"},
   {&__pyx_n_MPI_Error_string, "MPI_Error_string"},
-  {&__pyx_n_MPI_Finalize, "MPI_Finalize"},
-  {&__pyx_n_MPI_Init, "MPI_Init"},
   {&__pyx_n_RuntimeError, "RuntimeError"},
   {&__pyx_n___str__, "__str__"},
-  {&__pyx_n_append, "append"},
   {&__pyx_n_args, "args"},
   {&__pyx_n_cmpi, "cmpi"},
-  {&__pyx_n_len, "len"},
   {0, 0}
 };
 
@@ -719,8 +514,6 @@
 };
 
 static struct PyMethodDef __pyx_methods[] = {
-  {"MPI_Init", (PyCFunction)__pyx_f_4_mpi_MPI_Init, METH_VARARGS|METH_KEYWORDS, 0},
-  {"MPI_Finalize", (PyCFunction)__pyx_f_4_mpi_MPI_Finalize, METH_VARARGS|METH_KEYWORDS, 0},
   {"MPI_Comm_rank", (PyCFunction)__pyx_f_4_mpi_MPI_Comm_rank, METH_VARARGS|METH_KEYWORDS, 0},
   {"MPI_Comm_size", (PyCFunction)__pyx_f_4_mpi_MPI_Comm_size, METH_VARARGS|METH_KEYWORDS, 0},
   {"MPI_Error_string", (PyCFunction)__pyx_f_4_mpi_MPI_Error_string, METH_VARARGS|METH_KEYWORDS, 0},
@@ -743,37 +536,37 @@
   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
   if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
   if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
-  if (PyType_Ready(&__pyx_type_4_mpi_MPI_Comm) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; goto __pyx_L1;}
-  if (PyObject_SetAttrString(__pyx_m, "MPI_Comm", (PyObject *)&__pyx_type_4_mpi_MPI_Comm) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; goto __pyx_L1;}
+  if (PyType_Ready(&__pyx_type_4_mpi_MPI_Comm) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
+  if (PyObject_SetAttrString(__pyx_m, "MPI_Comm", (PyObject *)&__pyx_type_4_mpi_MPI_Comm) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
   __pyx_ptype_4_mpi_MPI_Comm = &__pyx_type_4_mpi_MPI_Comm;
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":20 */
-  __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
-  __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4_mpi_MPI_Comm), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":15 */
+  __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_4_mpi_MPI_Comm), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_MPI_COMM_WORLD, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_MPI_COMM_WORLD, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":23 */
-  __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;}
-  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_EnvironmentError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;}
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;}
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":18 */
+  __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;}
+  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_EnvironmentError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
   __pyx_2 = 0;
-  __pyx_2 = __Pyx_CreateClass(__pyx_3, __pyx_1, __pyx_n_MPI_Error, "_mpi"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;}
+  __pyx_2 = __Pyx_CreateClass(__pyx_3, __pyx_1, __pyx_n_MPI_Error, "_mpi"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":24 */
-  __pyx_3 = PyCFunction_New(&__pyx_mdef_4_mpi_9MPI_Error___str__, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;}
-  __pyx_4 = PyMethod_New(__pyx_3, 0, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;}
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":19 */
+  __pyx_3 = PyCFunction_New(&__pyx_mdef_4_mpi_9MPI_Error___str__, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;}
+  __pyx_4 = PyMethod_New(__pyx_3, 0, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  if (PyObject_SetAttr(__pyx_2, __pyx_n___str__, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_2, __pyx_n___str__, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_MPI_Error, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_MPI_Error, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
 
-  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":90 */
+  /* "/home/leif/dv/pythia/mpi/_mpi.pyx":47 */
   return;
   __pyx_L1:;
   Py_XDECREF(__pyx_1);
@@ -818,6 +611,18 @@
     return result;
 }
 
+static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
+    if (!type) {
+        PyErr_Format(PyExc_SystemError, "Missing type object");
+        return 0;
+    }
+    if (obj == Py_None || PyObject_TypeCheck(obj, type))
+        return 1;
+    PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
+        obj->ob_type->tp_name, type->tp_name);
+    return 0;
+}
+
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
     Py_XINCREF(type);
     Py_XINCREF(value);
@@ -880,18 +685,6 @@
     return;
 }
 
-static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
-    if (!type) {
-        PyErr_Format(PyExc_SystemError, "Missing type object");
-        return 0;
-    }
-    if (obj == Py_None || PyObject_TypeCheck(obj, type))
-        return 1;
-    PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
-        obj->ob_type->tp_name, type->tp_name);
-    return 0;
-}
-
 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
     while (t->p) {
         *t->p = PyString_InternFromString(t->s);

Modified: cs/pythia/trunk/mpi/_mpi.pyx
===================================================================
--- cs/pythia/trunk/mpi/_mpi.pyx	2006-11-28 03:01:37 UTC (rev 5355)
+++ cs/pythia/trunk/mpi/_mpi.pyx	2006-11-28 03:29:32 UTC (rev 5356)
@@ -4,11 +4,6 @@
 cimport cmpi
 
 
-cdef extern from "stdlib.h":
-    void *malloc(int)
-    void free(void *)
-
-
 cdef class MPI_Comm:
 
     cdef cmpi.MPI_Comm comm
@@ -25,44 +20,6 @@
         return MPI_Error_string(self.args[0])
 
 
-def MPI_Init(argv):
-    cdef int error, cargc, i
-    cdef char **cargv, **mycargv
-    myargv = []
-
-    # Construct a C char** argument vector from 'argv'.
-    cargc = len(argv)
-    cargv = <char **>malloc((cargc + 1) * sizeof(char *))
-    for i from 0 <= i < cargc:
-        arg = argv[i]
-        myargv.append(arg) # add ref
-        cargv[i] = arg
-    cargv[cargc] = NULL
-
-    # Call MPI_Init().
-    mycargv = cargv; # MPI might allocate & return its own.
-    error = cmpi.MPI_Init(&cargc, &cargv)
-    if error != cmpi.MPI_SUCCESS:
-        free(mycargv)
-        raise MPI_Error(error)
-
-    # Reconstruct Python's 'argv' from the modified 'cargv'.
-    del argv[:]
-    for i from 0 <= i < cargc:
-        argv.append(cargv[i])
-    free(mycargv)
-    
-    return
-
-
-def MPI_Finalize():
-    cdef int error
-    error = cmpi.MPI_Finalize()
-    if error != cmpi.MPI_SUCCESS:
-        raise MPI_Error(error)
-    return
-
-
 def MPI_Comm_rank(comm):
     cdef int error
     cdef int rank

Modified: cs/pythia/trunk/opal/applications/CGI.py
===================================================================
--- cs/pythia/trunk/opal/applications/CGI.py	2006-11-28 03:01:37 UTC (rev 5355)
+++ cs/pythia/trunk/opal/applications/CGI.py	2006-11-28 03:29:32 UTC (rev 5356)
@@ -26,7 +26,7 @@
         stream.meta['tip'] = "where to place the generated text"
 
 
-    def collectUserInput(self, registry):
+    def collectUserInput(self, registry, context):
 
         # first extract standard commandline arguments
         help, argv = self.processCommandline(registry)

Modified: cs/pythia/trunk/pyre/__init__.py
===================================================================
--- cs/pythia/trunk/pyre/__init__.py	2006-11-28 03:01:37 UTC (rev 5355)
+++ cs/pythia/trunk/pyre/__init__.py	2006-11-28 03:29:32 UTC (rev 5356)
@@ -23,44 +23,4 @@
 
 
 
-# a component which allows the user to configure the Python system
-# itself using Pyre
-
-
-from pyre.components import Component
-
-
-class System(Component):
-
-
-    name = "sys"
-
-
-    import pyre.hooks
-    excepthook = pyre.hooks.facility("excepthook", family="excepthook", default="ultraTB")
-
-
-    def startup(self):
-        import pyre.inventory
-        registry = self.createRegistry()
-        self.registry = registry
-        curator = pyre.inventory.curator(self.name)
-        curator.config(registry)
-        self.setCurator(curator)
-        curator.depositories += self.inventory.getDepositories()
-        self.initializeConfiguration()
-        self.applyConfiguration()
-        self.init()
-
-        import sys
-        if self.excepthook:
-            sys.excepthook = self.excepthook.excepthook
-
-        return
-
-
-system = System()
-system.startup()
-
-
 # End of file 

Modified: cs/pythia/trunk/pyre/applications/Application.py
===================================================================
--- cs/pythia/trunk/pyre/applications/Application.py	2006-11-28 03:01:37 UTC (rev 5355)
+++ cs/pythia/trunk/pyre/applications/Application.py	2006-11-28 03:29:32 UTC (rev 5356)
@@ -35,11 +35,7 @@
         weaver = pyre.inventory.facility("weaver", factory=pyre.weaver.weaver)
         weaver.meta['tip'] = 'the pretty printer of my configuration as an XML document'
 
-        import journal
-        journal = journal.facility()
-        journal.meta['tip'] = 'the logging facility'
 
-
     def run(self, *args, **kwds):
 
         # build storage for the user input
@@ -57,20 +53,23 @@
         curator = self.createCurator()
         self.initializeCurator(curator, registry)
 
+        # config context
+        context = self.newConfigContext()
+
         # look for my settings
         self.initializeConfiguration()
 
         # read parameter files given on the command line
-        self.readParameterFiles(registry)
+        self.readParameterFiles(registry, context)
 
         # give descendants an opportunity to collect input from other (unregistered) sources
-        self.collectUserInput(registry)
+        self.collectUserInput(registry, context)
 
         # update user options from the command line
         self.updateConfiguration(registry)
 
         # transfer user input to my inventory
-        context = self.applyConfiguration()
+        self.applyConfiguration(context)
 
         # verify that the user input did not contain any typos
         if not self.verifyConfiguration(context, self.inventory.typos):
@@ -116,11 +115,11 @@
         return curator
 
 
-    def readParameterFiles(self, registry):
+    def readParameterFiles(self, registry, context):
         """read parameter files given on the command line"""
-        import journal
-        error = journal.error(self.name)
         from os.path import isfile, splitext
+        import pyre.parsing.locators
+        locator = pyre.parsing.locators.commandLine()
         argv = self.argv
         self.argv = []
         for arg in argv:
@@ -130,8 +129,8 @@
             if codec:
                 try:
                     shelf = codec.open(base)
-                except Exception, e:
-                    error.log(str(e))
+                except Exception, error:
+                    context.error(error, 'inventory', None, locator)
                 else:
                     paramRegistry = shelf['inventory'].getFacility(self.name)
                     if paramRegistry:
@@ -141,7 +140,7 @@
         return
 
     
-    def collectUserInput(self, registry):
+    def collectUserInput(self, registry, context):
         """collect user input from additional sources"""
         return
 

Modified: cs/pythia/trunk/pyre/applications/CommandlineParser.py
===================================================================
--- cs/pythia/trunk/pyre/applications/CommandlineParser.py	2006-11-28 03:01:37 UTC (rev 5355)
+++ cs/pythia/trunk/pyre/applications/CommandlineParser.py	2006-11-28 03:29:32 UTC (rev 5356)
@@ -40,7 +40,7 @@
         self.unprocessed = []
 
         import pyre.parsing.locators
-        self.locator = pyre.parsing.locators.simple('command line')
+        self.locator = pyre.parsing.locators.commandLine()
 
         import journal
         self._debug = journal.debug("pyre.commandline")

Added: cs/pythia/trunk/pyre/applications/Shell.py
===================================================================
--- cs/pythia/trunk/pyre/applications/Shell.py	2006-11-28 03:01:37 UTC (rev 5355)
+++ cs/pythia/trunk/pyre/applications/Shell.py	2006-11-28 03:29:32 UTC (rev 5356)
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#                      California Institute of Technology
+#                        (C) 2006  All Rights Reserved
+#
+# {LicenseText}
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+
+
+from pyre.components import Component
+
+
+class Shell(Component):
+
+
+    name = "shell"
+
+
+    import pyre.hooks
+    excepthook = pyre.hooks.facility("excepthook", family="excepthook", default="ultraTB")
+
+    import journal
+    journal = journal.facility()
+    journal.meta['tip'] = 'the logging facility'
+
+
+    def runApplication(self, ApplicationClass, **kwds):
+        import pyre.inventory
+        registry = self.createRegistry()
+        self.registry = registry
+        curator = pyre.inventory.curator(self.name)
+        curator.config(registry)
+        self.setCurator(curator)
+        curator.depositories += self.inventory.getDepositories()
+        self.initializeConfiguration()
+        self.applyConfiguration()
+        self.init()
+
+        import sys
+        if self.excepthook:
+            sys.excepthook = self.excepthook.excepthook
+
+        app = ApplicationClass()
+        app.run(**kwds)
+
+        return
+
+
+# end of file

Modified: cs/pythia/trunk/pyre/applications/__init__.py
===================================================================
--- cs/pythia/trunk/pyre/applications/__init__.py	2006-11-28 03:01:37 UTC (rev 5355)
+++ cs/pythia/trunk/pyre/applications/__init__.py	2006-11-28 03:29:32 UTC (rev 5356)
@@ -15,6 +15,7 @@
 from Application import Application
 from AppRunner import AppRunner
 from Script import Script
+from Shell import Shell
 from SuperScript import SuperScript
 
 
@@ -31,10 +32,10 @@
 def start(argv=None, **kwds):
     """general-purpose entry point for applications"""
     cls = kwds.get('applicationClass')
-    app = cls()
     kwds = dict(**kwds)
     kwds['argv'] = argv
-    app.run(**kwds)
+    shell = Shell()
+    shell.runApplication(cls, **kwds)
     return 0
 
 

Modified: cs/pythia/trunk/pyre/parsing/locators/__init__.py
===================================================================
--- cs/pythia/trunk/pyre/parsing/locators/__init__.py	2006-11-28 03:01:37 UTC (rev 5355)
+++ cs/pythia/trunk/pyre/parsing/locators/__init__.py	2006-11-28 03:29:32 UTC (rev 5356)
@@ -25,6 +25,10 @@
     return simple('error')
 
 
+def commandLine():
+    return simple('command line')
+
+
 def script(source, line, function):
     from ScriptLocator import ScriptLocator
     return ScriptLocator(source, line, function)

Modified: cs/pythia/trunk/setup.cfg
===================================================================
--- cs/pythia/trunk/setup.cfg	2006-11-28 03:01:37 UTC (rev 5355)
+++ cs/pythia/trunk/setup.cfg	2006-11-28 03:29:32 UTC (rev 5356)
@@ -1,4 +1,4 @@
 
 [egg_info]
-tag_build = b6
+tag_build = b7
 #tag_svn_revision = 1



More information about the cig-commits mailing list