亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? gui_array.c

?? ucCos移植到廣州友善nano2410
?? C
字號:
/*
*********************************************************************************************************
*                                                uC/GUI
*                        Universal graphic software for embedded applications
*
*                       (c) Copyright 2002, Micrium Inc., Weston, FL
*                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
*
*              礐/GUI is protected by international copyright laws. Knowledge of the
*              source code may not be used to write a similar product. This file may
*              only be used in accordance with a license and should not be redistributed
*              in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File        : GUI_ARRAY.c
Purpose     : Array handling routines
---------------------------END-OF-HEADER------------------------------
*/

#include "GUI_ARRAY.h"
#include <string.h>

#if GUI_WINSUPPORT

/*********************************************************************
*
*       public code
*
**********************************************************************
*/
/*********************************************************************
*
*       GUI_ARRAY_GetNumItems
*/
unsigned int GUI_ARRAY_GetNumItems(const GUI_ARRAY* pThis) {
  GUI_ARRAY_CHECK(pThis);    /* Sanity checks at higher debug levels only */

  return pThis->NumItems;
}

/*********************************************************************
*
*       GUI_ARRAY_AddItem
*
* Purpose:
*   Add an item to a GUI_ARRAY.
*   If the SIze is > 0, a memory block is allocated for storage.
*   If on top of this a pointer is specified, the memory block holding
*   the copy of the item is initialized.
*
* Return value:
*   If O.K. : 0
*   On error: 1
*   
*/
int GUI_ARRAY_AddItem(GUI_ARRAY* pThis, const void *pNew, int Len) {
  WM_HMEM hNewItem = 0;
  WM_HMEM hNewBuffer;
  WM_HMEM *pNewBuffer;
  int r = 0;

  GUI_ARRAY_CHECK(pThis);    /* Sanity checks at higher debug levels only */

  WM_LOCK();
  /* Alloc memory for new item */
  if (Len) {
    if ((hNewItem = GUI_ALLOC_AllocInit(pNew, Len)) == 0) {
      GUI_DEBUG_ERROROUT("GUI_ARRAY_AddItem failed to alloc buffer");
      r = 1;            /* Error */
    }
  }
  /* Put handle of new item into the array */
  if (r == 0) {
    int NumItems;
    NumItems = pThis->NumItems;
    /* Add the handle to new item to the buffer */
    hNewBuffer = GUI_ALLOC_Realloc(pThis->haHandle, (NumItems + 1) * sizeof(WM_HMEM));
    if (hNewBuffer == 0) {
      GUI_DEBUG_ERROROUT("GUI_ARRAY_AddItem failed to alloc buffer");
      GUI_ALLOC_Free(hNewItem);
      r = 1;            /* Error */
    } else {
      pNewBuffer = (WM_HMEM*) GUI_ALLOC_h2p(hNewBuffer);
      *(pNewBuffer + NumItems) = hNewItem;
      pThis->haHandle = hNewBuffer;
      pThis->NumItems++;
    }
  }
  WM_UNLOCK();
  return r;
}

/*********************************************************************
*
*       GUI_ARRAY_Delete
*
* Purpose:
*  Free all allocated memory blocks
*
* Add. info:
*   Locking is not required, since this routine is considered internal
*   and should only be called after locking.
*/
void GUI_ARRAY_Delete(GUI_ARRAY* pThis) {
  int i;
  WM_HMEM ha;
  WM_HMEM* pa;

  GUI_ARRAY_CHECK(pThis);    /* Sanity checks at higher debug levels only */

  ha = pThis->haHandle;
  if (ha) {
    pa = (WM_HMEM*) GUI_ALLOC_h2p(ha);
    /* Free the attached items, one at a time */
    for (i = 0; i < pThis->NumItems; i++) {
      GUI_ALLOC_FreePtr(pa+i);
    }
    /* Free the handle buffer */
    GUI_ALLOC_FreePtr(&pThis->haHandle);
    pThis->NumItems = 0;                    /* For safety, in case the array is used after it has been deleted */
  }
  #if GUI_DEBUG_LEVEL >= GUI_DEBUG_LEVEL_CHECK_ALL
    pThis->InitState = GUI_ARRAY_STATE_DELETED;
  #endif
}

