• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PrintCh函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PrintCh函数的典型用法代码示例。如果您正苦于以下问题:C++ PrintCh函数的具体用法?C++ PrintCh怎么用?C++ PrintCh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PrintCh函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: PrintFP

/* print a double to a stream without using printf/sprintf */
void PrintFP(double Num, struct OutputStream *Stream)
{
    int Exponent = 0;
    int MaxDecimal;
    
    if (Num < 0)
    {
        PrintCh('-', Stream);
        Num = -Num;    
    }
    
    if (Num >= 1e7)
        Exponent = log10(Num);
    else if (Num <= 1e-7 && Num != 0.0)
        Exponent = log10(Num) - 0.999999999;
    
    Num /= pow(10.0, Exponent);    
    PrintInt((long)Num, 0, FALSE, FALSE, Stream);
    PrintCh('.', Stream);
    Num = (Num - (long)Num) * 10;
    if (abs(Num) >= 1e-7)
    {
        for (MaxDecimal = 6; MaxDecimal > 0 && abs(Num) >= 1e-7; Num = (Num - (long)(Num + 1e-7)) * 10, MaxDecimal--)
            PrintCh('0' + (long)(Num + 1e-7), Stream);
    }
    else
        PrintCh('0', Stream);
        
    if (Exponent != 0)
    {
        PrintCh('e', Stream);
        PrintInt(Exponent, 0, FALSE, FALSE, Stream);
    }
}
开发者ID:fjrti,项目名称:remix,代码行数:35,代码来源:clibrary.c


示例2: PrintType

/* print a type to a stream without using printf/sprintf */
void PrintType(struct ValueType *Typ, IOFILE *Stream)
{
    switch (Typ->Base)
    {
        case TypeVoid:          PrintStr("void", Stream); break;
        case TypeInt:           PrintStr("int", Stream); break;
        case TypeShort:         PrintStr("short", Stream); break;
        case TypeChar:          PrintStr("char", Stream); break;
        case TypeLong:          PrintStr("long", Stream); break;
        case TypeUnsignedInt:   PrintStr("unsigned int", Stream); break;
        case TypeUnsignedShort: PrintStr("unsigned short", Stream); break;
        case TypeUnsignedLong:  PrintStr("unsigned long", Stream); break;
#ifndef NO_FP
        case TypeFP:            PrintStr("double", Stream); break;
#endif
        case TypeFunction:      PrintStr("function", Stream); break;
        case TypeMacro:         PrintStr("macro", Stream); break;
        case TypePointer:       if (Typ->FromType) PrintType(Typ->FromType, Stream); PrintCh('*', Stream); break;
        case TypeArray:         PrintType(Typ->FromType, Stream); PrintCh('[', Stream); if (Typ->ArraySize != 0) PrintSimpleInt(Typ->ArraySize, Stream); PrintCh(']', Stream); break;
        case TypeStruct:        PrintStr("struct ", Stream); PrintStr(Typ->Identifier, Stream); break;
        case TypeUnion:         PrintStr("union ", Stream); PrintStr(Typ->Identifier, Stream); break;
        case TypeEnum:          PrintStr("enum ", Stream); PrintStr(Typ->Identifier, Stream); break;
        case TypeGotoLabel:     PrintStr("goto label ", Stream); break;
        case Type_Type:         PrintStr("type ", Stream); break;
    }
}
开发者ID:fjrti,项目名称:remix,代码行数:27,代码来源:clibrary.c


示例3: PlatformVPrintf

void PlatformVPrintf(const char *Format, va_list Args)
{
    const char *FPos;
    
    for (FPos = Format; *FPos != '\0'; FPos++)
    {
        if (*FPos == '%')
        {
            FPos++;
            switch (*FPos)
            {
            case 's': PrintStr(va_arg(Args, char *), CStdOut); break;
            case 'd': PrintSimpleInt(va_arg(Args, int), CStdOut); break;
            case 'c': PrintCh(va_arg(Args, int), CStdOut); break;
            case 't': PrintType(va_arg(Args, struct ValueType *), CStdOut); break;
#ifndef NO_FP
            case 'f': PrintFP(va_arg(Args, double), CStdOut); break;
#endif
            case '%': PrintCh('%', CStdOut); break;
            case '\0': FPos--; break;
            }
        }
        else
            PrintCh(*FPos, CStdOut);
    }
}
开发者ID:josegomezr,项目名称:PicoCi,代码行数:26,代码来源:platform.c


