00001 /* 00002 # This file is Copyright 2010 Dean Hall. 00003 # 00004 # This file is part of the PyMite VM. 00005 # The PyMite VM is free software: you can redistribute it and/or modify 00006 # it under the terms of the GNU GENERAL PUBLIC LICENSE Version 2. 00007 # 00008 # The PyMite VM is distributed in the hope that it will be useful, 00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00011 # A copy of the GNU GENERAL PUBLIC LICENSE Version 2 00012 # is seen in the file COPYING in this directory. 00013 */ 00014 00015 00016 #ifndef __BYTEARRAY_H__ 00017 #define __BYTEARRAY_H__ 00018 00032 typedef struct PmBytes_s 00033 { 00035 PmObjDesc_t od; 00036 00038 int16_t length; 00039 00041 uint8_t val[1]; 00042 } PmBytes_t, 00043 *pPmBytes_t; 00044 00045 00051 typedef struct PmBytearray_s 00052 { 00054 PmObjDesc_t od; 00055 00057 int16_t length; 00058 00060 pPmBytes_t val; 00061 } PmBytearray_t, 00062 *pPmBytearray_t; 00063 00064 00065 PmReturn_t bytearray_new(pPmObj_t pobj, pPmObj_t *r_pobj); 00066 PmReturn_t bytearray_getItem(pPmObj_t pobj, int16_t index, pPmObj_t *r_pobj); 00067 PmReturn_t bytearray_setItem(pPmObj_t pba, int16_t index, pPmObj_t pobj); 00068 PmReturn_t bytearray_print(pPmObj_t pobj); 00069 00070 #endif /* __BYTEARRAY_H__ */