Commits

Dean Hall  committed 3dde8d1

#34 mainlining directly

  • Participants
  • Parent commits 2835fac

Comments (0)

Files changed (57)

 
 PyMite builds as an archive.  The user should then build his
 own main() function following given examples and link in
-``libpymvm.a`` and the appropriate PyMite native libraries.
+``libpmvm.a`` and the appropriate PyMite native libraries.
 
 Discussion
 ----------

File docs/src/AssertStatement.txt

 ``AssertionError``, a native function, ``_exn()``, will be created in
 ``__bi.py`` that allocates an exception object (OBJ_TYPE_EXN).  The
 ``AssertionError`` object will also have an integer attribute, ``code``, that
-corresponds to the value of the PyReturn_t code that represents that exception.
-In this case, ``PY_RET_EX_ASSRT``.  So, the code added to ``__bi.py`` will
+corresponds to the value of the PmReturn_t code that represents that exception.
+In this case, ``PM_RET_EX_ASSRT``.  So, the code added to ``__bi.py`` will
 look like this::
 
     AssertionError = _exn()

File docs/src/ErrorsAndExceptions.txt

 Overview
 --------
 
-PyMite shall define the C data type ``PyReturn_t`` as the general type for
+PyMite shall define the C data type ``PmReturn_t`` as the general type for
 error codes that are returned from functions within the VM.  Since some
 functions need to return an exception and do not have access to the VM's
-stack, ``PyReturn_t`` is also capable of returning codes that indicate
+stack, ``PmReturn_t`` is also capable of returning codes that indicate
 when an exceptional situation has occured.  PyMite supports only a subset
 of the exception types that `Python has`_.
 
 situation, the VM quits the normal interpreter loop and raises an exception.
 If the application program has prepared to catch the exception, the VM will
 do so; otherwise, an unhandled exception causes the interpreter loop to quit
-and the ``PyReturn_t`` code is returned to the calling environment.
+and the ``PmReturn_t`` code is returned to the calling environment.
 
 .. _`Python has`: http://docs.python.org/api/standardExceptions.html
 
 Errors
 ------
 
-The ``PyReturn_t`` data type is defined in ``src/vm/py.h``.
+The ``PmReturn_t`` data type is defined in ``src/vm/pm.h``.
 It is an enumeration that needs to fit within eight bits,
 which means there are only 256 values available for use.
 
     =================   =========   ========================================
     Name                Value       Meaning
     =================   =========   ========================================
-    PY_RET_OK           0x00        Everything is okay
-    PY_RET_NO           0xFF        General "no result"
-    PY_RET_ERR          0xFE        General failure
-    PY_RET_STUB         0xFD        Return value for stub function
+    PM_RET_OK           0x00        Everything is okay
+    PM_RET_NO           0xFF        General "no result"
+    PM_RET_ERR          0xFE        General failure
+    PM_RET_STUB         0xFD        Return value for stub function
     =================   =========   ========================================
 
 Exceptions
 ----------
 
-The other values of the ``PyReturn_t`` enumeration are used to indicate an
+The other values of the ``PmReturn_t`` enumeration are used to indicate an
 exceptional situation that will cause the VM to quit unless it is properly
 handled.  The list of exceptions implemented is determined partly by necessity
 and partly by an estimation of future necessity.  The following table lists
     =================   =========   ========================================
     Name                Value       Meaning
     =================   =========   ========================================
-    PY_RET_EX           0xE0        General exception
-    PY_RET_EX_EXIT      0xE1        System exit
-    PY_RET_EX_FLOAT     0xE2        Floating point error
-    PY_RET_EX_ZDIV      0xE3        Zero division error
-    PY_RET_EX_ASSRT     0xE4        Assertion error
-    PY_RET_EX_ATTR      0xE5        Attribute error
-    PY_RET_EX_IMPRT     0xE6        Import error
-    PY_RET_EX_INDX      0xE7        Index error
-    PY_RET_EX_KEY       0xE8        Key error
-    PY_RET_EX_MEM       0xE9        Memory error
-    PY_RET_EX_NAME      0xEA        Name error
-    PY_RET_EX_RUNTIME   0xEB        Runtime error
-    PY_RET_EX_SYNTAX    0xEC        Syntax error
-    PY_RET_EX_SYS       0xED        System error
-    PY_RET_EX_TYPE      0xEE        Type error
-    PY_RET_EX_VAL       0xEF        Value error
-    PY_RET_EX_WARN      0xD0        Warning
+    PM_RET_EX           0xE0        General exception
+    PM_RET_EX_EXIT      0xE1        System exit
+    PM_RET_EX_FLOAT     0xE2        Floating point error
+    PM_RET_EX_ZDIV      0xE3        Zero division error
+    PM_RET_EX_ASSRT     0xE4        Assertion error
+    PM_RET_EX_ATTR      0xE5        Attribute error
+    PM_RET_EX_IMPRT     0xE6        Import error
+    PM_RET_EX_INDX      0xE7        Index error
+    PM_RET_EX_KEY       0xE8        Key error
+    PM_RET_EX_MEM       0xE9        Memory error
+    PM_RET_EX_NAME      0xEA        Name error
+    PM_RET_EX_RUNTIME   0xEB        Runtime error
+    PM_RET_EX_SYNTAX    0xEC        Syntax error
+    PM_RET_EX_SYS       0xED        System error
+    PM_RET_EX_TYPE      0xEE        Type error
+    PM_RET_EX_VAL       0xEF        Value error
+    PM_RET_EX_WARN      0xD0        Warning
     =================   =========   ========================================
 
 In PyMite, there is only one kind of exception object and the PyMite user
 should not try to subclass it.  Instead, the user should create an instance
 of Exception and set the ``code`` attribute to a value that is unique among
 all other exceptions.  For built-in exception types, the ``code`` field has
-a value that is identical to the ``PyReturn_t`` value with the same meaning.
+a value that is identical to the ``PmReturn_t`` value with the same meaning.
 
 For example the built-in ``AssertionError`` is created like this in the
 builtins module::

File docs/src/HowToReleasePyMite.txt

         - Add a line item into the entry for each ticket that went into this
           release.
 
-    - Edit ``src/vm/py.h``, update the value for the definition, ``PY_RELEASE``
+    - Edit ``src/vm/pm.h``, update the value for the definition, ``PM_RELEASE``
     - Perform all the standard builds to see that they complete without error
 
         - ``make html``

File docs/src/HowToUsePyMite.txt

 The next step is to create a C file that will run this program in the PyMite VM.
 The following C program will do exactly that::
 
