Embed:
(wiki syntax)
Show/hide line numbers
bytearray.h
Go to the documentation of this file.
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 00019 /** 00020 * \file 00021 * \brief Bytearray Object Type 00022 * 00023 * Bytearray object type header. 00024 */ 00025 00026 00027 /** 00028 * Bytes container 00029 * 00030 * Holds actual byte payload 00031 */ 00032 typedef struct PmBytes_s 00033 { 00034 /** Object descriptor */ 00035 PmObjDesc_t od; 00036 00037 /** Physical number of bytes in the C array (below) */ 00038 int16_t length; 00039 00040 /** C array of bytes */ 00041 uint8_t val[1]; 00042 } PmBytes_t, 00043 *pPmBytes_t; 00044 00045 00046 /** 00047 * Bytearray obj 00048 * 00049 * Mutable ordered sequence of bytes. Contains ptr to chunk of bytes. 00050 */ 00051 typedef struct PmBytearray_s 00052 { 00053 /** Object descriptor */ 00054 PmObjDesc_t od; 00055 00056 /** Bytearray length; logical number of bytes */ 00057 int16_t length; 00058 00059 /** Ptr to bytes container (may hold more bytes than length) */ 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__ */
Generated on Tue Jul 12 2022 17:07:01 by
1.7.2