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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gui_array.c

?? UC_GUI開發源代碼,里面含有范例,源文件
?? C
字號:
/*
*********************************************************************************************************
*                                             uC/GUI V3.98
*                        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 */
	 	 			 		    	 				 	  			   	 	 	 	 	 	  	  	      	   		 	 	 		  		  	 		 	  	  			     			       	   	 			  		    	 	     	 				  	 					 	 			   	  	  			 				 		 	 	 			     			 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级理论片| 久久在线观看免费| 26uuu精品一区二区在线观看| 国产精品拍天天在线| 精品一区二区三区免费毛片爱 | 色综合久久中文综合久久97 | 欧美精品一区二区精品网| 免费成人在线网站| 欧美成人伊人久久综合网| 美腿丝袜在线亚洲一区| 久久综合国产精品| jlzzjlzz欧美大全| 一区二区不卡在线播放 | 亚洲一区二区免费视频| 欧美视频日韩视频| 久久av资源站| 亚洲天堂av一区| 欧美一区2区视频在线观看| 国产成人午夜高潮毛片| 亚洲欧美国产高清| 欧美丰满少妇xxxxx高潮对白| 午夜欧美大尺度福利影院在线看| 欧美一级日韩一级| 成人免费视频国产在线观看| 亚洲乱码精品一二三四区日韩在线 | 偷拍亚洲欧洲综合| 日韩欧美高清dvd碟片| 国产精品亚洲视频| 亚洲综合清纯丝袜自拍| 久久亚洲一级片| 欧美日韩另类一区| 99精品欧美一区| 国产在线精品一区二区三区不卡| 亚洲一区二区三区视频在线 | 亚洲视频免费观看| 日韩无一区二区| 91丨九色丨黑人外教| 狠狠久久亚洲欧美| 亚洲成人在线网站| 国产精品久久久久久福利一牛影视| 国产在线精品视频| 亚洲成人动漫一区| 久久亚洲精品小早川怜子| 91久久精品一区二区三| 国产成人免费9x9x人网站视频| 视频一区二区三区在线| 一区二区三区四区五区视频在线观看| 久久午夜羞羞影院免费观看| 欧美精品日日鲁夜夜添| 91麻豆免费观看| 成人黄色软件下载| 国产成人aaa| 国产乱色国产精品免费视频| 麻豆国产欧美日韩综合精品二区| 偷拍自拍另类欧美| 亚洲第一会所有码转帖| 亚洲成人动漫av| 亚洲一区自拍偷拍| 日韩亚洲欧美在线| 国产精品一区二区在线看| 天使萌一区二区三区免费观看| 一区二区高清视频在线观看| 国产精品色眯眯| 国产精品久久久爽爽爽麻豆色哟哟 | 欧洲日韩一区二区三区| av一区二区三区在线| 岛国av在线一区| 成人99免费视频| 91色|porny| 欧美无砖专区一中文字| 色婷婷国产精品久久包臀| 成人精品高清在线| 99国产精品久| 91在线码无精品| 欧美羞羞免费网站| 欧美久久久久免费| 欧美一区二区久久久| wwwwxxxxx欧美| 欧美tickle裸体挠脚心vk| 日韩一区二区三区在线观看| 精品欧美一区二区在线观看| 欧美成人福利视频| 日本一区二区三区免费乱视频| 国产欧美日产一区| **欧美大码日韩| 日日噜噜夜夜狠狠视频欧美人| 免费成人在线影院| 国产盗摄女厕一区二区三区| 91视频91自| 精品国一区二区三区| 日韩毛片视频在线看| 日产国产欧美视频一区精品| 国模一区二区三区白浆| 91在线观看美女| 日韩精品一区二区三区中文不卡| 中文字幕欧美三区| 午夜久久福利影院| 国产精品中文字幕日韩精品 | 日韩一区二区视频| 国产精品美女一区二区三区| 亚洲国产精品精华液网站| 久久电影网电视剧免费观看| 91影视在线播放| 精品理论电影在线| 亚洲国产sm捆绑调教视频| 国产盗摄一区二区| 在线播放91灌醉迷j高跟美女 | 午夜伦欧美伦电影理论片| 成人午夜免费av| 91精品国产乱| 一区二区三区四区亚洲| 国产福利一区在线观看| 4438x成人网最大色成网站| 亚洲欧洲日韩在线| 国产精品小仙女| 精品少妇一区二区三区在线播放 | 国产一区二区精品久久| 91精品国产综合久久香蕉麻豆 | 黑人巨大精品欧美黑白配亚洲| 欧美午夜片在线看| 亚洲你懂的在线视频| 国产激情91久久精品导航| 日韩欧美高清dvd碟片| 香港成人在线视频| 在线观看视频欧美| 亚洲激情校园春色| 色8久久精品久久久久久蜜| 中文字幕精品三区| 东方aⅴ免费观看久久av| 精品免费视频.| 捆绑调教美女网站视频一区| 欧美二区在线观看| 日韩成人伦理电影在线观看| 欧美日韩一区二区不卡| 亚洲国产综合在线| 欧美日韩dvd在线观看| 亚洲自拍偷拍av| 欧美精品一卡两卡| 日韩精品一二区| 91精品久久久久久蜜臀| 日本午夜精品一区二区三区电影| 欧美高清视频一二三区 | 精品欧美乱码久久久久久| 久久国产福利国产秒拍| 精品国产一区二区亚洲人成毛片| 久久精品国产亚洲高清剧情介绍| 日韩精品专区在线影院重磅| 久久精品国产免费看久久精品| 91.com在线观看| 国产精品一区久久久久| 国产精品久久久久9999吃药| 成人h动漫精品一区二区| 国产精品美女久久福利网站| 播五月开心婷婷综合| 亚洲男帅同性gay1069| 欧美日韩亚洲丝袜制服| 裸体歌舞表演一区二区| 国产亚洲污的网站| 色婷婷av一区| 欧美aaaaaa午夜精品| 久久久精品蜜桃| 色狠狠色狠狠综合| 蜜桃久久精品一区二区| 国产精品视频看| 欧美日韩激情一区二区| 狠狠色丁香婷综合久久| 亚洲精品国产视频| 欧美电影免费观看高清完整版在线观看 | 国产精品妹子av| 色婷婷精品久久二区二区蜜臂av| 日本午夜一区二区| 国产精品久久久久久亚洲伦| 欧美在线|欧美| 极品少妇xxxx精品少妇偷拍| 亚洲视频中文字幕| 日韩一区二区在线播放| 91亚洲午夜精品久久久久久| 日韩成人一级大片| 日韩一区在线看| 精品国内二区三区| 欧美性猛交xxxx乱大交退制版| 国产麻豆精品视频| 亚洲第一成年网| 国产精品国产三级国产普通话三级 | 亚洲777理论| 亚洲欧洲精品天堂一级| 欧美一级夜夜爽| 欧美视频完全免费看| 成人在线视频一区| 六月丁香婷婷久久| 午夜天堂影视香蕉久久| 亚洲人成网站影音先锋播放| www激情久久| 欧美一区二区三区视频| 欧美亚洲自拍偷拍| 91小视频在线免费看| 国产a级毛片一区| 国内不卡的二区三区中文字幕 | 一区二区三区四区av| 中文字幕av不卡|