示例4: PrintPound

static VOID PrintPound()
{
	WORD  wr = 0x0700;
	
	wr += '#';
	GotoHome();
	ChangeLine();
	PrintCh(wr);
}
开发者ID:KimZhou,项目名称:HelloX_Kernel,代码行数:9,代码来源:SYSD_S.C


示例5: PrintSourceTextErrorLine

void PrintSourceTextErrorLine(const char *FileName, const char *SourceText, int Line, int CharacterPos)
{
    int LineCount;
    const char *LinePos;
    const char *CPos;
    int CCount;

    PlatformSourceError(FileName, SourceText, Line, CharacterPos);
    return;

    if (SourceText != NULL)
    {
        /* find the source line */
        for (LinePos = SourceText, LineCount = 1; *LinePos != '\0' && LineCount < Line; LinePos++)
        {
            if (*LinePos == '\n')
                LineCount++;
        }

        /* display the line */
        for (CPos = LinePos; *CPos != '\n' && *CPos != '\0'; CPos++)
            PrintCh(*CPos, CStdOut);
        PrintCh('\n', CStdOut);

        /* display the error position */
        for (CPos = LinePos, CCount = 0; *CPos != '\n' && *CPos != '\0' && (CCount < CharacterPos || *CPos == ' '); CPos++, CCount++)
        {
            if (*CPos == '\t')
                PrintCh('\t', CStdOut);
            else
                PrintCh(' ', CStdOut);
        }
    }
    else
    {
        /* assume we're in interactive mode - try to make the arrow match up with the input text */
        for (CCount = 0; CCount < CharacterPos + strlen(INTERACTIVE_PROMPT_STATEMENT); CCount++)
            PrintCh(' ', CStdOut);
    }
    PlatformPrintf("^\n%s:%d: ", FileName, Line, CharacterPos);

}
开发者ID:jmgrosen,项目名称:light-simulator,代码行数:42,代码来源:platform.c


示例6: LibSPrintf

/* sprintf(): print to a string */
void LibSPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
{
    struct OutputStream StrStream;
    
    StrStream.Putch = &SPutc;
    StrStream.i.Str.Parser = Parser;
    StrStream.i.Str.WritePos = Param[0]->Val->Pointer;

    GenericPrintf(Parser, ReturnValue, Param+1, NumArgs-1, &StrStream);
    PrintCh(0, &StrStream);
    ReturnValue->Val->Pointer = *Param;
}
开发者ID:fjrti,项目名称:remix,代码行数:13,代码来源:clibrary.c


示例7: PrintInt

/* print an integer to a stream without using printf/sprintf */
void PrintInt(long Num, int FieldWidth, int ZeroPad, int LeftJustify, struct OutputStream *Stream)
{
    if (Num < 0)
    {
        PrintCh('-', Stream);
        Num = -Num;
        if (FieldWidth != 0)
            FieldWidth--;
    }
    
    PrintUnsigned((unsigned long)Num, 10, FieldWidth, ZeroPad, LeftJustify, Stream);
}
开发者ID:fjrti,项目名称:remix,代码行数:13,代码来源:clibrary.c


示例8: EventHandler