/*********************************************************************
*
*       GUI_ARRAY_SethItem
*
* Purpose:
*   Sets an item.
*
* Returns:
*   1: if operation has failed
*   0: OK
*
* Notes:
*   (1) Replacing Items
*       If the item is already assigned
*       (Which means the handle is already != 0), it is freeed. However,
*       the handle is treated as a handle to a data item, not an object.
*       This means the data item is freed, but if the pointer points to
*       an object, the destructor of the object is not called.
*/
int GUI_ARRAY_SethItem(GUI_ARRAY* pThis, unsigned int Index, WM_HMEM hItem) {
  WM_HMEM ha;
  WM_HMEM* pa;
  int r = 1;

  GUI_ARRAY_CHECK(pThis);    /* Sanity checks at higher debug levels only */

  if (Index < (unsigned)pThis->NumItems) {
    ha = pThis->haHandle;
    if (ha) {
      pa = (WM_HMEM*) GUI_ALLOC_h2p(ha);
      pa += Index;
      GUI_ALLOC_FreePtr(pa);
      *pa = hItem;
      r = 0;
    }
  }
  return r;
}

/*********************************************************************
*
*       GUI_ARRAY_SetItem
*
* Purpose:
*   Sets an item, returning the handle.
*   If a data pointer is given, the allocated memory is initialized from it thru memcpy.
*
* Returns:
*   Handle of the allocated memory block
*   
* Notes:
*   (1) Replacing Items
*       If the item is already assigned
*       (Which means the handle is already != 0), it is freeed. However,
*       the handle is treated as a handle to a data item, not an object.
*       This means the data item is freed, but if the pointer points to
*       an object, the destructor of the object is not called.
*/
WM_HMEM  GUI_ARRAY_SetItem(GUI_ARRAY* pThis, unsigned int Index, const void* pData, int Len) {
  WM_HMEM hItem = 0;

  GUI_ARRAY_CHECK(pThis);    /* Sanity checks at higher debug levels only */

  if (Index < (unsigned)pThis->NumItems) {
    WM_HMEM ha;
    ha = pThis->haHandle;
    if (ha) {
      WM_HMEM* pa;
      pa = (WM_HMEM*) GUI_ALLOC_h2p(ha);
      pa += Index;
      hItem = *pa;
      /*
       * If a buffer is already available, a new buffer is only needed when the
       * new item has a different size.
       */
      if (hItem) {
        if (GUI_ALLOC_GetSize(hItem) != Len) {
          hItem = 0;
        }
      }
      /*
       * Allocate a new buffer and free the old one (if needed). 
       */
      if (!hItem) {
        hItem = GUI_ALLOC_AllocZero(Len);
        if (hItem) {
          GUI_ALLOC_FreePtr(pa);
          *pa = hItem;
        }
      }
      /*
       * Set the item (if needed)
       */
      if (pData && hItem) {
        char* pItem = (char*) GUI_ALLOC_h2p(hItem);
        memcpy(pItem, pData, Len);
      }
    }
  }
  return hItem;
}

/*********************************************************************
*
*       GUI_ARRAY_GethItem
*
* Purpose:
*   Gets the handle of specified item
*
* Notes:
*   (1) Index out of bounds
*   It is permitted to specify an index larger than the
*   array size. In this case, a 0-handle is returned.
*/
WM_HMEM GUI_ARRAY_GethItem(const GUI_ARRAY* pThis, unsigned int Index) {
  WM_HMEM h = 0;

  GUI_ARRAY_CHECK(pThis);    /* Sanity checks at higher debug levels only */

  if (Index < (unsigned)pThis->NumItems) {
    WM_HMEM  ha;
    WM_HMEM* pa;
    ha = pThis->haHandle;
    if (ha) {
      pa = (WM_HMEM*) GUI_ALLOC_h2p(ha);
      h = *(pa + Index);
    }
  }
  return h;
}

/*********************************************************************
*
*       GUI_ARRAY_GetpItem
*
* Purpose:
*   Gets the pointer of specified item
*
* Notes:
*   (1) Index out of bounds
*       It is permitted to specify an index larger than the
*       array size. In this case, a 0-handle is returned.
*   (2) Locking
*       It is the caller's responsibility to lock before calling this
*       function.
*/
void* GUI_ARRAY_GetpItem(const GUI_ARRAY* pThis, unsigned int Index) {
  void* p = NULL;
  WM_HMEM h;

  GUI_ARRAY_CHECK(pThis);    /* Sanity checks at higher debug levels only */

  h = GUI_ARRAY_GethItem(pThis, Index);
  if (h) {
    p = WM_H2P(h);
  }
  return p;
}

