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

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

?? userlib.c

?? 應用于MC9S12DG128的ucos系統
?? C
字號:
#include "includes.h"
#include "main.h"
/********************************************************************
                               //
//     Author: CaiXinBo      \\\\\\\                            //
//                          ( o   o )                           //
//----------------------oOO----(_)----OOo-----------------------//
                                                              
    FileName:       Userlib.c	
    Created Date:   23/5/2006   9:43
    Modify Date:    
    Purpose:	
*********************************************************************/

/*********************************************************************/

/* printp() ------------ a simply version of printf()                */

/**********************************************************************/
/* with the help of printp() function, you can get the out format as below:
   printp("This first line outputs the format string.\n");
   printp("%s\n","This second line outputs a string.");
   printp( "Notice that the first %s\n","two output lines had CR/LF at the end.");
   printp( "%c%c%c%c line outputs 'This' as chars.\n",'T', 'h', 'i', 's');
   printp( "Dec values: %d  %d   Hex value: %x\n",dec_value, neg_value, hex_value);
   printp( "Long dec values: %ld  %ld\n",ldec_value,lneg_value);
   printp( "Output sized strings: %20s %-20s\n","Right string","Left string");
   printp( "Output sized values:  %20d %-20d\n",dec_value,neg_value);
   printp( "                      %20x %-20x\n",hex_value,hex_value);
   printp( "                      %20ld %-20ld\n",ldec_value,ldec_value);
where the variables can be as:
   int hex_value = 0x1234;
   int dec_value = 1234;
   int neg_value = -1234;
   long ldec_value = 12345678L;
   long lneg_value = -12345678L;


修改了部分printp()代碼,
 打印時如果 %后面的x,d為大寫,打印的數作為無符號數
                      為小寫,作為有符號數
                 加l為取長型變量。

例如打印如下語句:

	printp("\n here i is 0xF123ABCD, j is 0xF123");
	printp("\n 1 : %%lX i is: %lX",i);
	printp("\n 2 : %%lx i is: %lx",i);
	printp("\n 3 : %%lD i is: %lD",i);
	printp("\n 4 : %%ld i is: %ld",i);
	printp("\n 5 : %%8X i is: %8X",i);
	printp("\n 6 : %%8x i is: %8x",i);
	printp("\n 7 : %%8D i is: %8D",i);
	printp("\n 8 : %%8d i is: %8d",i);
	printp("\n 9 :  %%X j is: %X",j);
	printp("\n 10:  %%x j is: %x",j);
	printp("\n 11:  %%D j is: %D",j);
	printp("\n 12:  %%d j is: %d",j);
結果為:
	 here i is 0xF123ABCD, j is 0xF123
	 1 : %lX i is: F123ABCD
	 2 : %lx i is: -EDC5433
	 3 : %lD i is: 4045646797
	 4 : %ld i is: -249320499
	 5 : %8X i is:     F123
	 6 : %8x i is:     -EDD
	 7 : %8D i is:    61731
	 8 : %8d i is:    -3805
	 9 :  %X j is: F123
	 10:  %x j is: -EDD
	 11:  %D j is: 61731
	 12:  %d j is: -3805  */
 
/************************************************************************/
#include <ctype.h>
#include <string.h>
#include <stdarg.h>

#ifndef  TRUE
#define  TRUE 1
#endif
#ifndef  FALSE
#define  FALSE 0
#endif

#define CR_as_CRLF  TRUE             // if true , you can use "\n" to act as CR/LF, 
                                     // if false , you have to use "\n\r",but can get a higher speed
static int do_padding;
static int left_flag;
static int len;
static int num1;					//number before dot. as 45 in %45.34s format.
static int num2;					//number after  dot. as 34 in %45.34s format. and num2 is only used in s format
static char pad_character;
/*---------------------------------------------------*/
/*                                                   */
/* This routine puts pad characters into the output  */
/* buffer.                                           */
/*                                                   */
static void padding(void (*PortToPut)(), const int l_flag)
{
   int i;

   if (do_padding && l_flag && (len < num1))
      for (i=len; i<num1; i++)
          PortToPut( pad_character);
   }