//Shell thread's event handler.
static BOOL EventHandler(WORD wCommand,WORD wParam,DWORD dwParam)
{
	WORD wr = 0x0700;
	BYTE bt = 0x00;

	switch(wCommand)
	{
	case MSG_KEY_DOWN:
		bt = (BYTE)(dwParam);
		if(VK_RETURN == bt)
		{
			if(BufferPtr)
			{
				DoCommand();
			}
			PrintPrompt();
			break;
		}
		if(VK_BACKSPACE == bt)
		{
			if(0 != BufferPtr)
			{
				GotoPrev();
				BufferPtr --;
			}
			break;
		}
		else
		{
			if(MAX_BUFFER_LEN - 1 > BufferPtr)
			{
				CmdBuffer[BufferPtr] = bt;
				BufferPtr ++;
				wr += (BYTE)(dwParam);
				PrintCh(wr);
			}
		}
		break;
	case KERNEL_MESSAGE_TIMER:
	default:
		break;
	}
	return 0;
}
开发者ID:KimZhou,项目名称:HelloX_STM32,代码行数:45,代码来源:SHELL.C


示例9: GenericPrintf

/* intrinsic functions made available to the language */
void GenericPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs, struct OutputStream *Stream)
{
    char *FPos;
    struct Value *NextArg = Param[0];
    struct ValueType *FormatType;
    int ArgCount = 1;
    int LeftJustify = FALSE;
    int ZeroPad = FALSE;
    int FieldWidth = 0;
    char *Format = Param[0]->Val->Pointer;
    
    for (FPos = Format; *FPos != '\0'; FPos++)
    {
        if (*FPos == '%')
        {
            FPos++;
            if (*FPos == '-')
            {
                /* a leading '-' means left justify */
                LeftJustify = TRUE;
                FPos++;
            }
            
            if (*FPos == '0')
            {
                /* a leading zero means zero pad a decimal number */
                ZeroPad = TRUE;
                FPos++;
            }
            
            /* get any field width in the format */
            while (isdigit((int)*FPos))
                FieldWidth = FieldWidth * 10 + (*FPos++ - '0');
            
            /* now check the format type */
            switch (*FPos)
            {
                case 's': FormatType = CharPtrType; break;
                case 'd': case 'u': case 'x': case 'b': case 'c': FormatType = &IntType; break;
#ifndef NO_FP
                case 'f': FormatType = &FPType; break;
#endif
                case '%': PrintCh('%', Stream); FormatType = NULL; break;
                case '\0': FPos--; FormatType = NULL; break;
                default:  PrintCh(*FPos, Stream); FormatType = NULL; break;
            }
            
            if (FormatType != NULL)
            { 
                /* we have to format something */
                if (ArgCount >= NumArgs)
                    PrintStr("XXX", Stream);   /* not enough parameters for format */
                else
                {
                    NextArg = (struct Value *)((char *)NextArg + MEM_ALIGN(sizeof(struct Value) + TypeStackSizeValue(NextArg)));
                    if (NextArg->Typ != FormatType && 
                            !((FormatType == &IntType || *FPos == 'f') && IS_NUMERIC_COERCIBLE(NextArg)) &&
                            !(FormatType == CharPtrType && (NextArg->Typ->Base == TypePointer || 
                                                             (NextArg->Typ->Base == TypeArray && NextArg->Typ->FromType->Base == TypeChar) ) ) )
                        PrintStr("XXX", Stream);   /* bad type for format */
                    else
                    {
                        switch (*FPos)
                        {
                            case 's':
                            {
                                char *Str;
                                
                                if (NextArg->Typ->Base == TypePointer)
                                    Str = NextArg->Val->Pointer;
                                else
                                    Str = &NextArg->Val->ArrayMem[0];
                                    
                                if (Str == NULL)
                                    PrintStr("NULL", Stream); 
                                else
                                    PrintStr(Str, Stream); 
                                break;
                            }
                            case 'd': PrintInt(ExpressionCoerceInteger(NextArg), FieldWidth, ZeroPad, LeftJustify, Stream); break;
                            case 'u': PrintUnsigned(ExpressionCoerceUnsignedInteger(NextArg), 10, FieldWidth, ZeroPad, LeftJustify, Stream); break;
                            case 'x': PrintUnsigned(ExpressionCoerceUnsignedInteger(NextArg), 16, FieldWidth, ZeroPad, LeftJustify, Stream); break;
                            case 'b': PrintUnsigned(ExpressionCoerceUnsignedInteger(NextArg), 2, FieldWidth, ZeroPad, LeftJustify, Stream); break;
                            case 'c': PrintCh(ExpressionCoerceUnsignedInteger(NextArg), Stream); break;
#ifndef NO_FP
                            case 'f': PrintFP(ExpressionCoerceFP(NextArg), Stream); break;
#endif
                        }
                    }
                }
                
                ArgCount++;
            }
        }
        else
            PrintCh(*FPos, Stream);
    }
}
开发者ID:fjrti,项目名称:remix,代码行数:99,代码来源:clibrary.c