-    #include "py.h"
+    #include "pm.h"
 
     extern unsigned char usrlib_img[];
 
     int main(void)
     {
-        PyReturn_t retval;
+        PmReturn_t retval;
 
         retval = pm_init(MEMSPACE_FLASH, usrlib_img);
-        PY_RETURN_IF_ERROR(retval);
+        PM_RETURN_IF_ERROR(retval);
 
         retval = pm_run((P_U8)"trivial");
         return (int)retval;
 which contains the `image` of our application (the equivalent of a ``.pyc``
 file).  Our application does not have any native code, but ``trivial_nat.c``
 is still needed because it defines an empty function table that needs to be
-linked to the VM.  The macro ``PY_RETURN_IF_ERROR()`` does what its name
+linked to the VM.  The macro ``PM_RETURN_IF_ERROR()`` does what its name
 suggests.
 
 The next PyMite API, ``pm_run()`` tries to execute the module with the same

File src/lib/__bi.py

 
 #### CONSTS
 
-C = "Copyright 2001 Dean W. Hall.  All rights reserved."
+C = "Copyright 2002 Dean Hall.  Licensed under GPL v2."
 
 
 #### FUNCS
 
 def globals():
     """__NATIVE__
-    pPyObj_t pr = C_NULL;
+    pPmObj_t pr = C_NULL;
 
     /* If wrong number of args, raise TypeError */
     if (NATIVE_GET_NUM_ARGS() != 0)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Return calling frame's globals dict  on stack*/
-    pr = (pPyObj_t)NATIVE_GET_PFRAME()->fo_globals;
+    pr = (pPmObj_t)NATIVE_GET_PFRAME()->fo_globals;
     NATIVE_SET_TOS(pr);
 
-    return PY_RET_OK;
+    return PM_RET_OK;
     """
     pass
 
 
 def id(o):
     """__NATIVE__
-    PyReturn_t retval;
-    pPyObj_t pr = C_NULL;
+    PmReturn_t retval;
+    pPmObj_t pr = C_NULL;
 
     /* If wrong number of args, raise TypeError */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Return object's address as an int on the stack */
 
 def len(s):
     """__NATIVE__
-    PyReturn_t retval;
-    pPyObj_t ps = C_NULL;
-    pPyObj_t pr = C_NULL;
+    PmReturn_t retval;
+    pPmObj_t ps = C_NULL;
+    pPmObj_t pr = C_NULL;
 
     /* If wrong number of args, raise TypeError */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get first arg */
     switch (ps->od.od_type)
     {
         case OBJ_TYPE_STR:
-            retval = int_new(((pPyString_t)ps)->length, &pr);
+            retval = int_new(((pPmString_t)ps)->length, &pr);
             break;
 
         case OBJ_TYPE_TUP:
-            retval = int_new(((pPyTuple_t)ps)->length, &pr);
+            retval = int_new(((pPmTuple_t)ps)->length, &pr);
             break;
 
         case OBJ_TYPE_LST:
-            retval = int_new(((pPyList_t)ps)->length, &pr);
+            retval = int_new(((pPmList_t)ps)->length, &pr);
             break;
 
         case OBJ_TYPE_DIC:
-            retval = int_new(((pPyDict_t)ps)->length, &pr);
+            retval = int_new(((pPmDict_t)ps)->length, &pr);
             break;
 
         default:
             /* If not a string or sequence type, raise TypeError */
-            retval = PY_RET_EX_TYPE;
+            retval = PM_RET_EX_TYPE;
     }
 
     NATIVE_SET_TOS(pr);
 
 def locals():
     """__NATIVE__
-    pPyObj_t pr = C_NULL;
+    pPmObj_t pr = C_NULL;
 
     /* If wrong number of args, raise TypeError */
     if (NATIVE_GET_NUM_ARGS() != 0)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Return calling frame's local attrs dict on the stack */
-    pr = (pPyObj_t)NATIVE_GET_PFRAME()->fo_attrs;
+    pr = (pPmObj_t)NATIVE_GET_PFRAME()->fo_attrs;
     NATIVE_SET_TOS(pr);
 
-    return PY_RET_OK;
+    return PM_RET_OK;
     """
     pass
 
 
 def map(f, s):
     """__NATIVE__
-    PyReturn_t retval;
-    pPyObj_t pf = C_NULL;
-    pPyObj_t ps = C_NULL;
-    pPyObj_t pr = C_NULL;
+    PmReturn_t retval;
+    pPmObj_t pf = C_NULL;
+    pPmObj_t ps = C_NULL;
+    pPmObj_t pr = C_NULL;
     S8 length = 0;
     S8 i = 0;
 
     /* If wrong number of args, raise TypeError */
     if (NATIVE_GET_NUM_ARGS() != 2)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get args */
     /* If args are wrong type, raise TypeError */
     if (pf->od.od_type != OBJ_TYPE_FXN)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the sequence length based on type */
     switch (ps->od.od_type)
     {
         case OBJ_TYPE_TUP:
-            length = ((pPyTuple_t)ps)->length;
+            length = ((pPmTuple_t)ps)->length;
             break;
 
         case OBJ_TYPE_LST:
-            length = ((pPyList_t)ps)->length;
+            length = ((pPmList_t)ps)->length;
             break;
 
         case OBJ_TYPE_STR:
-            length = ((pPyString_t)ps)->length;
+            length = ((pPmString_t)ps)->length;
             break;
 
         default:
-            return PY_RET_EX_TYPE;
+            return PM_RET_EX_TYPE;
     }
 
     /* XXX: Do a dummy map, fill func with Nones */
     retval = list_new(&pr);
-    PY_RETURN_IF_ERROR(retval);
+    PM_RETURN_IF_ERROR(retval);
 
     for (i = 0; i < length; i++)
     {
-        retval = list_append(pr, PY_NONE);
-        PY_RETURN_IF_ERROR(retval);
+        retval = list_append(pr, PM_NONE);
+        PM_RETURN_IF_ERROR(retval);
     }
 
     return retval;
 
 def range(a, b, c):
     """__NATIVE__
-    PyReturn_t retval;
-    pPyObj_t pa = C_NULL;
-    pPyObj_t pb = C_NULL;
-    pPyObj_t pc = C_NULL;
-    pPyObj_t pi = C_NULL;
-    pPyObj_t pr = C_NULL;
+    PmReturn_t retval;
+    pPmObj_t pa = C_NULL;
+    pPmObj_t pb = C_NULL;
+    pPmObj_t pc = C_NULL;
+    pPmObj_t pi = C_NULL;
+    pPmObj_t pr = C_NULL;
     U16 i = 0;
 
     switch (NATIVE_GET_NUM_ARGS())
     {
         case 1:
-            pa = PY_ZERO;
+            pa = PM_ZERO;
             pb = NATIVE_GET_LOCAL(0);
-            pc = PY_ONE;
+            pc = PM_ONE;
             break;
 
         case 2:
             pa = NATIVE_GET_LOCAL(0);
             pb = NATIVE_GET_LOCAL(1);
-            pc = PY_ONE;
+            pc = PM_ONE;
             break;
 
         case 3:
             pc = NATIVE_GET_LOCAL(2);
 
             /* If 3rd arg is 0, ValueError */
-            if (((pPyInt_t)pc)->val == 0)
+            if (((pPmInt_t)pc)->val == 0)
             {
-                return PY_RET_EX_VAL;
+                return PM_RET_EX_VAL;
             }
             break;
 
         default:
             /* If wrong number of args, raise TypeError */
-            return PY_RET_EX_TYPE;
+            return PM_RET_EX_TYPE;
     }
 
     /* Allocate list */
     retval = list_new(&pr);
-    PY_RETURN_IF_ERROR(retval);
+    PM_RETURN_IF_ERROR(retval);
 
     /* Iterate depending on counting direction */
-    if (((pPyInt_t)pc)->val > 0)
+    if (((pPmInt_t)pc)->val > 0)
     {
-        for (i = ((pPyInt_t)pa)->val;
-             i < ((pPyInt_t)pb)->val;
-             i += ((pPyInt_t)pc)->val)
+        for (i = ((pPmInt_t)pa)->val;
+             i < ((pPmInt_t)pb)->val;
+             i += ((pPmInt_t)pc)->val)
         {
             retval = int_new(i, &pi);
-            PY_RETURN_IF_ERROR(retval);
+            PM_RETURN_IF_ERROR(retval);
 
             retval = list_append(pr, pi);
-            PY_RETURN_IF_ERROR(retval);
+            PM_RETURN_IF_ERROR(retval);
         }
     }
     else
     {
-        for (i = ((pPyInt_t)pa)->val;
-             i > ((pPyInt_t)pb)->val;
-             i += ((pPyInt_t)pc)->val)
+        for (i = ((pPmInt_t)pa)->val;
+             i > ((pPmInt_t)pb)->val;
+             i += ((pPmInt_t)pc)->val)
         {
             retval = int_new(i, &pi);
-            PY_RETURN_IF_ERROR(retval);
+            PM_RETURN_IF_ERROR(retval);
 
             list_append(pr, pi);
-            PY_RETURN_IF_ERROR(retval);
+            PM_RETURN_IF_ERROR(retval);
         }
     }
 
 
 def type(o):
     """__NATIVE__
-    PyReturn_t retval;
-    pPyObj_t po = C_NULL;
-    pPyObj_t pr = C_NULL;
+    PmReturn_t retval;
+    pPmObj_t po = C_NULL;
+    pPmObj_t pr = C_NULL;
 
     /* If wrong number of args, raise TypeError */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get arg */
 #
 def _exn():
     """__NATIVE__
-    PyReturn_t retval;
-    pPyClass_t pexn;
+    PmReturn_t retval;
+    pPmClass_t pexn;
     P_U8 pchunk;
 
     /* Alloc a class object with attributes dict */
-    retval = heap_getChunk(sizeof(PyClass_t), &pchunk);
-    PY_RETURN_IF_ERROR(retval);
-    pexn = (pPyClass_t)pchunk;
+    retval = heap_getChunk(sizeof(PmClass_t), &pchunk);
+    PM_RETURN_IF_ERROR(retval);
+    pexn = (pPmClass_t)pchunk;
     pexn->od.od_type = OBJ_TYPE_EXN;
-    retval = dict_new((pPyObj_t *)&pexn->cl_attrs);
+    retval = dict_new((pPmObj_t *)&pexn->cl_attrs);
 
-    NATIVE_SET_TOS((pPyObj_t)pexn);
+    NATIVE_SET_TOS((pPmObj_t)pexn);
 
     return retval;
     """

File src/lib/mmb.py

 def adcGet(c):
     """__NATIVE__
     /* The arg is the ADC channel to read */
-    pPyObj_t pc = C_NULL;
-    pPyObj_t pr = C_NULL;
+    pPmObj_t pc = C_NULL;
+    pPmObj_t pr = C_NULL;
     S8 chan;
-    PyReturn_t retval;
+    PmReturn_t retval;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get arg, throw type exception if it's not an int */
     pc = NATIVE_GET_LOCAL(0);
     if (pc->od.od_type != OBJ_TYPE_INT)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the channel number */
-    chan = (S8)(((pPyInt_t)pc)->val & 0x03);
+    chan = (S8)(((pPmInt_t)pc)->val & 0x03);
 
     /* Return new int from the conversion result on the stack */
     retval = int_new(mmb_adcGet(chan), &pr);
 
 def adcGetBMA(c):
     """__NATIVE__
-    pPyObj_t pc = C_NULL;
-    pPyObj_t pr = C_NULL;
+    pPmObj_t pc = C_NULL;
+    pPmObj_t pr = C_NULL;
     S8 chan;
-    PyReturn_t retval;
+    PmReturn_t retval;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get arg, throw type exception if it's not an int */
     pc = NATIVE_GET_LOCAL(0);
     if (pc->od.od_type != OBJ_TYPE_INT)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the channel number */
-    chan = (S8)(((pPyInt_t)pc)->val & 0x03);
+    chan = (S8)(((pPmInt_t)pc)->val & 0x03);
 
     /* Return new int from the conversion result on the stack */
     retval = int_new(mmb_adcGetBMA(chan), &pr);
 
 def beep(f, ms):
     """__NATIVE__
-    pPyObj_t pf = C_NULL;
-    pPyObj_t pms = C_NULL;
+    pPmObj_t pf = C_NULL;
+    pPmObj_t pms = C_NULL;
     U16 f;
     U16 ms;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 2)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the args, throw exception if needed */
     if ((pf->od.od_type != OBJ_TYPE_INT) ||
         (pms->od.od_type != OBJ_TYPE_INT))
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get frequency and duration values */
-    f = (U16)((pPyInt_t)pf)->val;
-    ms = (U16)((pPyInt_t)pms)->val;
+    f = (U16)((pPmInt_t)pf)->val;
+    ms = (U16)((pPmInt_t)pms)->val;
 
     /* Call mmb's beep fxn */
     mmb_beep(f, ms);
 
     /* Return none obj on stack */
