Norimasa Okamoto
/
pymite
python-on-a-chip online compiler
- http://pymbed.appspot.com/
- https://code.google.com/p/python-on-a-chip/
- http://www.youtube.com/watch?v=Oyqc2bFRW9I
- https://bitbucket.org/va009039/pymbed/
more info: python-on-a-chip
vm/seq.h@15:94ca5c8003e5, 2016-04-14 (annotated)
- Committer:
- va009039
- Date:
- Thu Apr 14 22:32:57 2016 +0000
- Revision:
- 15:94ca5c8003e5
- Parent:
- 0:65f1469d6bfb
update Nucleo-F401RE.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:65f1469d6bfb | 1 | /* |
va009039 | 0:65f1469d6bfb | 2 | # This file is Copyright 2006 Dean Hall. |
va009039 | 0:65f1469d6bfb | 3 | # This file is part of the PyMite VM. |
va009039 | 0:65f1469d6bfb | 4 | # This file is licensed under the MIT License. |
va009039 | 0:65f1469d6bfb | 5 | # See the LICENSE file for details. |
va009039 | 0:65f1469d6bfb | 6 | */ |
va009039 | 0:65f1469d6bfb | 7 | |
va009039 | 0:65f1469d6bfb | 8 | |
va009039 | 0:65f1469d6bfb | 9 | #ifndef __SEQ_H__ |
va009039 | 0:65f1469d6bfb | 10 | #define __SEQ_H__ |
va009039 | 0:65f1469d6bfb | 11 | |
va009039 | 0:65f1469d6bfb | 12 | |
va009039 | 0:65f1469d6bfb | 13 | /** |
va009039 | 0:65f1469d6bfb | 14 | * \file |
va009039 | 0:65f1469d6bfb | 15 | * \brief Sequence Header |
va009039 | 0:65f1469d6bfb | 16 | */ |
va009039 | 0:65f1469d6bfb | 17 | |
va009039 | 0:65f1469d6bfb | 18 | |
va009039 | 0:65f1469d6bfb | 19 | /** |
va009039 | 0:65f1469d6bfb | 20 | * Sequence Iterator Object |
va009039 | 0:65f1469d6bfb | 21 | * |
va009039 | 0:65f1469d6bfb | 22 | * Instances of this object are created by GET_ITER and used by FOR_ITER. |
va009039 | 0:65f1469d6bfb | 23 | * Stores a pointer to a sequence and an index int16_t. |
va009039 | 0:65f1469d6bfb | 24 | */ |
va009039 | 0:65f1469d6bfb | 25 | typedef struct PmSeqIter_s |
va009039 | 0:65f1469d6bfb | 26 | { |
va009039 | 0:65f1469d6bfb | 27 | /** Object descriptor */ |
va009039 | 0:65f1469d6bfb | 28 | PmObjDesc_t od; |
va009039 | 0:65f1469d6bfb | 29 | |
va009039 | 0:65f1469d6bfb | 30 | /** Sequence object */ |
va009039 | 0:65f1469d6bfb | 31 | pPmObj_t si_sequence; |
va009039 | 0:65f1469d6bfb | 32 | |
va009039 | 0:65f1469d6bfb | 33 | /** Index value */ |
va009039 | 0:65f1469d6bfb | 34 | int16_t si_index; |
va009039 | 0:65f1469d6bfb | 35 | } PmSeqIter_t, |
va009039 | 0:65f1469d6bfb | 36 | *pPmSeqIter_t; |
va009039 | 0:65f1469d6bfb | 37 | |
va009039 | 0:65f1469d6bfb | 38 | |
va009039 | 0:65f1469d6bfb | 39 | /** |
va009039 | 0:65f1469d6bfb | 40 | * Compares two sequences for equality |
va009039 | 0:65f1469d6bfb | 41 | * |
va009039 | 0:65f1469d6bfb | 42 | * @param pobj1 Ptr to first sequence. |
va009039 | 0:65f1469d6bfb | 43 | * @param pobj2 Ptr to second sequence. |
va009039 | 0:65f1469d6bfb | 44 | * @return C_SAME if the seuqences are equivalent, C_DIFFER otherwise. |
va009039 | 0:65f1469d6bfb | 45 | */ |
va009039 | 0:65f1469d6bfb | 46 | int8_t seq_compare(pPmObj_t pobj1, pPmObj_t pobj2); |
va009039 | 0:65f1469d6bfb | 47 | |
va009039 | 0:65f1469d6bfb | 48 | /** |
va009039 | 0:65f1469d6bfb | 49 | * Returns the length of the sequence |
va009039 | 0:65f1469d6bfb | 50 | * |
va009039 | 0:65f1469d6bfb | 51 | * @param pobj Ptr to sequence. |
va009039 | 0:65f1469d6bfb | 52 | * @param r_index Return arg, length of sequence |
va009039 | 0:65f1469d6bfb | 53 | * @return Return status |
va009039 | 0:65f1469d6bfb | 54 | */ |
va009039 | 0:65f1469d6bfb | 55 | PmReturn_t seq_getLength(pPmObj_t pobj, uint16_t *r_index); |
va009039 | 0:65f1469d6bfb | 56 | |
va009039 | 0:65f1469d6bfb | 57 | /** |
va009039 | 0:65f1469d6bfb | 58 | * Returns the object from sequence[index] |
va009039 | 0:65f1469d6bfb | 59 | * |
va009039 | 0:65f1469d6bfb | 60 | * @param pobj Ptr to sequence object to get object from |
va009039 | 0:65f1469d6bfb | 61 | * @param index Int index into the sequence |
va009039 | 0:65f1469d6bfb | 62 | * @param r_pobj Return arg, object from sequence |
va009039 | 0:65f1469d6bfb | 63 | * @return Return status |
va009039 | 0:65f1469d6bfb | 64 | */ |
va009039 | 0:65f1469d6bfb | 65 | PmReturn_t seq_getSubscript(pPmObj_t pobj, int16_t index, pPmObj_t *r_pobj); |
va009039 | 0:65f1469d6bfb | 66 | |
va009039 | 0:65f1469d6bfb | 67 | /** |
va009039 | 0:65f1469d6bfb | 68 | * Returns the next item from the sequence iterator object |
va009039 | 0:65f1469d6bfb | 69 | * |
va009039 | 0:65f1469d6bfb | 70 | * @param pobj Ptr to sequence iterator. |
va009039 | 0:65f1469d6bfb | 71 | * @param r_pitem Return arg, pointer to next item from sequence. |
va009039 | 0:65f1469d6bfb | 72 | * @return Return status. |
va009039 | 0:65f1469d6bfb | 73 | */ |
va009039 | 0:65f1469d6bfb | 74 | PmReturn_t seqiter_getNext(pPmObj_t pobj, pPmObj_t *r_pitem); |
va009039 | 0:65f1469d6bfb | 75 | |
va009039 | 0:65f1469d6bfb | 76 | |
va009039 | 0:65f1469d6bfb | 77 | /** |
va009039 | 0:65f1469d6bfb | 78 | * Returns a new sequence iterator object |
va009039 | 0:65f1469d6bfb | 79 | * |
va009039 | 0:65f1469d6bfb | 80 | * @param pobj Ptr to sequence. |
va009039 | 0:65f1469d6bfb | 81 | * @param r_pobj Return by reference, new sequence iterator |
va009039 | 0:65f1469d6bfb | 82 | * @return Return status. |
va009039 | 0:65f1469d6bfb | 83 | */ |
va009039 | 0:65f1469d6bfb | 84 | PmReturn_t seqiter_new(pPmObj_t pobj, pPmObj_t *r_pobj); |
va009039 | 0:65f1469d6bfb | 85 | |
va009039 | 0:65f1469d6bfb | 86 | #endif /* __SEQ_H__ */ |