/*********************************************************************
*
*       Debug support
*
**********************************************************************
*
* Purpose:
*   The routines below are required only at higher debug levels
*/

#if GUI_DEBUG_LEVEL >= GUI_DEBUG_LEVEL_CHECK_ALL

/*********************************************************************
*
*       GUI_ARRAY_Create
*
* Purpose:
*/
void GUI_ARRAY_Create(GUI_ARRAY * pThis) {
  GUI_DEBUG_ERROROUT_IF(pThis->InitState != GUI_ARRAY_STATE_NOT_CREATED, "GUI_ARRAY_Create: GUI_ARRAY not initialized to 0");
  pThis->InitState = GUI_ARRAY_STATE_CREATED;
}


/*********************************************************************
*
*       GUI_ARRAY_Check
*
* Purpose:
*/
void GUI_ARRAY_Check(const GUI_ARRAY * pThis) {
  if (pThis->InitState == GUI_ARRAY_STATE_DELETED) {
    GUI_DEBUG_ERROROUT("GUI_ARRAY_Check: GUI_ARRAY has been deleted");
  } else if (pThis->InitState == GUI_ARRAY_STATE_NOT_CREATED) {
    GUI_DEBUG_ERROROUT("GUI_ARRAY_Check: GUI_ARRAY has not been created");
  } else if (pThis->InitState != GUI_ARRAY_STATE_CREATED) {
    GUI_DEBUG_ERROROUT("GUI_ARRAY_Check: GUI_ARRAY in unknown state");
  }
}

#endif /* GUI_DEBUG_LEVEL >= GUI_DEBUG_LEVEL_CHECK_ALL */


#else  /* avoid empty object files */

void GUI_ARRAY_C(void);
void GUI_ARRAY_C(void){}