-    NATIVE_SET_TOS(PY_NONE);
+    NATIVE_SET_TOS(PM_NONE);
 
-    return PY_RET_OK;
+    return PM_RET_OK;
     """
     pass
 
 
 def digGet(c):
     """__NATIVE__
-    pPyObj_t pc = C_NULL;
-    pPyObj_t pr = C_NULL;
+    pPmObj_t pc = C_NULL;
+    pPmObj_t pr = C_NULL;
     S8 chan;
-    PyReturn_t retval;
+    PmReturn_t retval;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the arg, throw exception if needed */
     pc = NATIVE_GET_LOCAL(0);
     if (pc->od.od_type != OBJ_TYPE_INT)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the channel value */
-    chan = (S8)(((pPyInt_t)pc)->val & 0x03);
+    chan = (S8)(((pPmInt_t)pc)->val & 0x03);
 
     /* Return new int with digital value on stack */
     retval = int_new(mmb_digGet(chan), &pr);
 
 def digGetByte():
     """__NATIVE__
-    pPyObj_t pr = C_NULL;
-    PyReturn_t retval;
+    pPmObj_t pr = C_NULL;
+    PmReturn_t retval;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 0)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Return new int from DIG port value on stack */
 
 def dipGet(c):
     """__NATIVE__
-    pPyObj_t pc = C_NULL;
-    pPyObj_t pr = C_NULL;
+    pPmObj_t pc = C_NULL;
+    pPmObj_t pr = C_NULL;
     S8 chan;
-    PyReturn_t retval;
+    PmReturn_t retval;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the arg, throw type exception if needed */
     pc = NATIVE_GET_LOCAL(0);
     if (pc->od.od_type != OBJ_TYPE_INT)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the chan value */
-    chan = (S8)(((pPyInt_t)pc)->val & 0x03);
+    chan = (S8)(((pPmInt_t)pc)->val & 0x03);
 
     /* Return dip value on the stack */
     retval = int_new(mmb_dipGet(chan), &pr);
 
 def dipGetByte():
     """__NATIVE__
-    pPyObj_t pr = C_NULL;
-    PyReturn_t retval;
+    pPmObj_t pr = C_NULL;
+    PmReturn_t retval;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 0)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Return new int from DIG port value on stack */
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 0)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Init board */
              );
 
     /* Return none obj on stack */
-    NATIVE_SET_TOS(PY_NONE);
+    NATIVE_SET_TOS(PM_NONE);
 
-    return PY_RET_OK;
+    return PM_RET_OK;
     """
     pass
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 0)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Clear the LCD screen */
     mmb_lcdClrScr();
 
     /* Return none obj on stack */
-    NATIVE_SET_TOS(PY_NONE);
+    NATIVE_SET_TOS(PM_NONE);
 