/*---------------------------------------------------*/
/*                                                   */
/* This routine moves a string to the output buffer  */
/* as directed by the padding and positioning flags. */
/*                                                   */
static void outs(void (*PortToPut)(), char* lp)
{
   /* pad on left if needed                          */
   len = strlen( lp);
   padding(PortToPut, !left_flag);

   /* Move string to the buffer                      */
   while (*lp && num2--)
      PortToPut( *lp++);

   /* Pad on right if needed                         */
   len = strlen( lp);
   padding(PortToPut, left_flag);
   }

/*---------------------------------------------------*/
/*                                                   */
/* This routine moves a number to the output buffer  */
/* as directed by the padding and positioning flags. */
/*                                                   */
static void reoutnum(void (*PortToPut)(),unsigned long num, unsigned int negative, const long base ) 
{
   char* cp;
   char outbuf[32];
   const char digits[] = "0123456789ABCDEF";
   
   /* Build number (backwards) in outbuf             */
   cp = outbuf;
   do {
      *cp++ = digits[(int)(num % base)];
      } while ((num /= base) > 0);
   if (negative)
      *cp++ = '-';
   *cp-- = 0;								//add a 0 in buffer is to use strlen function below

   /* Move the converted number to the buffer and    */
   /* add in the padding where needed.               */
   len = strlen(outbuf);
   padding(PortToPut, !left_flag);
   while (cp >= outbuf)
      PortToPut( *cp--);
   padding(PortToPut, left_flag);
}


static void outnum(void (*PortToPut)(),long num, const long base ,unsigned char sign)//1, signed  0 unsigned
{   unsigned int negative;

   if ( (num < 0L) && sign ) 
   {  negative=1;
      num = -num;
      }
   else negative=0;
   
   reoutnum(PortToPut,num,negative,base);  
} 
/*---------------------------------------------------*/
/*                                                   */
/* This routine gets a number from the format        */
/* string.                                           */
/*                                                   */
static int getnum( char** linep)						//in this routine ,the return value is the number after % or dot、-、l.
{														//and the ctrl(pointer to the format string) will change too.
   int n;
   char* cp;

   n = 0;
   cp = *linep;
   while (isdigit(*cp))
      n = n*10 + ((*cp++) - '0');
   *linep = cp;
   return(n);
}

/*---------------------------------------------------*/
/*                                                   */
/* This routine operates just like a printf/sprintf  */
/* routine. It outputs a set of data under the       */
/* control of a formatting string. Not all of the    */
/* standard C format control are supported. The ones */
/* provided are primarily those needed for embedded  */
/* systems work. Primarily the floaing point         */
/* routines are omitted. Other formats could be      */
/* added easily by following the examples shown for  */
/* the supported formats.                            */
/*                                                   */

void printp(void (*PortToPut)(), char* ctrl, ...)
{

   int long_flag;
   int dot_flag;										//dot_flag is only used in s format

   char ch;
   va_list argp;

   va_start( argp, ctrl);

   for ( ; *ctrl; ctrl++) {								//at the begin of for loop, check the char pointed by ctrl
														//if a %, extract numbers after % if they exist;
      /* move format string chars to buffer until a  */ //        then begin the format conversion and putout.
      /* format control is found.                    */ //if not a %, putout the char and start next for loop.
      if (*ctrl != '%') {
         PortToPut(*ctrl);
#if CR_as_CRLF==TRUE         
         if(*ctrl=='\n') PortToPut('\r');
#endif         
         continue;
         }

      /* initialize all the flags for this format.   */
      dot_flag   =
      long_flag  =
      left_flag  =
      do_padding = 0;
      pad_character = ' ';
      num2=32767;					// largest unsigned number

try_next:
      ch = *(++ctrl);

      if (isdigit(ch)) {
         if (dot_flag)
            num2 = getnum(&ctrl);
         else {
            if (ch == '0')
               pad_character = '0';

            num1 = getnum(&ctrl);		//in getnum function, ctrl is changed to point to the next value after numbers 
            do_padding = 1;				//in the format string.
         }
         ctrl--;				//here, adjust ctrl point to the last char in numbers to fit the sentense ch = *(++ctrl);
         goto try_next;
      }

      switch (tolower(ch)) {		//the ch is the char after % or %numbers in format string
         case '%':
              PortToPut( '%');
              continue;				//if %, putout % and start next for loop

         case '-':
              left_flag = 1;
              break;				//if -,  left align    out switch and goto try_next to see the next char
									//go to try_next to get another format char
         case '.':
              dot_flag = 1;
              break;				//a number after dot is used in s format to direct the out char number
									//go to try_next to get another format char
         case 'l':
              long_flag = 1;		
              break;				//l means long
									//go to try_next to get another format char
         case 'd':		//D unsigned ,  d signed
              if (long_flag ==1 ) {
              		if(ch == 'D')                {outnum(PortToPut, va_arg(argp, unsigned long), 10L , 0);continue;}
              	        else  /* ch == 'd' */        {outnum(PortToPut, va_arg(argp, long), 10L,1);continue;}
                 }								//va_arg will extract a special type argument from the stack
              else {							//and adjust the argp to point to next argument in stack
              		if(ch == 'D')                {outnum(PortToPut, va_arg(argp, unsigned int),10L,0);continue;}
              		else  /* ch == 'd' */        {outnum(PortToPut, va_arg(argp, int), 10L,1);continue;}
                }
                
         case 'x':    // X unsigned , x  signed
              if (long_flag ==1 )  {
              	        if(ch == 'X')                {outnum(PortToPut, va_arg(argp, unsigned long), 16L,0);continue;}
              	        else  /* ch == 'x' */        {outnum(PortToPut, va_arg(argp, long), 16L,1);continue;} 
                 }
              else {
              		if(ch == 'X')                {outnum(PortToPut, va_arg(argp, unsigned int), 16L,0);continue;}
              		else  /* ch == 'x' */        {outnum(PortToPut, va_arg(argp, int), 16L,1);continue;}
                 } 

         case 's':
              outs(PortToPut, va_arg( argp, char*));
              continue;				//output a string with special format as -10.8s and start next for loop

         case 'c':
              PortToPut( va_arg( argp, int));
              continue;				//output a char and start next for loop

         default:
              continue;
         }
      goto try_next;				//execute only if there is '-' or '.' or 'l' in format
      }								//end of for loop
   va_end( argp);					//end arguments extraction
   }