#endif /* GUI_WINSUPPORT */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人福利视频在线看| 久久综合九色综合97婷婷 | 亚洲精品在线网站| 奇米色一区二区三区四区| 欧美日韩成人综合在线一区二区| 国产福利一区二区三区在线视频| 国产视频视频一区| 成人h动漫精品一区二| 一区二区三区在线影院| 欧美精选一区二区| 韩国三级中文字幕hd久久精品| 26uuu亚洲| 99久久久免费精品国产一区二区| 亚洲精品中文字幕在线观看| 欧美军同video69gay| 国产在线播精品第三| 精品国产a毛片| 91在线高清观看| 视频在线观看一区| 国产日韩精品一区二区浪潮av| 99精品偷自拍| 日本视频中文字幕一区二区三区| 久久久www成人免费无遮挡大片| 91在线国内视频| 美女一区二区久久| 国产精品久久久久久久第一福利| 欧美日韩激情一区二区三区| 韩日av一区二区| 一个色综合av| 欧美tk—视频vk| 91片黄在线观看| 久久99热狠狠色一区二区| 亚洲男人天堂av网| 欧美成人一区二区三区| 色综合久久久久综合| 免费观看成人鲁鲁鲁鲁鲁视频| 成人免费一区二区三区视频 | 成人午夜视频在线观看| 精品国产污污免费网站入口 | 成人v精品蜜桃久久一区| 日韩国产欧美在线视频| 1000精品久久久久久久久| 欧美成人官网二区| 欧美视频一区二| 成人午夜精品在线| 婷婷综合久久一区二区三区| 日韩毛片一二三区| 久久久.com| 日韩精品中文字幕一区二区三区 | 欧美一区二区三区成人| 成人精品国产免费网站| 国模无码大尺度一区二区三区| 亚洲午夜免费视频| 亚洲四区在线观看| 中文字幕成人在线观看| 久久免费看少妇高潮| 欧美一区二区三区四区视频| 色综合久久88色综合天天 | 在线视频一区二区免费| 成人永久免费视频| 韩国毛片一区二区三区| 午夜精品久久久久| 一区二区三区免费看视频| 一区视频在线播放| 国产精品丝袜在线| 亚洲专区一二三| 99re在线视频这里只有精品| 成人性生交大片免费看中文网站| 韩国一区二区三区| 久久草av在线| 日本vs亚洲vs韩国一区三区| 亚洲第一久久影院| 亚洲成在线观看| 午夜日韩在线电影| 五月婷婷色综合| 日韩精品午夜视频| 蜜桃精品视频在线观看| 青草av.久久免费一区| 日本在线不卡视频| 日本女人一区二区三区| 另类专区欧美蜜桃臀第一页| 蜜桃av一区二区在线观看| 午夜国产精品一区| 日本欧美大码aⅴ在线播放| 免费人成黄页网站在线一区二区| 日韩高清不卡一区二区| 天天影视色香欲综合网老头| 日韩国产欧美三级| 精品亚洲欧美一区| 久久 天天综合| 狠狠色狠狠色综合日日91app| 国产美女久久久久| 波多野结衣欧美| 欧洲一区二区三区在线| 欧美日本在线看| 日韩一区二区三区观看| 久久免费国产精品| 一区二区中文字幕在线| 亚洲.国产.中文慕字在线| 男男视频亚洲欧美| 国产综合一区二区| 99久久婷婷国产综合精品电影| 91极品美女在线| 欧美色涩在线第一页| 欧美精品一区二区三区蜜桃| 色综合色综合色综合色综合色综合 | 日韩成人伦理电影在线观看| 精品一区二区三区免费视频| 成人a免费在线看| 91色porny| 欧美日韩国产综合一区二区三区| 日韩免费观看高清完整版| 欧美极品xxx| 一区二区三区在线视频免费| 免费不卡在线观看| 91亚洲精品乱码久久久久久蜜桃| 欧美日韩国产小视频| 久久久久免费观看| 亚洲国产一区二区在线播放| 国产一区二区精品久久99| 99久久国产综合精品麻豆| 欧美丰满嫩嫩电影| 国产精品入口麻豆原神| 日韩精品五月天| 99视频在线精品| 日韩一区二区电影网| 亚洲视频一区在线| 韩国成人精品a∨在线观看| 在线观看视频一区| 久久久99精品久久| 久久精品国产精品青草| 在线亚洲免费视频| 国产精品国产三级国产a| 蜜桃一区二区三区四区| 91女神在线视频| 久久久久久久久久久黄色| 日韩极品在线观看| 99视频在线精品| 国产日韩高清在线| 久久精品国产在热久久| 欧美性受xxxx| 日韩制服丝袜先锋影音| 亚洲视频免费看| 粉嫩一区二区三区性色av| 8x8x8国产精品| 亚洲资源在线观看| 色婷婷激情久久| 国产精品区一区二区三区| 紧缚奴在线一区二区三区| 欧美高清视频在线高清观看mv色露露十八 | 欧美国产视频在线| 国产一区二区三区四区五区美女 | 风间由美性色一区二区三区| 欧美mv和日韩mv国产网站| 亚洲成在人线免费| 在线观看区一区二| 一区二区三区日韩在线观看| 91丨porny丨在线| 国产精品青草久久| www.色精品| 中文成人综合网| www.99精品| 欧美高清一级片在线观看| 国产精品夜夜嗨| 久久夜色精品一区| 国产毛片精品国产一区二区三区| 欧美va亚洲va在线观看蝴蝶网| 欧美96一区二区免费视频| 91精品国产色综合久久| 麻豆免费精品视频| 欧美mv日韩mv| 成人视屏免费看| 国产精品久久久久久妇女6080| 国产不卡视频在线观看| 亚洲国产精品成人综合色在线婷婷| 国产成人激情av| 亚洲三级在线观看| 色一情一乱一乱一91av| 久久精品国产澳门| 国产成人丝袜美腿| 国产欧美一区在线| 成人午夜免费视频| 亚洲国产视频在线| 日韩欧美国产一区二区在线播放| 精品一区二区三区免费毛片爱| 国产午夜精品在线观看| 97久久久精品综合88久久| 亚洲综合丝袜美腿| 日韩欧美色电影| 成人性视频免费网站| 亚洲综合色成人| 欧美成人一区二区三区片免费| 国产成人精品三级麻豆| 亚洲天堂成人在线观看| 在线一区二区三区四区五区| 日本亚洲视频在线| 国产精品天天摸av网| 欧美日韩精品一区视频| 国产一区二区三区美女| 亚洲精品免费视频|