-    return PY_RET_OK;
+    return PM_RET_OK;
     """
     pass
 
 
 def lcdPrintStr(ps):
     """__NATIVE__
-    pPyObj_t ps = C_NULL;
+    pPmObj_t ps = C_NULL;
     P_U8 s = C_NULL;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the arg, throw type exception if needed */
     ps = NATIVE_GET_LOCAL(0);
     if (ps->od.od_type != OBJ_TYPE_STR)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get a pointer to the string */
-    s = (P_U8)((pPyString_t)ps)->val;
+    s = (P_U8)((pPmString_t)ps)->val;
 
     /* Print the string on the mmb's lcd */
     /* WARNING: PyMite's strings aren't null term 100% of the time */
     mmb_lcdPrintStr(s);
 
     /* Return none obj on stack */
-    NATIVE_SET_TOS(PY_NONE);
+    NATIVE_SET_TOS(PM_NONE);
 
-    return PY_RET_OK;
+    return PM_RET_OK;
     """
     pass
 
 
 def lcdSetLine(n):
     """__NATIVE__
-    pPyObj_t pn = C_NULL;
+    pPmObj_t pn = C_NULL;
     U8 n;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the arg, throw type exception if needed */
     pn = NATIVE_GET_LOCAL(0);
     if (pn->od.od_type != OBJ_TYPE_INT)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the line number and call mmb lib fxn*/
-    n = (U8)((pPyInt_t)pn)->val;
+    n = (U8)((pPmInt_t)pn)->val;
     mmb_lcdSetLine(n);
 
     /* Return none obj on stack */
-    NATIVE_SET_TOS(PY_NONE);
+    NATIVE_SET_TOS(PM_NONE);
 
-    return PY_RET_OK;
+    return PM_RET_OK;
     """
     pass
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     mmb_lcdTitleScreen();
 
     /* Return none obj on stack */
-    NATIVE_SET_TOS(PY_NONE);
+    NATIVE_SET_TOS(PM_NONE);
 
-    return PY_RET_OK;
+    return PM_RET_OK;
     """
     pass
 
 
 def pwmA(s):
     """__NATIVE__
-    pPyObj_t ps = C_NULL;
+    pPmObj_t ps = C_NULL;
     S8 duty;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the arg, throw exception if needed */
     ps = NATIVE_GET_LOCAL(0);
     if (ps->od.od_type != OBJ_TYPE_INT)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the duty cycle value */
-    duty = (S16)((pPyInt_t)ps)->val;
+    duty = (S16)((pPmInt_t)ps)->val;
 
     mmb_pwmA(duty);
 
     /* Return none obj on stack */
-    NATIVE_SET_TOS(PY_NONE);
+    NATIVE_SET_TOS(PM_NONE);
 
-    return PY_RET_OK;
+    return PM_RET_OK;
     """
     pass
 
 
 def pwmB(s):
     """__NATIVE__
-    pPyObj_t ps = C_NULL;
+    pPmObj_t ps = C_NULL;
     S8 duty;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the arg, throw type exception if needed */
     ps = NATIVE_GET_LOCAL(0);
     if (ps->od.od_type != OBJ_TYPE_INT)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the duty cycle value */
-    duty = (S16)((pPyInt_t)ps)->val;
+    duty = (S16)((pPmInt_t)ps)->val;
 
     mmb_pwmB(duty);
 
     /* Return none obj on stack */
-    NATIVE_SET_TOS(PY_NONE);
+    NATIVE_SET_TOS(PM_NONE);
 
-    return PY_RET_OK;
+    return PM_RET_OK;
     """
     pass
 
 
 def sciGetByte():
     """__NATIVE__
-    pPyObj_t pr = C_NULL;
-    PyReturn_t retval;
+    pPmObj_t pr = C_NULL;
+    PmReturn_t retval;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 0)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Return new int from SCI value on stack */
 
 def sciPutByte(c):
     """__NATIVE__
-    pPyObj_t pc = C_NULL;
+    pPmObj_t pc = C_NULL;
     U8 c;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the arg */
     /* if arg is a string, write 0th char */
     if (pc->od.od_type == OBJ_TYPE_STR)
     {
-        c = (U8)(((pPyString_t)pc)->val[0]);
+        c = (U8)(((pPmString_t)pc)->val[0]);
         mmb_sciPutByte(c);
     }
     /* if arg is an int, write LSB */
     else if (pc->od.od_type == OBJ_TYPE_INT)
     {
-        c = (U8)(((pPyInt_t)pc)->val & 0xFF);
+        c = (U8)(((pPmInt_t)pc)->val & 0xFF);
         mmb_sciPutByte(c);
     }
 
     /* Otherwise, throw type exception */
     else
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Return none obj on stack */
-    NATIVE_SET_TOS(PY_NONE);
+    NATIVE_SET_TOS(PM_NONE);
 
-    return PY_RET_OK;
+    return PM_RET_OK;
     """
     pass
 
 
 def sciPutStr(s):
     """__NATIVE__
-    pPyObj_t ps = C_NULL;
+    pPmObj_t ps = C_NULL;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the arg, throw type exception if needed */
     ps = NATIVE_GET_LOCAL(0);
     if (ps->od.od_type != OBJ_TYPE_STR)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Blocking write of s out SCI port */
     /* WARNING: PyMite strings aren't always null-terminated! */
-    mmb_sciPutStr(((pPyString_t)ps)->val);
+    mmb_sciPutStr(((pPmString_t)ps)->val);
 
     /* Return none obj on stack */
-    NATIVE_SET_TOS(PY_NONE);
+    NATIVE_SET_TOS(PM_NONE);
 
-    return PY_RET_OK;
+    return PM_RET_OK;
     """
     pass
 
 
 def sleepms(ms):
     """__NATIVE__
-    pPyObj_t pms = C_NULL;
+    pPmObj_t pms = C_NULL;
     U16 ms;
 
     /* If wrong number of args, throw type exception */
     if (NATIVE_GET_NUM_ARGS() != 1)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the arg, throw type exception if needed */
     pms = NATIVE_GET_LOCAL(0);
     if (pms->od.od_type != OBJ_TYPE_INT)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Get the line number and call mmb lib fxn*/
-    ms = (U16)((pPyInt_t)pms)->val;
+    ms = (U16)((pPmInt_t)pms)->val;
 
     mmb_sleepms(ms);
 
     /* Return none obj on stack */
-    NATIVE_SET_TOS(PY_NONE);
+    NATIVE_SET_TOS(PM_NONE);
 
-    return PY_RET_OK;
+    return PM_RET_OK;
     """
     pass
 
 
 def toc():
     """__NATIVE__
-    pPyObj_t pr = C_NULL;
-    PyReturn_t retval;
+    pPmObj_t pr = C_NULL;
+    PmReturn_t retval;
 
     /* Return new int from toc value on stack */
     retval = int_new((S32)mmb_toc(), &pr);

File src/lib/sys.py

 
 def exit(val):
     """__NATIVE__
-    pPyObj_t pval = C_NULL;
+    pPmObj_t pval = C_NULL;
 
     /* If no arg given, assume return 0 */
     if (NATIVE_GET_NUM_ARGS() == 0)
     {
-        NATIVE_SET_TOS(PY_ZERO);
+        NATIVE_SET_TOS(PM_ZERO);
     }
     
     /* If 1 arg given, put it on stack */
     /* If wrong number of args, raise TypeError */
     else
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* Raise the SystemExit exception */
-    return PY_RET_EX_EXIT;
+    return PM_RET_EX_EXIT;
     """
     pass
 

File src/lib/time.py

 #
 def clock():
     """__NATIVE__
-    PyReturn_t retval;
-    pPyObj_t ptime;
+    PmReturn_t retval;
+    pPmObj_t ptime;
 
     /* Create int obj with current time */
 #ifdef TARGET_DESKTOP

File src/sample/sample.c

  */
 
 
-#include "py.h"
+#include "pm.h"
 
 
 extern unsigned char usrlib_img[];
 
 int main(void)
 {
-    PyReturn_t retval;
+    PmReturn_t retval;
 
     retval = pm_init(MEMSPACE_RAM, usrlib_img);
-    PY_RETURN_IF_ERROR(retval);
+    PM_RETURN_IF_ERROR(retval);
 
     retval = pm_run((P_U8)"sample");
     return (int)retval;

File src/tests/t002.c

  *
  */
 
-#include "py.h"
+#include "pm.h"
 
 
 extern unsigned char usrlib_img[];
 
 int main(void)
 {
-    PyReturn_t retval;
+    PmReturn_t retval;
 
     retval = pm_init(MEMSPACE_FLASH, usrlib_img);
-    PY_RETURN_IF_ERROR(retval);
+    PM_RETURN_IF_ERROR(retval);
 
     retval = pm_run((P_U8)"t002");
     return (int)retval;

File src/tests/t002.py

 #
 def push42():
     """__NATIVE__
-    pPyObj_t pint = C_NULL;
-    PyReturn_t retval;
+    pPmObj_t pint = C_NULL;
+    PmReturn_t retval;
 
     retval = int_new((S32)42, &pint);
     NATIVE_SET_TOS(pint);

File src/tests/t003.c

  * 2002/05/18   First.
  */
 