/***********delay(long j)*************/

void delay(long j){
long i;
for(i=0;i<j;i++)
{};
}
	








?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产欧美日韩另类综合| 久久超碰97人人做人人爱| 成人av在线播放网站| 精品国产成人系列| 日韩电影在线一区| 69久久夜色精品国产69蝌蚪网| 亚洲最色的网站| 欧美在线观看视频一区二区三区| 中文字幕一区二区日韩精品绯色| 成人在线综合网| 国产精品免费久久| 不卡视频一二三| 一区在线观看视频| 色综合久久精品| 夜夜精品浪潮av一区二区三区| 日本精品视频一区二区| 亚洲一本大道在线| 欧美精品色一区二区三区| 午夜精品在线看| 这里只有精品99re| 麻豆精品视频在线观看| 久久奇米777| 国产成人精品免费网站| 国产精品全国免费观看高清| 成人av网址在线观看| 亚洲丝袜自拍清纯另类| 97se亚洲国产综合自在线不卡| 亚洲色大成网站www久久九九| 91蜜桃免费观看视频| 亚洲一区国产视频| 制服.丝袜.亚洲.中文.综合| 看电视剧不卡顿的网站| 久久美女艺术照精彩视频福利播放 | 欧美成人vps| 国产米奇在线777精品观看| 国产精品色婷婷久久58| 日本二三区不卡| 午夜国产精品一区| 欧美videos大乳护士334| 丁香婷婷综合网| 一区二区三区高清不卡| 欧美精品高清视频| 国产伦精品一区二区三区免费迷 | 91久久香蕉国产日韩欧美9色| 亚洲成人自拍一区| 日韩你懂的在线观看| 国产乱国产乱300精品| 中文字幕日韩一区| 欧美精品黑人性xxxx| 国产露脸91国语对白| 亚洲日本在线a| 制服丝袜日韩国产| 大胆亚洲人体视频| 亚洲一二三四区| 亚洲精品在线观看网站| 成人动漫视频在线| 天天av天天翘天天综合网| 久久午夜国产精品| 在线精品视频免费播放| 久久精品国产精品亚洲红杏| 中文字幕欧美国产| 欧美色精品在线视频| 狠狠色综合播放一区二区| 日韩一区中文字幕| 日韩欧美激情四射| 99视频一区二区| 毛片基地黄久久久久久天堂| 国产蜜臀97一区二区三区| 欧美视频一区在线观看| 国产一区二区三区免费在线观看| 亚洲精品高清视频在线观看| 精品日本一线二线三线不卡| 一本色道久久综合狠狠躁的推荐 | 久久国产精品99久久久久久老狼 | 久久婷婷国产综合国色天香| 色88888久久久久久影院野外| 久久成人久久鬼色| 一区二区三区日本| 久久综合久久综合久久| 欧美专区在线观看一区| 懂色中文一区二区在线播放| 日韩国产在线观看一区| 亚洲欧美日韩综合aⅴ视频| 亚洲精品一区二区三区影院 | 成人免费小视频| 欧美精品一区二区三区四区| 欧美亚洲国产怡红院影院| 懂色av一区二区三区免费观看| 日日摸夜夜添夜夜添亚洲女人| 中文字幕一区二区三区色视频| 精品剧情在线观看| 欧美日韩成人在线一区| 91美女蜜桃在线| 成人精品视频一区二区三区| 极品尤物av久久免费看| 视频一区免费在线观看| 一区二区三区国产精华| 国产精品久久久久精k8| 2020国产精品| 日韩精品中文字幕在线一区| 欧美日韩国产一二三| 一本一本大道香蕉久在线精品| 国产很黄免费观看久久| 蜜桃久久精品一区二区| 亚洲成a人v欧美综合天堂| 亚洲日本一区二区三区| 中文一区二区在线观看| 久久久噜噜噜久久中文字幕色伊伊| 欧美日韩1234| 欧美午夜一区二区三区免费大片| 99久久婷婷国产| 成人h动漫精品一区二区| 九一九一国产精品| 日本不卡1234视频| 日韩精品成人一区二区在线| 亚洲综合色网站| 亚洲欧美另类久久久精品2019| 国产精品乱子久久久久| 中文av一区特黄| 国产欧美日韩中文久久| 久久嫩草精品久久久精品| 日韩精品一区二区三区四区视频| 欧美麻豆精品久久久久久| 欧美性一二三区| 欧美亚洲国产一区在线观看网站| 色噜噜久久综合| 91老司机福利 在线| 97久久精品人人做人人爽 | 九一久久久久久| 久久精品国产在热久久| 久久国产成人午夜av影院| 激情国产一区二区 | 国产乱子伦视频一区二区三区| 老色鬼精品视频在线观看播放| 人禽交欧美网站| 日本亚洲最大的色成网站www| 亚洲一区二区三区四区五区黄| 亚洲一区二区三区中文字幕| 亚洲午夜电影在线| 丝袜美腿亚洲综合| 日本麻豆一区二区三区视频| 免费观看一级特黄欧美大片| 蜜桃一区二区三区四区| 国产在线精品免费| 国产福利一区在线| 成人国产亚洲欧美成人综合网| caoporm超碰国产精品| 91美女精品福利| 欧美色图一区二区三区| 欧美高清性hdvideosex| 欧美成人福利视频| 欧美韩国日本一区| 亚洲美女在线国产| 天涯成人国产亚洲精品一区av| 蜜芽一区二区三区| 国产成人精品免费网站| jlzzjlzz亚洲女人18| 欧美系列亚洲系列| 日韩欧美美女一区二区三区| 国产亚洲女人久久久久毛片| 最新日韩在线视频| 亚洲高清一区二区三区| 精品在线观看视频| 成人国产精品免费观看动漫 | 91在线观看成人| 欧美日韩在线播| 精品三级在线观看| 国产精品久久久久久户外露出| 亚洲国产日日夜夜| 精品在线观看免费| 91蝌蚪porny成人天涯| 91精品一区二区三区久久久久久 | 欧美mv日韩mv国产网站app| 国产日产欧美一区| 亚洲自拍偷拍九九九| 久久精品久久久精品美女| 成人黄色片在线观看| 欧美日韩一区不卡| 久久精品亚洲精品国产欧美| 亚洲精品网站在线观看| 久久国产精品72免费观看| 9色porny自拍视频一区二区| 欧美日本一区二区| 日本一区二区动态图| 亚洲成a天堂v人片| 国产69精品久久久久毛片| 91九色最新地址| 精品国产人成亚洲区| 亚洲黄色小说网站| 国产乱子轮精品视频| 欧美性大战久久久久久久| 久久综合999| 香蕉加勒比综合久久| 国产成人综合亚洲网站| 欧美日韩大陆一区二区| 国产精品传媒在线| 久草热8精品视频在线观看| 91久久久免费一区二区| 国产欧美一区二区精品婷婷| 舔着乳尖日韩一区|