⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fiolib.c

📁 the vxworks system kernel souce packeg.there may be something you need .
💻 C
📖 第 1 页 / 共 5 页
字号:
* A negative field width argument is taken as a `-' flag followed by a positive* field width.  A negative precision argument is taken as if the precision* were omitted.** The flag characters and their meanings are:* .iP `-'* The result of the conversion will be left-justified within the field.* (it will be right-justified if this flag is not specified.)* .iP `+'* The result of a signed conversion will always begin with a plus or * minus sign.  (It will begin with a sign only when a negative value* is converted if this flag is not specified.)* .iP `space'* If the first character of a signed conversion is not a sign, or * if a signed conversion results in no characters, a space will be * prefixed to the result.  If the `space' and `+' flags both appear, the* `space' flag will be ignored.* .iP `#'* The result is to be converted to an "alternate form."  For `o' conversion* it increases the precision to force the first digit of the result to be a* zero.  For `x' (or `X') conversion, a non-zero result will have "0x" (or* "0X") prefixed to it.  For `e', `E', `f', `g', and `g' conversions, the* result will always contain a decimal-point character, even if no digits* follow it.  (Normally, a decimal-point character appears in the result of* these conversions only if no digit follows it).  For `g' and `G'* conversions, trailing zeros will not be removed from the result.  For* other conversions, the behavior is undefined.* .iP `0'* For `d', `i', `o', `u', `x', `X', `e', `E', `f', `g', and `G' conversions,* leading zeros (following any indication of sign or base) are used to pad* to the field width; no space padding is performed.  If the `0' and `-'* flags both appear, the `0' flag will be ignored.  For `d', `i', `o', `u',* `x', and `X' conversions, if a precision is specified, the `0' flag will* be ignored.  For other conversions, the behavior is undefined.* .LP** The conversion specifiers and their meanings are:* .iP "`d', `i'"* The `int' argument is converted to signed decimal in the style* `[-]dddd'.  The precision specifies the minimum number of digits * to appear; if the value being converted can be represented in* fewer digits, it will be expanded with leading zeros.  The* default precision is 1.  The result of converting a zero value* with a precision of zero is no characters.* .iP "`o', `u', `x', `X'"* The `unsigned int' argument is converted to unsigned octal (`o'),* unsigned decimal (`u'), or unsigned hexadecimal notation (`x' or `X')* in the style `dddd'; the letters abcdef are used for `x' conversion* and the letters ABCDEF for `X' conversion.  The precision specifies* the minimum number of digits to appear; if the value being * converted can be represented in fewer digits, it will be * expanded with leading zeros.  The default precision is 1.  The* result of converting a zero value with a precision of zero is * no characters.* .iP `f'* The `double' argument is converted to decimal notation in the * style `[-]ddd.ddd', where the number of digits after the decimal* point character is equal to the precision specification.  If the* precision is missing, it is taken as 6; if the precision is zero* and the `#' flag is not specified, no decimal-point character* appears.  If a decimal-point character appears, at least one * digit appears before it.  The value is rounded to the appropriate* number of digits.* .iP "`e', `E'"* The `double' argument is converted in the style `[-]d.ddde+/-dd',* where there is one digit before the decimal-point character * (which is non-zero if the argument is non-zero) and the number* of digits after it is equal to the precision; if the precision* is missing, it is taken as 6; if the precision is zero and the * `#' flag is not specified, no decimal-point character appears.  The* value is rounded to the appropriate number of digits.  The `E'* conversion specifier will produce a number with `E' instead of `e'* introducing the exponent.  The exponent always contains at least* two digits.  If the value is zero, the exponent is zero.* .iP "`g', `G'"* The `double' argument is converted in style `f' or `e' (or in style * `E' in the case of a `G' conversion specifier), with the precision* specifying the number of significant digits.  If the precision* is zero, it is taken as 1.  The style used depends on the * value converted; style `e' (or `E') will be used only if the * exponent resulting from such a conversion is less than -4 or * greater than or equal to the precision.  Trailing zeros are* removed from the fractional portion of the result; a decimal-point* character appears only if it is followed by a digit.* .iP `c'* The `int' argument is converted to an `unsigned char', and the * resulting character is written.* .iP `s'* The argument should be a pointer to an array of character type.* Characters from the array are written up to (but not including)* a terminating null character; if the precision is specified,* no more than that many characters are written.  If the precision* is not specified or is greater than the size of the array, the* array will contain a null character.* .iP `p'* The argument should be a pointer to `void'.  The value of the * pointer is converted to a sequence of printable characters,* in hexadecimal representation (prefixed with "0x").* .iP `n'* The argument should be a pointer to an integer into which* the number of characters written to the output stream* so far by this call to fprintf() is written.  No argument is converted.* .iP `%'* A `%' is written.  No argument is converted.  The complete* conversion specification is %%.* .LP** If a conversion specification is invalid, the behavior is undefined.** If any argument is, or points to, a union or an aggregate (except for an * array of character type using `s' conversion, or a pointer using `p' * conversion), the behavior is undefined.** In no case does a non-existent or small field width cause truncation of a* field if the result of a conversion is wider than the field width, the* field is expanded to contain the conversion result.** INCLUDE FILES: fioLib.h ** RETURNS:* The number of characters written, or a negative value if an* output error occurs.** SEE ALSO: fprintf(),* .I "American National Standard for Information Systems -"* .I "Programming Language - C, ANSI X3.159-1989: Input/Output (stdio.h)"** VARARGS1*/int printf    (    const char *  fmt,	/* format string to write */    ...      		/* optional arguments to format string */    )    {    va_list vaList;	/* traverses argument list */    int nChars;    va_start (vaList, fmt);    nChars = fioFormatV (fmt, vaList, printbuf, 1);    va_end (vaList);    return (nChars);    }/********************************************************************************* printErr - write a formatted string to the standard error stream** This routine writes a formatted string to standard error.  Its function and* syntax are otherwise identical to printf().** RETURNS: The number of characters output, or ERROR if there is an error* during output.** SEE ALSO: printf()** VARARGS1*/int printErr    (    const char *  fmt, 	/* format string to write */    ...      		/* optional arguments to format */    )    {    va_list vaList;	/* traverses argument list */    int nChars;    va_start (vaList, fmt);    nChars = fioFormatV (fmt, vaList, printbuf, 2);    va_end (vaList);    return (nChars);    }/********************************************************************************* printExc - print error message** If at interrupt level or other invalid/fatal state, then "print"* into System Exception Message area.** NOMANUAL*/void printExc (fmt, arg1, arg2, arg3, arg4, arg5)    char *fmt;	/* format string */    int arg1;    int arg2;    int arg3;    int arg4;    int arg5;    {    UINT	state;    int		pageSize;    char *	pageAddr;    if ((INT_CONTEXT ()) || (Q_FIRST (&activeQHead) == NULL))	{	/* Exception happened during exception processing, or before	 * any task could be initialized. Tack the message onto the end	 * of a well-known location. 	 */	/* see if we need to write enable the memory */	if (vmLibInfo.vmLibInstalled)	    {	    pageSize = VM_PAGE_SIZE_GET();	    pageAddr = (char *) ((UINT) sysExcMsg / pageSize * pageSize);	    if ((VM_STATE_GET (NULL, (void *) pageAddr, &state) != ERROR) &&		((state & VM_STATE_MASK_WRITABLE) == VM_STATE_WRITABLE_NOT))		{		TASK_SAFE();			/* safe from deletion */		VM_STATE_SET (NULL, pageAddr, pageSize, VM_STATE_MASK_WRITABLE,			      VM_STATE_WRITABLE);		sysExcMsg += sprintf (sysExcMsg,fmt,arg1,arg2,arg3,arg4,arg5);		VM_STATE_SET (NULL, pageAddr, pageSize, VM_STATE_MASK_WRITABLE,			      VM_STATE_WRITABLE_NOT);		TASK_UNSAFE();			/* unsafe from deletion */		return;		}	    }	sysExcMsg += sprintf (sysExcMsg, fmt, arg1, arg2, arg3, arg4, arg5);	}    else        {        /* queue printErr() so that we do not block here (SPR 22735) */        excJobAdd ((VOIDFUNCPTR)printErr, (int)fmt, arg1,arg2,arg3,arg4,arg5);        }    }/********************************************************************************* fdprintf - write a formatted string to a file descriptor** This routine writes a formatted string to a specified file descriptor.  Its* function and syntax are otherwise identical to printf().** RETURNS: The number of characters output, or ERROR if there is an error* during output.** SEE ALSO: printf()** VARARGS2*/int fdprintf    (    int fd,		/* file descriptor to write to */    const char *  fmt,	/* format string to write */    ...			/* optional arguments to format */    )    {    va_list vaList;	/* traverses argument list */    int nChars;    va_start (vaList, fmt);    nChars = fioFormatV (fmt, vaList, printbuf, fd);    va_end (vaList);    return (nChars);    }/********************************************************************************* sprintf - write a formatted string to a buffer (ANSI)** This routine copies a formatted string to a specified buffer, which is* null-terminated.  Its function and syntax are otherwise identical* to printf().** RETURNS:* The number of characters copied to <buffer>, not including the NULL * terminator.** SEE ALSO: printf(),* .I "American National Standard for Information Systems -"* .I "Programming Language - C, ANSI X3.159-1989: Input/Output (stdio.h)"** VARARGS2*/int sprintf    (    char *  buffer,	/* buffer to write to */    const char *  fmt,	/* format string */    ...			/* optional arguments to format */    )    {    va_list	vaList;		/* traverses argument list */    int		nChars;    va_start (vaList, fmt);    nChars = fioFormatV (fmt, vaList, putbuf, (int) &buffer);    va_end (vaList);    *buffer = EOS;    return (nChars);    }/********************************************************************************* vprintf - write a string formatted with a variable argument list to standard output (ANSI)** This routine prints a string formatted with a variable argument list to* standard output.  It is identical to printf(), except that it takes* the variable arguments to be formatted as a list <vaList> of type `va_list'* rather than as in-line arguments.** RETURNS: The number of characters output, or ERROR if there is an error* during output.** SEE ALSO: printf(),* .I "American National Standard for Information Systems -"* .I "Programming Language - C, ANSI X3.159-1989: Input/Output (stdio.h)"*/int vprintf    (    const char *  fmt,		/* format string to write */    va_list	  vaList	/* arguments to format */    )    {    return (fioFormatV (fmt, vaList, printbuf, 1));    }/********************************************************************************* vfdprintf - write a string formatted with a variable argument list to a file descriptor** This routine prints a string formatted with a variable argument list to a* specified file descriptor.  It is identical to fdprintf(), except* that it takes the variable arguments to be formatted as a list <vaList> of* type `va_list' rather than as in-line arguments.** RETURNS: The number of characters output, or ERROR if there is an error* during output.** SEE ALSO: fdprintf()*/int vfdprintf    (    int		  fd,		/* file descriptor to print to */    const char *  fmt,		/* format string for print */    va_list	  vaList	/* optional arguments to format */    )    {    return (fioFormatV (fmt, vaList, printbuf, fd));    }/********************************************************************************* vsprintf - write a string formatted with a variable argument list to a buffer (ANSI)** This routine copies a string formatted with a variable argument list to* a specified buffer.  This routine is identical to sprintf(), except that it* takes the variable arguments to be formatted as a list <vaList> of type* `va_list' rather than as in-line arguments.** RETURNS: * The number of characters copied to <buffer>, not including the NULL * terminator.** SEE ALSO: sprintf(),* .I "American National Standard for Information Systems -"* .I "Programming Language - C, ANSI X3.159-1989: Input/Output (stdio.h)"*/int vsprintf    (    char *	  buffer,	/* buffer to write to */    const char *  fmt,		/* format string */    va_list	  vaList	/* optional arguments to format */    )    {    int nChars;    nChars = fioFormatV (fmt, vaList, putbuf, (int) &buffer);    *buffer = EOS;    return (nChars);    }#ifdef _WRS_ALTIVEC_SUPPORT

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -