python-on-a-chip online compiler

Dependencies:   mbed TSI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers seq.h Source File

seq.h

Go to the documentation of this file.
00001 /*
00002 # This file is Copyright 2006 Dean Hall.
00003 # This file is part of the PyMite VM.
00004 # This file is licensed under the MIT License.
00005 # See the LICENSE file for details.
00006 */
00007 
00008 
00009 #ifndef __SEQ_H__
00010 #define __SEQ_H__
00011 
00012 
00013 /**
00014  * \file
00015  * \brief Sequence Header
00016  */
00017 
00018 
00019 /**
00020  * Sequence Iterator Object
00021  *
00022  * Instances of this object are created by GET_ITER and used by FOR_ITER.
00023  * Stores a pointer to a sequence and an index int16_t.
00024  */
00025 typedef struct PmSeqIter_s
00026 {
00027     /** Object descriptor */
00028     PmObjDesc_t od;
00029 
00030     /** Sequence object */
00031     pPmObj_t si_sequence;
00032 
00033     /** Index value */
00034     int16_t si_index;
00035 } PmSeqIter_t,
00036  *pPmSeqIter_t;
00037 
00038 
00039 /**
00040  * Compares two sequences for equality
00041  *
00042  * @param   pobj1 Ptr to first sequence.
00043  * @param   pobj2 Ptr to second sequence.
00044  * @return  C_SAME if the seuqences are equivalent, C_DIFFER otherwise.
00045  */
00046 int8_t seq_compare(pPmObj_t pobj1, pPmObj_t pobj2);
00047 
00048 /**
00049  * Returns the length of the sequence
00050  *
00051  * @param   pobj Ptr to  sequence.
00052  * @param   r_index Return arg, length of sequence
00053  * @return  Return status
00054  */
00055 PmReturn_t seq_getLength(pPmObj_t pobj, uint16_t *r_index);
00056 
00057 /**
00058  * Returns the object from sequence[index]
00059  *
00060  * @param   pobj Ptr to sequence object to get object from
00061  * @param   index Int index into the sequence
00062  * @param   r_pobj Return arg, object from sequence
00063  * @return  Return status
00064  */
00065 PmReturn_t seq_getSubscript(pPmObj_t pobj, int16_t index, pPmObj_t *r_pobj);
00066 
00067 /**
00068  * Returns the next item from the sequence iterator object
00069  *
00070  * @param   pobj Ptr to sequence iterator.
00071  * @param   r_pitem Return arg, pointer to next item from sequence.
00072  * @return  Return status.
00073  */
00074 PmReturn_t seqiter_getNext(pPmObj_t pobj, pPmObj_t *r_pitem);
00075 
00076 
00077 /**
00078  * Returns a new sequence iterator object
00079  *
00080  * @param   pobj Ptr to sequence.
00081  * @param   r_pobj Return by reference, new sequence iterator
00082  * @return  Return status.
00083  */
00084 PmReturn_t seqiter_new(pPmObj_t pobj, pPmObj_t *r_pobj);
00085 
00086 #endif /* __SEQ_H__ */