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

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

?? rnglib.c

?? vxworks的完整的源代碼
?? C
字號:
/* rngLib.c - ring buffer subroutine library *//* Copyright 1984-1995 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01x,13feb95,jdi  doc tweaks.01w,20jan93,jdi  documentation cleanup for 5.1.01v,26may92,rrr  the tree shuffle01u,11jan92,wmd  fix bug spr #1210, race condition based on updates of buf		 pointers in more than 1 place in rngBufPut() and rngBufGet().01t,13dec91,gae  ANSI cleanup.01s,04oct91,rrr  passed through the ansification filter                  -changed functions to ansi style		  -changed VOID to void		  -changed copyright notice01r,05apr91,jdi	 documentation -- removed header parens and x-ref numbers;		 doc review by dnw.01q,11mar91,jaa	 documentation cleanup.01p,11may90,yao  added missing modification history (01o) for the last checkin.01o,09may90,yao  typecasted malloc to (char *).01n,22mar89,dab  changed shorts to ints in rngBufGet, rngBufPut.01m,03feb89,dab  added rngDelete to delete a ring buffer.01l,20aug88,gae  documentation.01k,07jul88,jcf  fixed malloc to match new declaration.01j,30may88,dnw  changed to v4 names.01i,03nov87,ecs  documentation.01h,20oct87,gae  documentation.01g,23mar87,jlf  documentation.01f,21dec86,dnw  changed to not get include files from default directories.01e,14apr86,rdc  changed memAllocates to mallocs.01d,20jul85,jlf  documentation.01c,09sep84,jlf  added comments and copyright.01b,15aug84,dnw  changed rngBufCreate to allocate ring buffer one byte larger		   than requested, because ring buffer algorithm always leaves		   at least one empty byte in buffer.		 added rngEmpty, rngFull, rngFreeBytes, rngNBytes, rngFlush,		   rngPutAhead, rngMoveAhead, some of which used to be		   macros in rngLib.h.		 changed rngBufGet,rngBufPut to rngGetBuf,rngPutBuf.		 changed rngBufCreate to rngCreate.01a,06jun84,dnw  culled from old drvLib.c*//*This library provides routines for creating and using ring buffers, whichare first-in-first-out circular buffers.  The routines simply manipulatethe ring buffer data structure; no kernel functions are invoked.  Inparticular, ring buffers by themselves provide no task synchronization ormutual exclusion.However, the ring buffer pointers are manipulated in such a way that areader task (invoking rngBufGet()) and a writer task (invokingrngBufPut()) can access a ring simultaneously without requiring mutualexclusion.  This is because readers only affect a \f2read\f1 pointer andwriters only affect a \f2write\f1 pointer in a ring buffer data structure.However, access by multiple readers or writers \f2must\fP be interlockedthrough a mutual exclusion mechanism (i.e., a mutual-exclusion semaphoreguarding a ring buffer).This library also supplies two macros, RNG_ELEM_PUT and RNG_ELEM_GET,for putting and getting single bytes from a ring buffer.  They are definedin rngLib.h..CS    int RNG_ELEM_GET (ringId, pch, fromP)    int RNG_ELEM_PUT (ringId, ch, toP).CEBoth macros require a temporary variable <fromP> or <toP>, whichshould be declared as `register int' for maximum efficiency.  RNG_ELEM_GETreturns 1 if there was a character available in the buffer; it returns 0otherwise.  RNG_ELEM_PUT returns 1 if there was room in the buffer; it returns0 otherwise.  These are somewhat faster than rngBufPut() and rngBufGet(),which can put and get multi-byte buffers.INCLUDE FILES: rngLib.h*//* LINTLIBRARY */#include "vxWorks.h"#include "memLib.h"#include "rngLib.h"#include "stdlib.h"#include "string.h"/********************************************************************************* rngCreate - create an empty ring buffer** This routine creates a ring buffer of size <nbytes>, and initializes* it.  Memory for the buffer is allocated from the system memory partition.** RETURNS* The ID of the ring buffer, or NULL if memory cannot be allocated.*/RING_ID rngCreate    (    int nbytes          /* number of bytes in ring buffer */    )    {    char *buffer;    RING_ID ringId = (RING_ID) malloc (sizeof (RING));    if (ringId == NULL)	return (NULL);    /* bump number of bytes requested because ring buffer algorithm     * always leaves at least one empty byte in buffer */    buffer = (char *) malloc ((unsigned) ++nbytes);    if (buffer == NULL)	{	free ((char *)ringId);	return (NULL);	}    ringId->bufSize = nbytes;    ringId->buf	    = buffer;    rngFlush (ringId);    return (ringId);    }/********************************************************************************* rngDelete - delete a ring buffer** This routine deletes a specified ring buffer.* Any data currently in the buffer will be lost.** RETURNS: N/A*/void rngDelete    (    FAST RING_ID ringId         /* ring buffer to delete */    )    {    free (ringId->buf);    free ((char *)ringId);    }/********************************************************************************* rngFlush - make a ring buffer empty** This routine initializes a specified ring buffer to be empty.* Any data currently in the buffer will be lost.** RETURNS: N/A*/void rngFlush    (    FAST RING_ID ringId         /* ring buffer to initialize */    )    {    ringId->pToBuf   = 0;    ringId->pFromBuf = 0;    }/********************************************************************************* rngBufGet - get characters from a ring buffer** This routine copies bytes from the ring buffer <rngId> into <buffer>.* It copies as many bytes as are available in the ring, up to <maxbytes>.* The bytes copied will be removed from the ring.** RETURNS:* The number of bytes actually received from the ring buffer;* it may be zero if the ring buffer is empty at the time of the call.*/int rngBufGet    (    FAST RING_ID rngId,         /* ring buffer to get data from      */    char *buffer,               /* pointer to buffer to receive data */    int maxbytes                /* maximum number of bytes to get    */    )    {    FAST int bytesgot = 0;    int pToBuf = rngId->pToBuf;    int bytes2;    int pRngTmp = 0;    if (pToBuf >= rngId->pFromBuf)	{	/* pToBuf has not wrapped around */	bytesgot = min (maxbytes, pToBuf - rngId->pFromBuf);	bcopy (&rngId->buf [rngId->pFromBuf], buffer, bytesgot);	rngId->pFromBuf += bytesgot;	}    else	{	/* pToBuf has wrapped around.  Grab chars up to the end of the	 * buffer, then wrap around if we need to. */	bytesgot = min (maxbytes, rngId->bufSize - rngId->pFromBuf);	bcopy (&rngId->buf [rngId->pFromBuf], buffer, bytesgot);	pRngTmp = rngId->pFromBuf + bytesgot;	/* If pFromBuf is equal to bufSize, we've read the entire buffer,	 * and need to wrap now.  If bytesgot < maxbytes, copy some more chars	 * in now. */	if (pRngTmp == rngId->bufSize)	    {	    bytes2 = min (maxbytes - bytesgot, pToBuf);	    bcopy (rngId->buf, buffer + bytesgot, bytes2);	    rngId->pFromBuf = bytes2;	    bytesgot += bytes2;	    }	else	    rngId->pFromBuf = pRngTmp;	}    return (bytesgot);    }/********************************************************************************* rngBufPut - put bytes into a ring buffer** This routine puts bytes from <buffer> into ring buffer <ringId>.  The* specified number of bytes will be put into the ring, up to the number of* bytes available in the ring.** INTERNAL* Always leaves at least one byte empty between pToBuf and pFromBuf, to* eliminate ambiguities which could otherwise occur when the two pointers* are equal.** RETURNS:* The number of bytes actually put into the ring buffer;* it may be less than number requested, even zero,* if there is insufficient room in the ring buffer at the time of the call.*/int rngBufPut    (    FAST RING_ID rngId,         /* ring buffer to put data into  */    char *buffer,               /* buffer to get data from       */    int nbytes                  /* number of bytes to try to put */    )    {    FAST int bytesput = 0;    int pFromBuf = rngId->pFromBuf;    int bytes2;    int pRngTmp = 0;    if (pFromBuf > rngId->pToBuf)	{	/* pFromBuf is ahead of pToBuf.  We can fill up to two bytes	 * before it */	bytesput = min (nbytes, pFromBuf - rngId->pToBuf - 1);	bcopy (buffer, &rngId->buf [rngId->pToBuf], bytesput);	rngId->pToBuf += bytesput;	}    else if (pFromBuf == 0)	{	/* pFromBuf is at the beginning of the buffer.  We can fill till	 * the next-to-last element */	bytesput = min (nbytes, rngId->bufSize - rngId->pToBuf - 1);	bcopy (buffer, &rngId->buf [rngId->pToBuf], bytesput);	rngId->pToBuf += bytesput;	}    else	{	/* pFromBuf has wrapped around, and its not 0, so we can fill	 * at least to the end of the ring buffer.  Do so, then see if	 * we need to wrap and put more at the beginning of the buffer. */	bytesput = min (nbytes, rngId->bufSize - rngId->pToBuf);	bcopy (buffer, &rngId->buf [rngId->pToBuf], bytesput);	pRngTmp = rngId->pToBuf + bytesput;	if (pRngTmp == rngId->bufSize)	    {	    /* We need to wrap, and perhaps put some more chars */	    bytes2 = min (nbytes - bytesput, pFromBuf - 1);	    bcopy (buffer + bytesput, rngId->buf, bytes2);	    rngId->pToBuf = bytes2;	    bytesput += bytes2;	    }	else	    rngId->pToBuf = pRngTmp;	}    return (bytesput);    }/********************************************************************************* rngIsEmpty - test if a ring buffer is empty** This routine determines if a specified ring buffer is empty.** RETURNS:* TRUE if empty, FALSE if not.*/BOOL rngIsEmpty    (    RING_ID ringId      /* ring buffer to test */    )    {    return (ringId->pToBuf == ringId->pFromBuf);    }/********************************************************************************* rngIsFull - test if a ring buffer is full (no more room)** This routine determines if a specified ring buffer is completely full.** RETURNS:* TRUE if full, FALSE if not.*/BOOL rngIsFull    (    FAST RING_ID ringId         /* ring buffer to test */    )    {    int n = ringId->pToBuf - ringId->pFromBuf + 1;    return ((n == 0) || (n == ringId->bufSize));    }/********************************************************************************* rngFreeBytes - determine the number of free bytes in a ring buffer** This routine determines the number of bytes currently unused in a specified* ring buffer.** RETURNS: The number of unused bytes in the ring buffer.*/int rngFreeBytes    (    FAST RING_ID ringId         /* ring buffer to examine */    )    {    FAST int n = ringId->pFromBuf - ringId->pToBuf - 1;    if (n < 0)	n += ringId->bufSize;    return (n);    }/********************************************************************************* rngNBytes - determine the number of bytes in a ring buffer** This routine determines the number of bytes currently in a specified* ring buffer.** RETURNS: The number of bytes filled in the ring buffer.*/int rngNBytes    (    FAST RING_ID ringId         /* ring buffer to be enumerated */    )    {    FAST int n = ringId->pToBuf - ringId->pFromBuf;    if (n < 0)	n += ringId->bufSize;    return (n);    }/********************************************************************************* rngPutAhead - put a byte ahead in a ring buffer without moving ring pointers** This routine writes a byte into the ring, but does not move the ring buffer* pointers.  Thus the byte will not yet be available to rngBufGet() calls.* The byte is written <offset> bytes ahead of the next input location in the* ring.  Thus, an offset of 0 puts the byte in the same position as would* RNG_ELEM_PUT would put a byte, except that the input pointer is not updated.** Bytes written ahead in the ring buffer with this routine can be made available* all at once by subsequently moving the ring buffer pointers with the routine* rngMoveAhead().** Before calling rngPutAhead(), the caller must verify that at least* <offset> + 1 bytes are available in the ring buffer.** RETURNS: N/A*/void rngPutAhead    (    FAST RING_ID ringId,   /* ring buffer to put byte in    */    char byte,             /* byte to be put in ring        */    int offset             /* offset beyond next input byte where to put byte */    )    {    FAST int n = ringId->pToBuf + offset;    if (n >= ringId->bufSize)	n -= ringId->bufSize;    *(ringId->buf + n) = byte;    }/********************************************************************************* rngMoveAhead - advance a ring pointer by <n> bytes** This routine advances the ring buffer input pointer by <n> bytes.  This makes* <n> bytes available in the ring buffer, after having been written ahead in* the ring buffer with rngPutAhead().** RETURNS: N/A*/void rngMoveAhead    (    FAST RING_ID ringId,  /* ring buffer to be advanced                  */    FAST int n            /* number of bytes ahead to move input pointer */    )    {    n += ringId->pToBuf;    if (n >= ringId->bufSize)	n -= ringId->bufSize;    ringId->pToBuf = n;    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
a4yy欧美一区二区三区| 成人深夜福利app| 亚洲国产成人精品视频| 一区二区在线观看视频在线观看| 国产精品丝袜一区| 中文字幕中文乱码欧美一区二区 | 亚洲一区二区三区自拍| 一区二区三区日韩欧美精品| 一区二区三区在线观看欧美| 亚洲风情在线资源站| 日韩在线一区二区| 免费观看日韩av| 国产精品一区二区三区99| 国产成人av网站| 色爱区综合激月婷婷| 欧美日韩精品一区二区| 777久久久精品| 日本一区二区三区免费乱视频| 国产精品成人免费精品自在线观看| 一区二区三区四区在线免费观看| 亚洲成人www| 国产精品一二二区| 91久久精品一区二区二区| 欧美一区三区四区| 国产精品日产欧美久久久久| 亚洲午夜精品久久久久久久久| 日韩二区三区在线观看| 日韩和欧美的一区| 91美女精品福利| 欧美最猛性xxxxx直播| 欧美性猛交一区二区三区精品 | 国产精品久久久久久久久图文区| 中文字幕一区二区三中文字幕| 亚洲精品欧美综合四区| 狠狠色丁香久久婷婷综合_中 | 亚洲色图色小说| 秋霞国产午夜精品免费视频| 成人a级免费电影| 3d成人h动漫网站入口| 亚洲国产精品ⅴa在线观看| 日韩在线一区二区| 91亚洲永久精品| 精品成人佐山爱一区二区| 中文字幕欧美日本乱码一线二线| 久久久久久久久久久电影| 亚洲一区二区av在线| 国产成人在线色| 日韩美女视频一区二区在线观看| 中文字幕视频一区| 国产一区二区剧情av在线| 欧美久久久久免费| 亚洲综合男人的天堂| 成人激情校园春色| 精品国产123| 麻豆视频一区二区| 欧美日韩国产a| 一级中文字幕一区二区| av色综合久久天堂av综合| 精品蜜桃在线看| 日韩av中文在线观看| 欧美午夜电影在线播放| 亚洲日本一区二区| 99精品视频中文字幕| 欧美国产精品一区二区三区| 国产自产视频一区二区三区| 91精品国产综合久久久久久漫画 | 午夜精品久久久久久久99水蜜桃 | 亚洲卡通欧美制服中文| a在线播放不卡| 成人欧美一区二区三区小说 | 亚洲午夜免费福利视频| 色欧美日韩亚洲| 亚洲精选一二三| 在线视频国产一区| 亚洲综合色丁香婷婷六月图片| 在线观看免费亚洲| 午夜欧美在线一二页| 3d动漫精品啪啪1区2区免费| 麻豆极品一区二区三区| 精品免费一区二区三区| 精彩视频一区二区三区| 久久久不卡网国产精品二区| 国产精品一二三在| 欧美国产综合色视频| 99久久精品99国产精品| 一区二区三区自拍| 欧美日本一区二区| 久久疯狂做爰流白浆xx| 国产清纯白嫩初高生在线观看91| 成人精品视频网站| 亚洲国产日韩av| 精品久久国产字幕高潮| 粉嫩av一区二区三区| 亚洲综合区在线| 日韩免费一区二区三区在线播放| 国产一区二区三区黄视频| 中文乱码免费一区二区| 欧美在线色视频| 久久99精品视频| 亚洲精选一二三| 精品噜噜噜噜久久久久久久久试看 | 91免费看视频| 日韩在线播放一区二区| 久久精子c满五个校花| 色综合久久综合中文综合网| 日本亚洲视频在线| 中文字幕在线观看不卡| 7777精品伊人久久久大香线蕉的| 国产成人一级电影| 午夜影院久久久| 久久精品在线观看| 欧美福利一区二区| 91视频观看视频| 国产一区二区伦理片| 亚洲va国产天堂va久久en| 国产日韩欧美激情| 欧美视频一区在线观看| 成人免费毛片app| 青青草国产精品97视觉盛宴| 国产精品电影院| 精品捆绑美女sm三区| 欧美天堂亚洲电影院在线播放| 国产精品456| 麻豆精品一二三| 亚洲成人激情自拍| 亚洲女性喷水在线观看一区| 国产无一区二区| 26uuu另类欧美亚洲曰本| 欧美日韩精品免费| 日本韩国一区二区三区| 99这里只有久久精品视频| 国产精品456| 国产在线麻豆精品观看| 日韩制服丝袜av| 婷婷中文字幕一区三区| 亚洲人123区| 国产精品蜜臀av| 日本一区二区三区在线观看| xnxx国产精品| 久久综合国产精品| 91精品国产欧美日韩| 欧美色综合网站| 欧美三区在线观看| 在线精品视频一区二区| 91色porny蝌蚪| 一本色道a无线码一区v| 91在线一区二区| 99久久久免费精品国产一区二区| 国产成人精品亚洲日本在线桃色| 国产自产v一区二区三区c| 久久97超碰国产精品超碰| 另类人妖一区二区av| 国产资源精品在线观看| 国产一区亚洲一区| 丁香婷婷深情五月亚洲| 成人午夜激情片| 色激情天天射综合网| 欧洲视频一区二区| 欧美高清视频不卡网| 欧美一级片在线| 精品福利在线导航| 国产精品视频你懂的| 专区另类欧美日韩| 亚洲高清久久久| 美腿丝袜亚洲色图| 国产精品一二三四| 色婷婷综合久久| 欧美精品在线视频| wwwwww.欧美系列| **性色生活片久久毛片| 香蕉乱码成人久久天堂爱免费| 日本人妖一区二区| 国产不卡免费视频| 91高清视频在线| 精品国产免费人成在线观看| 国产精品美女视频| 婷婷夜色潮精品综合在线| 九九精品视频在线看| 99久久国产综合精品色伊| 欧美日韩免费在线视频| 久久精品人人做人人爽97| 亚洲欧洲日产国码二区| 亚洲图片自拍偷拍| 国产一区二区三区电影在线观看| 91色porny在线视频| 日韩欧美一级特黄在线播放| 国产精品久久福利| 日韩电影在线免费| 99久久精品一区二区| 欧美一区二区三区成人| 综合网在线视频| 精品夜夜嗨av一区二区三区| 91香蕉视频在线| www亚洲一区| 日本不卡一区二区三区| 不卡一区二区中文字幕| 精品久久99ma| 亚洲一区二区欧美| 成人黄色av电影| 久久亚洲精品国产精品紫薇|