-#include "py.h"
+#include "pm.h"
 
 
 extern unsigned char usrlib_img[];
 
 int main(void)
 {
-    PyReturn_t retval;
+    PmReturn_t retval;
 
     retval = pm_init(MEMSPACE_FLASH, usrlib_img);
-    PY_RETURN_IF_ERROR(retval);
+    PM_RETURN_IF_ERROR(retval);
 
     retval = pm_run((P_U8)"t003");
     return (int)retval;

File src/tests/t006.c

  */
 
 
-#include "py.h"
+#include "pm.h"
 
 extern unsigned char stdlib_img[];
 extern unsigned char usrlib_img[];
 int main(void)
 {
     P_U8 pimg;
-    PyReturn_t retval = PY_RET_OK;
+    PmReturn_t retval = PM_RET_OK;
 
     heap_init();
     retval = global_init();
-    PY_RETURN_IF_ERROR(retval);
+    PM_RETURN_IF_ERROR(retval);
 
     /* Read in the stdlib modules */
     pimg = (P_U8)&stdlib_img;
     retval = img_findInMem(MEMSPACE_FLASH, &pimg);
-    PY_RETURN_IF_ERROR(retval);
+    PM_RETURN_IF_ERROR(retval);
 
     /* The module image list terminator must be a null */
     pimg -= 1;
-    PY_ASSERT(*pimg == C_NULL);
+    PM_ASSERT(*pimg == C_NULL);
 
     /* Read in the usrlib modules */
     pimg = (P_U8)&usrlib_img;
     retval = img_findInMem(MEMSPACE_FLASH, &pimg);
-    PY_RETURN_IF_ERROR(retval);
+    PM_RETURN_IF_ERROR(retval);
 
     /* The module image list terminator must be a null */
     pimg -= 1;
-    PY_ASSERT(*pimg == C_NULL);
+    PM_ASSERT(*pimg == C_NULL);
 
     return retval;
 }

File src/tests/t009.c

  *              not header files
  */
 
-#include "py.h"
+#include "pm.h"
 
 
 extern unsigned char usrlib_img[];
 
 int main(void)
 {
-    PyReturn_t retval;
+    PmReturn_t retval;
 
     retval = pm_init(MEMSPACE_FLASH, usrlib_img);
-    PY_RETURN_IF_ERROR(retval);
+    PM_RETURN_IF_ERROR(retval);
 
     retval = pm_run((P_U8)"t009");
     return (int)retval;

File src/tests/t020.c

  *
  */
 
-#include "py.h"
+#include "pm.h"
 
 
 extern unsigned char usrlib_img[];
 
 int main(void)
 {
-    PyReturn_t retval;
+    PmReturn_t retval;
 
     retval = pm_init(MEMSPACE_FLASH, usrlib_img);
-    PY_RETURN_IF_ERROR(retval);
+    PM_RETURN_IF_ERROR(retval);
 
     retval = pm_run((P_U8)"t020");
     return (int)retval;

File src/tests/ut_dict.c

  */
 
 
-#include "py.h"
+#include "pm.h"
 
 
 /**************************************************************/
 void
 ut_dict_new_000(void)
 {
-    pPyObj_t pobj = C_NULL;
+    pPmObj_t pobj = C_NULL;
 
     dict_new(&pobj);
     if (pobj == C_NULL)
 void
 ut_dict_new_001(void)
 {
-    pPyObj_t pobj = C_NULL;
+    pPmObj_t pobj = C_NULL;
 
     dict_new(&pobj);
     if (pobj->od.od_type != OBJ_TYPE_DIC)
 void
 ut_dict_new_002(void)
 {
-    pPyObj_t pobj = C_NULL;
+    pPmObj_t pobj = C_NULL;
 
     dict_new(&pobj);
     if (pobj->od.od_const != 0)
 void
 ut_dict_new_003(void)
 {
-    pPyObj_t pobj = C_NULL;
+    pPmObj_t pobj = C_NULL;
 
     dict_new(&pobj);
-    if (((pPyDict_t)pobj)->length != 0)
+    if (((pPmDict_t)pobj)->length != 0)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_dict_setItem_000(void)
 {
-    PyReturn_t retval = PY_RET_OK;
-    retval = dict_setItem((pPyObj_t)C_NULL,
-                          (pPyObj_t)C_NULL,
-                          (pPyObj_t)C_NULL);
-    if (retval != PY_RET_EX_SYS)
+    PmReturn_t retval = PM_RET_OK;
+    retval = dict_setItem((pPmObj_t)C_NULL,
+                          (pPmObj_t)C_NULL,
+                          (pPmObj_t)C_NULL);
+    if (retval != PM_RET_EX_SYS)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_dict_setItem_001(void)
 {
-    PyReturn_t retval = PY_RET_OK;
-    pPyObj_t pdict = C_NULL;
+    PmReturn_t retval = PM_RET_OK;
+    pPmObj_t pdict = C_NULL;
 
     dict_new(&pdict);
     retval = dict_setItem(pdict, 
-                          (pPyObj_t)C_NULL, 
-                          (pPyObj_t)C_NULL);
-    if (retval != PY_RET_EX_SYS)
+                          (pPmObj_t)C_NULL, 
+                          (pPmObj_t)C_NULL);
+    if (retval != PM_RET_EX_SYS)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_dict_setItem_002(void)
 {
-    PyReturn_t retval = PY_RET_OK;
-    pPyObj_t pdict = C_NULL;
+    PmReturn_t retval = PM_RET_OK;
+    pPmObj_t pdict = C_NULL;
 
     dict_new(&pdict);
     retval = dict_setItem(pdict,
-                          PY_ZERO,
-                          (pPyObj_t)C_NULL);
-    if (retval != PY_RET_EX_SYS)
+                          PM_ZERO,
+                          (pPmObj_t)C_NULL);
+    if (retval != PM_RET_EX_SYS)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_dict_setItem_003(void)
 {
-    pPyObj_t pdict = C_NULL;
+    pPmObj_t pdict = C_NULL;
 
     dict_new(&pdict);
-    dict_setItem(pdict, PY_ZERO, PY_ONE);
+    dict_setItem(pdict, PM_ZERO, PM_ONE);
     if (pdict == C_NULL)
     {
         TEST_ERR(__LINE__);
 void
 ut_dict_setItem_004(void)
 {
-    pPyObj_t pdict = C_NULL;
-    pPyObj_t pdictbefore = C_NULL;
+    pPmObj_t pdict = C_NULL;
+    pPmObj_t pdictbefore = C_NULL;
 
     dict_new(&pdict);
     pdictbefore = pdict;
-    dict_setItem(pdict, PY_ZERO, PY_ONE);
+    dict_setItem(pdict, PM_ZERO, PM_ONE);
     if (pdict != pdictbefore)
     {
         TEST_ERR(__LINE__);
 void
 ut_dict_setItem_005(void)
 {
-    pPyObj_t pdict = C_NULL;
+    pPmObj_t pdict = C_NULL;
 
     dict_new(&pdict);
-    dict_setItem(pdict, PY_ZERO, PY_ONE);
-    if (((pPyDict_t)pdict)->length != 1)
+    dict_setItem(pdict, PM_ZERO, PM_ONE);
+    if (((pPmDict_t)pdict)->length != 1)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_dict_setItem_006(void)
 {
-    pPyObj_t pval = C_NULL;
-    pPyObj_t pdict = C_NULL;
+    pPmObj_t pval = C_NULL;
+    pPmObj_t pdict = C_NULL;
 
     dict_new(&pdict);
-    dict_setItem(pdict, PY_ZERO, PY_ONE);
-    dict_getItem(pdict, PY_ZERO, &pval);
-    if (pval != PY_ONE)
+    dict_setItem(pdict, PM_ZERO, PM_ONE);
+    dict_getItem(pdict, PM_ZERO, &pval);
+    if (pval != PM_ONE)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_dict_setItem_007(void)
 {
-    pPyObj_t pval = C_NULL;
-    pPyObj_t pdict = C_NULL;
+    pPmObj_t pval = C_NULL;
+    pPmObj_t pdict = C_NULL;
 
     dict_new(&pdict);
-    dict_setItem(pdict, PY_ZERO, PY_ZERO);
-    dict_setItem(pdict, PY_ZERO, PY_ONE);
-    dict_getItem(pdict, PY_ZERO, &pval);
-    if (pval != PY_ONE)
+    dict_setItem(pdict, PM_ZERO, PM_ZERO);
+    dict_setItem(pdict, PM_ZERO, PM_ONE);
+    dict_getItem(pdict, PM_ZERO, &pval);
+    if (pval != PM_ONE)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_dict_setItem_008(void)
 {
-    PyReturn_t retval = PY_RET_OK;
-    pPyObj_t pdict = C_NULL;
+    PmReturn_t retval = PM_RET_OK;
+    pPmObj_t pdict = C_NULL;
 
     dict_new(&pdict);
     retval = dict_setItem(pdict,
-                          PY_ZERO,
-                          PY_ZERO);
-    if (retval != PY_RET_OK)
+                          PM_ZERO,
+                          PM_ZERO);
+    if (retval != PM_RET_OK)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_dict_clear_000(void)
 {
-    dict_clear((pPyObj_t)C_NULL);
+    dict_clear((pPmObj_t)C_NULL);
 }
 
 /** Test dict_clear() passing non-dict, return is void, must inspect */
 void
 ut_dict_clear_001(void)
 {
-    pPyObj_t pint;
-    PyReturn_t retval = PY_RET_OK;
+    pPmObj_t pint;
+    PmReturn_t retval = PM_RET_OK;
     
      retval = int_new(256, &pint);
     dict_clear(pint);
 void
 ut_dict_clear_002(void)
 {
-    pPyObj_t pdict = C_NULL;
+    pPmObj_t pdict = C_NULL;
 
     dict_new(&pdict);
     dict_clear(pdict);
 void
 ut_dict_clear_003(void)
 {
-    pPyObj_t pdict = C_NULL;
+    pPmObj_t pdict = C_NULL;
 
     dict_new(&pdict);
     dict_clear(pdict);
-    if (((pPyDict_t)pdict)->length != 0)
+    if (((pPmDict_t)pdict)->length != 0)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_dict_clear_004(void)
 {
-    pPyObj_t pdict = C_NULL;
+    pPmObj_t pdict = C_NULL;
 
     dict_new(&pdict);
-    dict_setItem(pdict, PY_ZERO, PY_ZERO);
+    dict_setItem(pdict, PM_ZERO, PM_ZERO);
     dict_clear(pdict);
-    if (((pPyDict_t)pdict)->length != 0)
+    if (((pPmDict_t)pdict)->length != 0)
     {
         TEST_ERR(__LINE__);
     }

File src/tests/ut_list.c

  */
 
 
-#include "py.h"
+#include "pm.h"
 
 
 /**************************************************************/
 void
 ut_list_new_000(void)
 {
-    PyReturn_t retval = PY_RET_OK;
-    pPyObj_t pobj = C_NULL;
+    PmReturn_t retval = PM_RET_OK;
+    pPmObj_t pobj = C_NULL;
 
     retval = list_new(&pobj);
-    if (retval != PY_RET_OK)
+    if (retval != PM_RET_OK)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_list_new_001(void)
 {
-    PyReturn_t retval = PY_RET_OK;
-    pPyObj_t pobj = C_NULL;
+    PmReturn_t retval = PM_RET_OK;
+    pPmObj_t pobj = C_NULL;
 
     retval = list_new(&pobj);
     if (pobj->od.od_type != OBJ_TYPE_LST)
 void
 ut_list_new_002(void)
 {
-    PyReturn_t retval = PY_RET_OK;
-    pPyObj_t pobj = C_NULL;
+    PmReturn_t retval = PM_RET_OK;
+    pPmObj_t pobj = C_NULL;
 
     retval = list_new(&pobj);
     if (pobj->od.od_const != 0)
 void
 ut_list_new_003(void)
 {
-    PyReturn_t retval = PY_RET_OK;
-    pPyObj_t pobj = C_NULL;
+    PmReturn_t retval = PM_RET_OK;
+    pPmObj_t pobj = C_NULL;
 
     retval = list_new(&pobj);
-    if (((pPyList_t)pobj)->length != 0)
+    if (((pPmList_t)pobj)->length != 0)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_list_new_004(void)
 {
-    PyReturn_t retval = PY_RET_OK;
-    pPyObj_t plist = C_NULL;
+    PmReturn_t retval = PM_RET_OK;
+    pPmObj_t plist = C_NULL;
 
     retval = list_new(&plist);
-    if (((pPyList_t)plist)->val == C_NULL)
+    if (((pPmList_t)plist)->val == C_NULL)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_list_append_000(void)
 {
-    PyReturn_t retval = PY_RET_OK;
+    PmReturn_t retval = PM_RET_OK;
 
-    retval = list_append((pPyObj_t)C_NULL, (pPyObj_t)C_NULL);
-    if (retval != PY_RET_EX_VAL)
+    retval = list_append((pPmObj_t)C_NULL, (pPmObj_t)C_NULL);
+    if (retval != PM_RET_EX_VAL)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_list_append_001(void)
 {
-    PyReturn_t retval = PY_RET_OK;
-    pPyObj_t plist = C_NULL;
+    PmReturn_t retval = PM_RET_OK;
+    pPmObj_t plist = C_NULL;
 
     retval = list_new(&plist);
-    retval = list_append(plist, (pPyObj_t)C_NULL);
-    if (retval != PY_RET_EX_VAL)
+    retval = list_append(plist, (pPmObj_t)C_NULL);
+    if (retval != PM_RET_EX_VAL)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_list_append_002(void)
 {
-    PyReturn_t retval = PY_RET_OK;
+    PmReturn_t retval = PM_RET_OK;
 
-    retval = list_append(PY_ZERO, PY_ONE);
-    if (retval != PY_RET_EX_VAL)
+    retval = list_append(PM_ZERO, PM_ONE);
+    if (retval != PM_RET_EX_VAL)
     {
         TEST_ERR(__LINE__);
     }
 void
 ut_list_append_003(void)
 {
-    PyReturn_t retval = PY_RET_OK;
-    pPyObj_t plist = C_NULL;
+    PmReturn_t retval = PM_RET_OK;
+    pPmObj_t plist = C_NULL;
 
     retval = list_new(&plist);
-    retval = list_append(plist, PY_ZERO);
-    if (((pPyList_t)plist)->length != 1)
+    retval = list_append(plist, PM_ZERO);
+    if (((pPmList_t)plist)->length != 1)
     {
         TEST_ERR(__LINE__);
     }

File src/tools/pmImgCreator.py

 # XXX remap bcode values to make parsing easier
 REMAP_BCODE_VALS = 0
 
-# Py obj descriptor type constants
-# Must match PyType_e in py.h
+# Pm obj descriptor type constants
+# Must match PmType_e in pm.h
 OBJ_TYPE_NON = 0x00     # None
 OBJ_TYPE_INT = 0x01     # Signed integer
 OBJ_TYPE_FLT = 0x02     # Floating point 32b
                                     " * value of zero denotes the stdlib.\n"
                                     " * This function should not be called.\n"
                                     " */\n"
-                                    "return PY_RET_EX_SYS;\n"
+                                    "return PM_RET_EX_SYS;\n"
                                    ))
 
         # for each src file, convert and format
                         " * @file    %s\n"
                         " */\n\n"
                         "#define __IN_LIBNATIVE_C__\n"
-                        "#include \"py.h\"\n\n"
+                        "#include \"pm.h\"\n\n"
                         % (self.imgtarget,
                            time.ctime(time.time()),
                            self.nativeFilename
 
         # for each entry create fxn
         for (funcname, funcstr) in self.nativetable:
-            fileBuff.append("static PyReturn_t\n"
-                            "%s(pPyFrame_t pframe, signed char numargs)\n"
+            fileBuff.append("static PmReturn_t\n"
+                            "%s(pPmFrame_t pframe, signed char numargs)\n"
                             "{\n"
                             "%s\n"
                             "}\n\n" % (funcname, funcstr))
 
         # create fxn table
         fileBuff.append("/* native function lookup table */\n"
-                        "PyReturn_t (* %s[])(pPyFrame_t, signed char) =\n"
+                        "PmReturn_t (* %s[])(pPmFrame_t, signed char) =\n"
                         "{\n" % (NATIVE_TABLE_NAME[self.imgtarget]))
 
         # put all native funcs in the table

File src/vm/codeobj.c

  * Includes
  **************************************************************/
 
-#include "py.h"
+#include "pm.h"
 
 
 /***************************************************************
  * Functions
  **************************************************************/
 
-PyReturn_t
-co_loadFromImg(PyMemSpace_t memspace, P_U8 *paddr, pPyObj_t * r_pco)
+PmReturn_t
+co_loadFromImg(PmMemSpace_t memspace, P_U8 *paddr, pPmObj_t * r_pco)
 {
-    PyReturn_t retval = PY_RET_OK;
+    PmReturn_t retval = PM_RET_OK;
     S8 i;
-    pPyObj_t pobj;
-    pPyCo_t pco = C_NULL;
+    pPmObj_t pobj;
+    pPmCo_t pco = C_NULL;
     P_U8 pchunk;
 
     /* store ptr to top of code img (less type byte) */
     U16 size = mem_getWord(memspace, paddr);
 
     /* allocate a code obj */
-    retval = heap_getChunk(sizeof(PyCo_t), &pchunk);
-    PY_RETURN_IF_ERROR(retval);
-    pco = (pPyCo_t)pchunk;
+    retval = heap_getChunk(sizeof(PmCo_t), &pchunk);
+    PM_RETURN_IF_ERROR(retval);
+    pco = (pPmCo_t)pchunk;
 
     /* fill in the CO struct */
     pco->od.od_type = OBJ_TYPE_COB;
 
     /* load names (tuple obj) */
     *paddr = pci + CI_NAMES_FIELD;
-    retval = obj_loadFromImg(memspace, paddr, (pPyObj_t *)&(pco->co_names));
-    PY_RETURN_IF_ERROR(retval);
+    retval = obj_loadFromImg(memspace, paddr, (pPmObj_t *)&(pco->co_names));
+    PM_RETURN_IF_ERROR(retval);
 
     /* load consts (tuple obj) assume it follows names */
-    retval = obj_loadFromImg(memspace, paddr, (pPyObj_t *)&(pco->co_consts));
-    PY_RETURN_IF_ERROR(retval);
+    retval = obj_loadFromImg(memspace, paddr, (pPmObj_t *)&(pco->co_consts));
+    PM_RETURN_IF_ERROR(retval);
 
     /* set the od_const flag for all consts */
     for (i = 0; i < pco->co_consts->length; i++)
     /* set addr to point one past end of img */
     *paddr = pci + size;
 
-    *r_pco = (pPyObj_t)pco;
-    return PY_RET_OK;
+    *r_pco = (pPmObj_t)pco;
+    return PM_RET_OK;
 }
 
 
-PyReturn_t
-no_loadFromImg(PyMemSpace_t memspace, P_U8 *paddr, pPyObj_t * r_pno)
+PmReturn_t
+no_loadFromImg(PmMemSpace_t memspace, P_U8 *paddr, pPmObj_t * r_pno)
 {
-    PyReturn_t retval = PY_RET_OK;
-    pPyNo_t pno = C_NULL;
+    PmReturn_t retval = PM_RET_OK;
+    pPmNo_t pno = C_NULL;
     P_U8 pchunk;
 
     /* allocate a code obj */
-    retval = heap_getChunk(sizeof(PyNo_t), &pchunk);
-    PY_RETURN_IF_ERROR(retval);
-    pno = (pPyNo_t)pchunk;
+    retval = heap_getChunk(sizeof(PmNo_t), &pchunk);
+    PM_RETURN_IF_ERROR(retval);
+    pno = (pPmNo_t)pchunk;
 
     /* fill in the NO struct */
     pno->od.od_type = OBJ_TYPE_NOB;
     /* get index into native fxn table */
     pno->no_funcindx = (S16)mem_getWord(memspace, paddr);
 
-    *r_pno = (pPyObj_t)pno;
-    return PY_RET_OK;
+    *r_pno = (pPmObj_t)pno;
+    return PM_RET_OK;
 }

File src/vm/codeobj.h

  * Other parts can be obtained by
  * inspecting the code image itself.
  */
-typedef struct PyCo_s
+typedef struct PmCo_s
 {
     /** object descriptor */
-    PyObjDesc_t     od;
+    PmObjDesc_t     od;
     /** memory space selector */
-    PyMemSpace_t    co_memspace:8;
+    PmMemSpace_t    co_memspace:8;
     /** address in memspace of code image */
     P_U8            co_codeimgaddr;
     /** address in RAM of names tuple */
-    pPyTuple_t      co_names;
+    pPmTuple_t      co_names;
     /** address in RAM of constants tuple */
-    pPyTuple_t      co_consts;
+    pPmTuple_t      co_consts;
     /** address in memspace of bytecode (or native function) */
     P_U8            co_codeaddr;
-} PyCo_t, *pPyCo_t;
+} PmCo_t, *pPmCo_t;
 
 /**
  * Native Code Object
  * Other parts can be obtained by
  * inspecting the native image itself.
  */
-typedef struct PyNo_s
+typedef struct PmNo_s
 {
     /** object descriptor */
-    PyObjDesc_t     od;
+    PmObjDesc_t     od;
     /** expected num args to the func */
     S8              no_argcount;
     /** index into native function table */
     S16             no_funcindx;
-} PyNo_t, *pPyNo_t;
+} PmNo_t, *pPmNo_t;
 
 
 /***************************************************************
  *          filled in.
  * @return  Return status
  */
-PyReturn_t
-co_loadFromImg(PyMemSpace_t memspace,
+PmReturn_t
+co_loadFromImg(PmMemSpace_t memspace,
                P_U8 *paddr,
-               pPyObj_t * r_pco);
+               pPmObj_t * r_pco);
 
 /**
  * Create a Native code object by loading a native image.
  *          return by reference: paddr points one byte
  *          past end of code img
  */
-PyReturn_t no_loadFromImg(PyMemSpace_t memspace,
+PmReturn_t no_loadFromImg(PmMemSpace_t memspace,
                           P_U8 * paddr,
-                          pPyObj_t * r_pno);
+                          pPmObj_t * r_pno);
 
 
 #endif /* __CODEOBJ_H__ */

File src/vm/dict.c

  * Includes
  **************************************************************/
 
-#include "py.h"
+#include "pm.h"
 
 
 /***************************************************************
  * Functions
  **************************************************************/
 
-PyReturn_t
-dict_new(pPyObj_t * r_pdict)
+PmReturn_t
+dict_new(pPmObj_t * r_pdict)
 {
-    PyReturn_t retval = PY_RET_OK;
-    pPyDict_t pdict = C_NULL;
+    PmReturn_t retval = PM_RET_OK;
+    pPmDict_t pdict = C_NULL;
 
     /* allocate a dict */
-    retval = heap_getChunk(sizeof(PyDict_t), (P_U8 *)r_pdict);
-    PY_RETURN_IF_ERROR(retval);
+    retval = heap_getChunk(sizeof(PmDict_t), (P_U8 *)r_pdict);
+    PM_RETURN_IF_ERROR(retval);
 
     /* init dict fields */
-    pdict = (pPyDict_t)*r_pdict;
+    pdict = (pPmDict_t)*r_pdict;
     pdict->od.od_type = OBJ_TYPE_DIC;
     pdict->length = 0;
     retval = seglist_new(&pdict->d_keys);
-    PY_RETURN_IF_ERROR(retval);
+    PM_RETURN_IF_ERROR(retval);
     retval = seglist_new(&pdict->d_vals);
     return retval;
 }
 
 
-PyReturn_t
-dict_clear(pPyObj_t pdict)
+PmReturn_t
+dict_clear(pPmObj_t pdict)
 {
     /* if null or not a dict, raise TypeError */
     if ((pdict == C_NULL) ||
         (pdict->od.od_type != OBJ_TYPE_DIC))
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* clear length */
-    ((pPyDict_t)pdict)->length = 0;
+    ((pPmDict_t)pdict)->length = 0;
 
     /* clear the keys and values seglists if needed */
-    if (((pPyDict_t)pdict)->d_keys != C_NULL)
+    if (((pPmDict_t)pdict)->d_keys != C_NULL)
     {
-        seglist_clear(((pPyDict_t)pdict)->d_keys);
-        seglist_clear(((pPyDict_t)pdict)->d_vals);
+        seglist_clear(((pPmDict_t)pdict)->d_keys);
+        seglist_clear(((pPmDict_t)pdict)->d_vals);
     }
-    return PY_RET_OK;
+    return PM_RET_OK;
 }
 
 
  * Scans dict for the key.  If key val found, replace old
  * with new val.  If no key found, add key/val pair to dict.
  */
-PyReturn_t
-dict_setItem(pPyObj_t pdict, pPyObj_t pkey, pPyObj_t pval)
+PmReturn_t
+dict_setItem(pPmObj_t pdict, pPmObj_t pkey, pPmObj_t pval)
 {
-    PyReturn_t retval = PY_RET_OK;
+    PmReturn_t retval = PM_RET_OK;
     S8 segnum = 0;
     S8 indx = 0;
 
         || (pkey == C_NULL)
         || (pval == C_NULL))
     {
-        return PY_RET_EX_SYS;
+        return PM_RET_EX_SYS;
     }
 
     /* if it's not a dict, raise TypeError */
     if (pdict->od.od_type != OBJ_TYPE_DIC)
     {
-        return PY_RET_EX_TYPE;
+        return PM_RET_EX_TYPE;
     }
 
     /* XXX if key is not hashable, raise TypeError */
     /* XXX if key's hash hasn't been calculated */
 
     /* check for matching key */
-    retval = seglist_findEqual(((pPyDict_t)pdict)->d_keys,
+    retval = seglist_findEqual(((pPmDict_t)pdict)->d_keys,
                                pkey,
                                &segnum,
                                &indx);
 
     /* if found a matching key, replace val obj */
-    if (retval == PY_RET_OK)
+    if (retval == PM_RET_OK)
     {
-        retval = seglist_setItem(((pPyDict_t)pdict)->d_vals,
+        retval = seglist_setItem(((pPmDict_t)pdict)->d_vals,
                                  pval,
                                  segnum,
                                  indx);
-        PY_RETURN_IF_ERROR(retval);
+        PM_RETURN_IF_ERROR(retval);
         /* incr length */
-        ((pPyDict_t)pdict)->length++;
-        return PY_RET_OK;
+        ((pPmDict_t)pdict)->length++;
+        return PM_RET_OK;
     }
 
     /* if no matching key, insert the key,val pair */
-    if (retval == PY_RET_NO)
+    if (retval == PM_RET_NO)
     {
-        retval = seglist_insertItem(((pPyDict_t)pdict)->d_keys,
+        retval = seglist_insertItem(((pPmDict_t)pdict)->d_keys,
                                     pkey,
                                     0,
                                     0);
         /* XXX if error here, dict might be hosed */
-        PY_RETURN_IF_ERROR(retval);
-        retval = seglist_insertItem(((pPyDict_t)pdict)->d_vals,
+        PM_RETURN_IF_ERROR(retval);
+        retval = seglist_insertItem(((pPmDict_t)pdict)->d_vals,
                                     pval,
                                     0,
                                     0);
-        PY_RETURN_IF_ERROR(retval);
+        PM_RETURN_IF_ERROR(retval);
         /* incr length */
-        ((pPyDict_t)pdict)->length++;
-        return PY_RET_OK;
+        ((pPmDict_t)pdict)->length++;
+        return PM_RET_OK;
     }
     return retval;