示例10: PrintRepeatedChar

/* print a single character a given number of times */
void PrintRepeatedChar(char ShowChar, int Length, struct OutputStream *Stream)
{
    while (Length-- > 0)
        PrintCh(ShowChar, Stream);
}
开发者ID:fjrti,项目名称:remix,代码行数:6,代码来源:clibrary.c


示例11: PrintStr

/* print a string to a stream without using printf/sprintf */
void PrintStr(const char *Str, struct OutputStream *Stream)
{
    while (*Str != 0)
        PrintCh(*Str++, Stream);
}
开发者ID:fjrti,项目名称:remix,代码行数:6,代码来源:clibrary.c


示例12: ChartGridRelation

void ChartGridRelation()
{
    char sz[cchSzDef];
    int i, j, k, tot = cObjOpt, temp, m;
    char ignoreT[objMax];

    PrintHeader();     /* Display chart info */

#ifdef INTERPRET
    if (us.fInterpret && !us.fGridConfig) {
        InterpretGridRelation();
        return;
    }
#endif

    if (us.nRel == rcTransit) {
        for (m = 0; m <= cObjOpt; m++)
            ignoreT[m] = ignore2[m];
    } else if (us.nRel == rcProgress) {
        for (m = 0; m <= cObjOpt; m++)
            ignoreT[m] = ignore3[m];
    } else {
        for (m = 0; m<= cObjOpt; m++)
            ignoreT[m] = ignore[m];
    }

    PrintSz(" 2>");
    for (temp = 0, i = 0; i <= cObjOpt; i++) if (!ignoreT[i] && i != us.objCenter) {
            PrintCh(chV);
            AnsiColor(kObjA[i]);
            sprintf(sz, "%c%c%c", chObj3(i));
            PrintSz(sz);
            AnsiColor(kDefault);
            temp++;
        }
    PrintSz("\n1  ");
    for (i = 0; i <= tot; i++) if (!ignoreT[i] && i != us.objCenter) {
            PrintCh(chV);
            AnsiColor(kSignA(SFromZ(cp2.obj[i])));
            sprintf(sz, "%2d%c", (int)cp2.obj[i] % 30, chDeg0);
            PrintSz(sz);
            AnsiColor(kDefault);
        }
    PrintSz("\nV  ");
    for (i = 0; i <= tot; i++) if (!ignoreT[i] && i != us.objCenter) {
            PrintCh(chV);
            temp = SFromZ(cp2.obj[i]);
            AnsiColor(kSignA(temp));
            sprintf(sz, "%c%c%c", chSig3(temp));
            PrintSz(sz);
            AnsiColor(kDefault);
        }
    PrintL();
    for (j = 0; j <= cObjOpt; j++) if (!ignore[j] && j != us.objCenter)
            for (k = 1; k <= 4; k++) {
                if (k < 2)
                    PrintTab(chH, 3);
                else if (k == 2) {
                    AnsiColor(kObjA[j]);
                    sprintf(sz, "%c%c%c", chObj3(j));
                    PrintSz(sz);
                } else {
                    temp = SFromZ(cp1.obj[j]);
                    AnsiColor(kSignA(temp));
                    if (k == 3)
                        sprintf(sz, "%2d%c", (int)cp1.obj[j] - (temp-1)*30, chDeg0);
                    else
                        sprintf(sz, "%c%c%c", chSig3(temp));
                    PrintSz(sz);
                }
                if (k > 1)
                    AnsiColor(kDefault);
                for (i = 0; i <= tot; i++) if (!ignoreT[i] && i != us.objCenter) {
                        PrintCh((char)(k < 2 ? chC : chV));
                        temp = grid->n[i][j];
                        if (k > 1) {
                            if (i == j)
                                AnsiColor(kReverse);
                            AnsiColor(us.fGridConfig ? kSignA(temp) :
                                      kAspA[temp]);
                        }
                        if (k < 2)
                            PrintTab(chH, 3);
                        else if (k == 2) {
                            if (us.fGridConfig)
                                sprintf(sz, "%c%c%c", chSig3(temp));
                            else
                                sprintf(sz, "%s", temp ? szAspectAbbrev[temp] : "   ");
                            PrintSz(sz);
                        } else if (k == 3) {
                            if (us.fGridConfig) {
                                sprintf(sz, "%2d%c", grid->v[i][j]/3600, chDeg0);
                                PrintSz(sz);
                            } else if (grid->n[i][j]) {
                                if (grid->v[i][j] < 360000)
                                    sprintf(sz, "%c%2d", us.fAppSep ?
                                            (grid->v[i][j] < 0 ? 'a' : 's') :
                                                    (grid->v[i][j] < 0 ? '-' : '+'), abs(grid->v[i][j])/3600);
                                else
                                    sprintf(sz, "%3d", abs(temp)/60);
//.........这里部分代码省略.........
开发者ID:JoshMPlant,项目名称:astrolog,代码行数:101,代码来源:charts2.c


示例13: __UserInput

//Process user input.
//This is a private function can only be called by heditEntry.
static VOID __UserInput(HANDLE hFile)
{
#ifdef __CFG_SYS_DDF
	BYTE*                       pDataBuffer      = NULL;
	BYTE*                       pCurrPos         = NULL;
	DWORD                       dwDefaultSize    = 8192;      //Default file size is 8K.
	BOOL                        bCtrlDown        = FALSE;
	BYTE                        bt;
	WORD                        wr                            = 0x0700;
	__KERNEL_THREAD_MESSAGE     Msg;
	DWORD                       dwWrittenSize    = 0;

	pDataBuffer = (BYTE*)KMemAlloc(dwDefaultSize,KMEM_SIZE_TYPE_ANY);
	if(NULL == pDataBuffer)
	{
		PrintLine("  Can not allocate memory.");
		goto __TERMINAL;
	}
	pCurrPos = pDataBuffer;

	while(TRUE)
	{
		if(GetMessage(&Msg))
		{
			if(MSG_KEY_DOWN == Msg.wCommand)    //This is a key down message.
			{
				bt = (BYTE)Msg.dwParam;
				switch(bt)
				{
				case VK_RETURN:                  //This is a return key.
					if((DWORD)(pCurrPos - pDataBuffer) < dwDefaultSize - 2)
					{
						*pCurrPos ++ = '\r';     //Append a return key.
						*pCurrPos ++ = '\n';
						GotoHome();
						ChangeLine();            //Change to next line.
					}
					break;
				case VK_BACKSPACE:
					if(*pCurrPos == '\n')  //Enter encountered.
					{
						pCurrPos -= 2;     //Skip the \r\n.
					}
					else
					{
						pCurrPos -= 1;
					}
					GotoPrev();
					break;
				default:
					if(('c' == bt) || ('C' == bt) || ('z' == bt) || ('Z' == bt))
					{
						if(bCtrlDown)  //CtrlC or CtrlZ encountered.
						{
							goto __TERMINAL;
						}
					}
					if((DWORD)(pCurrPos - pDataBuffer) < dwDefaultSize)
					{
						*pCurrPos ++ = bt; //Save this character.
						wr += bt;
						PrintCh(wr);
						wr  = 0x0700;
					}
					break;
				}
			}
			else
			{
				if(VIRTUAL_KEY_DOWN == Msg.wCommand)
				{
					bt = (BYTE)Msg.dwParam;
					if(VK_CONTROL == bt)
					{
						bCtrlDown = TRUE;
					}
				}
				if(VIRTUAL_KEY_UP   == Msg.wCommand)
				{
					bt = (BYTE)Msg.dwParam;
					if(VK_CONTROL == bt)    //Control key up.
					{
						bCtrlDown = FALSE;
					}
				}
			}
		}
	}

__TERMINAL:
	IOManager.WriteFile((__COMMON_OBJECT*)&IOManager,
		hFile,
		(DWORD)(pCurrPos - pDataBuffer),
		pDataBuffer,
		&dwWrittenSize);
	if(pDataBuffer)
	{
		KMemFree(pDataBuffer,KMEM_SIZE_TYPE_ANY,0);
//.........这里部分代码省略.........
开发者ID:KimZhou,项目名称:HelloX_Kernel,代码行数:101,代码来源:HEDIT.C


示例14: SysDiagStart

DWORD SysDiagStart(LPVOID p)
{
	CHAR                        strCmdBuffer[MAX_BUFFER_LEN];
	BYTE                        ucCurrentPtr                  = 0;
	BYTE                        bt;
	WORD                        wr                            = 0x0700;
	__KERNEL_THREAD_MESSAGE     Msg;
	DWORD                       dwRetVal;

	PrintPound();    //Print out the prompt.

	while(TRUE)
	{
		if(KernelThreadManager.GetMessage((__COMMON_OBJECT*)KernelThreadManager.lpCurrentKernelThread,&Msg))
		{
			if(MSG_KEY_DOWN == Msg.wCommand)    //This is a key down message.
			{
				bt = (BYTE)(Msg.dwParam);
				switch(bt)
				{
				case VK_RETURN:                //This is a return key.
					if(0 == ucCurrentPtr)      //There is not any character before this key.
					{
						PrintPound();
						break;
					}
					else
					{
						strCmdBuffer[ucCurrentPtr] = 0;    //Set the terminal flag.
						dwRetVal = CommandParser(strCmdBuffer);
						switch(dwRetVal)
						{
						case SYS_DIAG_CMD_PARSER_TERMINAL: //Exit command is entered.
							goto __TERMINAL;
						case SYS_DIAG_CMD_PARSER_INVALID:  //Can not parse the command.
							PrintLine("    Invalid command.");
							//PrintPound();
							break;
						case SYS_DIAG_CMD_PARSER_FAILED:
							PrintLine("Failed to process the command.");
							break;
						case SYS_DIAG_CMD_PARSER_SUCCESS:      //Process the command successfully.
							//PrintPound();
							break;
						default:
							break;
						}
						ucCurrentPtr = 0;    //Re-initialize the buffer pointer.
						PrintPound();
					}
					break;
				case VK_BACKSPACE:
					if(ucCurrentPtr)
					{
						ucCurrentPtr --;
						GotoPrev();
					}
					break;
				default:
					if(ucCurrentPtr < MAX_BUFFER_LEN)    //The command buffer is not overflow.
					{
						strCmdBuffer[ucCurrentPtr] = bt;
						ucCurrentPtr ++;
						wr += bt;
						PrintCh(wr);
						wr  = 0x0700;
					}
					break;
				}
			}
			else
			{
				if(Msg.wCommand == KERNEL_MESSAGE_TIMER)
				{
					PrintLine("Timer message received.");
				}
			}
		}
	}

__TERMINAL:
	return 0;
}
开发者ID:KimZhou,项目名称:HelloX_Kernel,代码行数:83,代码来源:SYSD_S.C


示例15: IoCtrlStart

DWORD IoCtrlStart(LPVOID p)
{
	DWORD                    dwCurrentPtr       = 0;
	__KERNEL_THREAD_MESSAGE  Msg;
	BYTE                     bt;
	WORD                     wr                 = 0x0700;
	DWORD                    dwMapIndex         = 0;
	BOOL                     bValidCmd          = FALSE;
	__CMD_PARA_OBJ*          lpParamObj         = NULL;
	DWORD                    dwRetVal           = 0;

	PrintPound();            //Print out the prompt of this application.

	while(TRUE)
	{
		if(KernelThreadManager.GetMessage((__COMMON_OBJECT*)KernelThreadManager.lpCurrentKernelThread,&Msg))
		{
			if(MSG_KEY_DOWN == Msg.wCommand)  //This is a key down event.
			{
				bt = (BYTE)Msg.dwParam;
				if(VK_RETURN == bt)    //The ENTER key is pressed.
				{
					strCmdBuffer[dwCurrentPtr] = 0;  //Set the end flag.
					dwCurrentPtr               = 0;  //Set the pointer to begin.
					//
					//The following code handles the command.
					//

					lpParamObj = FormParameterObj(&strCmdBuffer[0]);
					if(NULL == lpParamObj)    //Can not create parameter object.
					{
						PrintLine("Fatal error occurs,application exit.");
						goto __TERMINAL;    //Exit the application.
					}
					if(0 != lpParamObj->byParameterNum)  //Valid parameter(s) exits.
					{
						while(IOCtrlCmdMap[dwMapIndex].lpszCommand)
						{
							if(StrCmp(IOCtrlCmdMap[dwMapIndex].lpszCommand,
								lpParamObj->Parameter[0]))
							{
								bValidCmd = TRUE;    //Find the valid command.
								break;
							}
							dwMapIndex ++;
						}
						if(bValidCmd)  //Handle the command.
						{
							dwRetVal = IOCtrlCmdMap[dwMapIndex].CommandRoutine(lpParamObj);
						}
						else
						{
							PrintLine("Unrecognized command.");
						}
					}

					bValidCmd      = FALSE;
					dwMapIndex     = 0;
					ReleaseParameterObj(lpParamObj);  //Release the parameter object.
					if(IOCTRL_TERMINAL == dwRetVal)
						goto __TERMINAL;
					PrintPound();
				}
				else
				if(VK_BACKSPACE == bt)  //Delete one character.
				{
					if(dwCurrentPtr)
					{
						dwCurrentPtr --;
						GotoPrev();    //Erase one character from screen.
					}
				}
				else  //This only a normal key down event.
				{
					if(dwCurrentPtr < MAX_BUFFER_LEN)  //If the buffer is not overflow.
					{
						strCmdBuffer[dwCurrentPtr] = bt;
						dwCurrentPtr ++;
						wr += bt;
						PrintCh(wr);                   //Print the character to screen.
						wr  = 0x0700;                  //Restore the chatacter's display
						                               //attribute.
					}
				}
			}
		}
	}

__TERMINAL:
	return 0;
}
开发者ID:KimZhou,项目名称:HelloX_Kernel,代码行数:91,代码来源:IOCTRL_S.C


示例16: type

static DWORD type(__CMD_PARA_OBJ* pCmdObj)
{
#ifdef __CFG_SYS_DDF
	HANDLE   hFile = NULL;
	CHAR     Buffer[128];
	DWORD    dwReadSize   = 0;
	DWORD    dwTotalRead  = 0;
	DWORD    i;
	CHAR     FullName[MAX_FILE_NAME_LEN];
	WORD     ch = 0x0700;

	if(pCmdObj->byParameterNum < 2)
	{
		PrintLine("  Please specify the file name to be displayed.");
		goto __TERMINAL;
	}
	strcpy(FullName,FsGlobalData.CurrentDir);
	strcat(FullName,pCmdObj->Parameter[1]);
	ToCapital(FullName);
		
	//Try to open the target file.
	hFile = IOManager.CreateFile((__COMMON_OBJECT*)&IOManager,
		FullName,
		FILE_ACCESS_READ,
		0,
		NULL);
	if(NULL == hFile)
	{
		PrintLine("  Please specify a valid and present file name.");
		goto __TERMINAL;
	}
	//Try to read the target file and display it.
	GotoHome();
	ChangeLine();
	do{
		if(!IOManager.ReadFile((__COMMON_OBJECT*)&IOManager,
			hFile,
			128,
			Buffer,
			&dwReadSize))
		{
			PrintLine("  Can not read the target file.");
			goto __TERMINAL;
		}
		for(i = 0;i < dwReadSize;i ++)
		{
			if('\r' == Buffer[i])
			{
				GotoHome();
				continue;
			}
			if('\n' == Buffer[i])
			{
				ChangeLine();
				continue;
			}
			ch += Buffer[i];
			PrintCh(ch);
			ch = 0x0700;
		}
		dwTotalRead += dwReadSize;
	}while(dwReadSize == 128);

	GotoHome();
	ChangeLine();
	_hx_sprintf(Buffer,"%d byte(s) read.",dwTotalRead);
	PrintLine(Buffer);

__TERMINAL:
	if(NULL != hFile)
	{
		IOManager.CloseFile((__COMMON_OBJECT*)&IOManager,
			hFile);
	}
	return SHELL_CMD_PARSER_SUCCESS;;
#else
	return FS_CMD_FAILED;
#endif
}
开发者ID:hellox-project,项目名称:HelloX_OS,代码行数:79,代码来源:FS.C


示例17: SC_PrintCh

static void   SC_PrintCh(__SYSCALL_PARAM_BLOCK*  pspb)
{
	PrintCh((WORD)PARAM(0));
}
开发者ID:AlexShiLucky,项目名称:HelloX_OS,代码行数:4,代码来源:SYSCALL_IO.C


示例18: ChartMidpointRelation

void ChartMidpointRelation()
{
    int cs[cSign + 1];
    char sz[cchSzDef];
    int mcut = -1, icut=-1, jcut=-1, mlo=-1, ilo=-1, jlo=-1, m, i, j, count = 0, l;
    long lSpanSum = 0;
    char ignoreT[objMax];

    if (us.nRel == rcTransit) {
        for (l = 0; l <= cObjOpt; l++)
            ignoreT[l] = FIgnore2(l);
    } else if (us.nRel == rcProgress) {
        for (l = 0; l <= cObjOpt; l++)
            ignoreT[l] = FIgnore3(l);
    } else {
        for (l = 0; l <= cObjOpt; l++)
            ignoreT[l] = FIgnore(l);
    }

    ClearB((lpbyte)cs, (cSign + 1)*(int)sizeof(int));
    loop {
        mlo = 21600;

        /* Search for the next closest midpoint farther down in the zodiac. */

        for (i = 0; i <= cObjOpt; i++) if (!FIgnore(i))
                for (j = 0; j <= cObjOpt; j++) if (!ignoreT[j]) {
                        m = (grid->n[j][i]-1)*30*60 + grid->v[j][i];
                        if ((m > mcut || (m == mcut && (i > icut ||
                                                        (i == icut && j > jcut)))) && m < mlo) {
                            ilo = i;
                            jlo = j;
                            mlo = m;
                        }
                    }
        if (mlo >= 21600)    /* Exit when no midpoint farther in zodiac found. */
            break;
        mcut = mlo;
        icut = ilo;
        jcut = jlo;
        count++;                               /* Display the current midpoint. */
#ifdef INTERPRET
        if (us.fInterpret) {                   /* Interpret it if -I in effect. */
            InterpretMidpointRelation(ilo, jlo);
            continue;
        }
#endif
        cs[mlo/60/30+1]++;
        sprintf(sz, "%4d: ", count);
        PrintSz(sz);
        PrintZodiac((real)mlo/60.0);
        PrintCh(' ');
        PrintAspect(ilo, SFromZ(cp1.obj[ilo]), (int)RSgn(cp1.dir[ilo]), 0,
                    jlo, SFromZ(cp2.obj[jlo]), (int)RSgn(cp2.dir[jlo]), 'M');
        AnsiColor(kDefault);
        m = (int)(MinDistance(cp1.obj[ilo], cp2.obj[jlo])*60.0);
        lSpanSum += m;
        sprintf(sz, "-%4d%c%02d' degree span.\n", m/60, chDeg1, m%60);
        PrintSz(sz);
    }

    PrintMidpointSummary(cs, count, lSpanSum);
}
开发者ID:JoshMPlant,项目名称:astrolog,代码行数:63,代码来源:charts2.c



注:本文中的PrintCh函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PrintConstant函数代码示例发布时间:2022-05-30
下一篇:
C++ PrintCallStack函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap