update credits
[librepilot.git] / flight / libraries / PyMite / vm / bytearray.h
blob8bf2faeb34b15f8bc150fbaa6dd020bc95480689
1 /*
2 # This file is Copyright 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 __BYTEARRAY_H__
17 #define __BYTEARRAY_H__
19 /**
20 * \file
21 * \brief Bytearray Object Type
23 * Bytearray object type header.
27 /**
28 * Bytes container
30 * Holds actual byte payload
32 typedef struct PmBytes_s
34 /** Object descriptor */
35 PmObjDesc_t od;
37 /** Physical number of bytes in the C array (below) */
38 int16_t length;
40 /** C array of bytes */
41 uint8_t val[1];
42 } PmBytes_t,
43 *pPmBytes_t;
46 /**
47 * Bytearray obj
49 * Mutable ordered sequence of bytes. Contains ptr to chunk of bytes.
51 typedef struct PmBytearray_s
53 /** Object descriptor */
54 PmObjDesc_t od;
56 /** Bytearray length; logical number of bytes */
57 int16_t length;
59 /** Ptr to bytes container (may hold more bytes than length) */
60 pPmBytes_t val;
61 } PmBytearray_t,
62 *pPmBytearray_t;
65 PmReturn_t bytearray_new(pPmObj_t pobj, pPmObj_t *r_pobj);
66 PmReturn_t bytearray_getItem(pPmObj_t pobj, int16_t index, pPmObj_t *r_pobj);
67 PmReturn_t bytearray_setItem(pPmObj_t pba, int16_t index, pPmObj_t pobj);
68 PmReturn_t bytearray_print(pPmObj_t pobj);
70 #endif /* __BYTEARRAY_H__ */