Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / flight / libraries / PyMite / vm / seq.h
blob79a29577ebb0f38decc73d4edada73eae43dcb81
1 /*
2 # This file is Copyright 2006, 2007, 2009, 2010 Dean Hall.
4 # This file is part of the PyMite VM.
5 # The PyMite VM is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU GENERAL PUBLIC LICENSE Version 2.
8 # The PyMite VM is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # A copy of the GNU GENERAL PUBLIC LICENSE Version 2
12 # is seen in the file COPYING in this directory.
16 #ifndef __SEQ_H__
17 #define __SEQ_H__
20 /**
21 * \file
22 * \brief Sequence Header
26 /**
27 * Sequence Iterator Object
29 * Instances of this object are created by GET_ITER and used by FOR_ITER.
30 * Stores a pointer to a sequence and an index int16_t.
32 typedef struct PmSeqIter_s
34 /** Object descriptor */
35 PmObjDesc_t od;
37 /** Sequence object */
38 pPmObj_t si_sequence;
40 /** Index value */
41 int16_t si_index;
42 } PmSeqIter_t,
43 *pPmSeqIter_t;
46 /**
47 * Compares two sequences for equality
49 * @param pobj1 Ptr to first sequence.
50 * @param pobj2 Ptr to second sequence.
51 * @return C_SAME if the seuqences are equivalent, C_DIFFER otherwise.
53 int8_t seq_compare(pPmObj_t pobj1, pPmObj_t pobj2);
55 /**
56 * Returns the length of the sequence
58 * @param pobj Ptr to sequence.
59 * @param r_index Return arg, length of sequence
60 * @return Return status
62 PmReturn_t seq_getLength(pPmObj_t pobj, int16_t *r_index);
64 /**
65 * Returns the object from sequence[index]
67 * @param pobj Ptr to sequence object to get object from
68 * @param index Int index into the sequence
69 * @param r_pobj Return arg, object from sequence
70 * @return Return status
72 PmReturn_t seq_getSubscript(pPmObj_t pobj, int16_t index, pPmObj_t *r_pobj);
74 /**
75 * Returns the next item from the sequence iterator object
77 * @param pobj Ptr to sequence iterator.
78 * @param r_pitem Return arg, pointer to next item from sequence.
79 * @return Return status.
81 PmReturn_t seqiter_getNext(pPmObj_t pobj, pPmObj_t *r_pitem);
84 /**
85 * Returns a new sequence iterator object
87 * @param pobj Ptr to sequence.
88 * @param r_pobj Return by reference, new sequence iterator
89 * @return Return status.
91 PmReturn_t seqiter_new(pPmObj_t pobj, pPmObj_t *r_pobj);
93 #endif /* __SEQ_H__ */